Tag Archives: C#

C# Regions

Whilst reviewing a solution I came across the class in the image below, and felt the need for a rant about using regions.

Regions C#

If you need regions, you should consider if the class has more than one RESPONSIBILITY and or is too big! In this case it is responsible for everything and over 1800 lines of code:-(

So a tip, if you need to use the #REGION’s in your code. I would advise you take a few moments and ensure that the class does not have mixed responsibilities. If it does have more than one responsibility you should split it up into a number of smaller classes with a clearly defined responsibility.

I re-factored the class into the following classes:

  • 4 Service classes
  • 13 Factories
  • 13 Repositories
  • 13 Model classes.

In fact by the time I had removed all the code from the class I found that it was not required at all 🙂

Result of the Danish Sitecore Developer Group survey

The survey is now closed and here are the results:

q9 q7Danish Sitecore Developer Groupq6 q5 q4 q3 q2 q1

 

Free text comments received:

  1. I liked the way that DSDG has been untill now
  2. thank you 🙂
  3. Great questions
  4. I think meetup could be extended to other .NET CMS systems and related technologies. Why not grouping with Umbraco, EpiServer etc. to broaden our knowledge.
  5. great to have a SC community like DSDG
  6. Good to see that the group is thriving. It’s a struggle to get things up and running here in au – keep the community-run group.
  7. If anything, clearer expectations of meeting content would be really nice. It would allow me to better decide whether to go or not – especially if the meeting frequency would go up (which I’d prefer). So for example, if someone was really into a particular subject, then they could get together and I would know better up front what the subject was really about
  8. Only been to 1 meeting, but it was a very positive thing and like to come to more