More best practices

As addition on Hans’ entry, some more C# trics:
Use regions(to divide mehods)!
In don’t care you don’t use full triple slashing for all your methods! First start dividing classes in regions!
For example:

When opening this class I can easily navigate trough it, without running trough a huge amount of lines. It’s much easier to understand. Then it’s up to your code skills to write understandable code.

NEVER use regions(inside methods)!
You definitelly shouldn’t divide lines of code. Rather extract lines of code to new methods. Review or let someone else review your code. Why does this method contaqin this terrible amount of lines?

Use self explaining namespaces:
The first explaination of your code starts with dividing in the right chapters: namespaces. Microsoft shows how you should do it in the mscorlib(System.Text, System.IO, etc). For our internal library adapts the Sitecore-namespaces. For example: LECTRIC.SC.Pipelines or LECTRIC.SC.Configuration.
The SC is there instead of Sitecore as it would cause problems with the compiler :(. Namespaces are definitelly badly implemented in the CLR. MS promised to work on it before releasing .NET 2.0, but I guess we’ve to wait for .NEt 3.5 as notthing seems to be changed???

Library names and structures
One of the problems for maintaining is the usage of huge garbage DLLs. For now on, we try to divide functionality and presentation over more DLLs. In the past everythign was in just one, badly named DLL.
1. [Customer].(Subsite.)[Projectname].Layouts for the code behind the Layouts
2. [Customer].(Subsite.)[Projectname].Business for general logic
3. [Customer].(Subsite.)[Projectname].Controls for site independent WebControls
4. [Customer].(Subsite.)[Projectname].DataAccess for external data sources like databases, most of the time only contains Typed Datasets
Adapting the dll-names as namespaces is preferible, but not necesarry.

LECTRIC.Yourzine.Internet.Layouts.dll: LECTRIC’s Internet subsite Yourzine, and then the layouts of them 😉
LECTRIC.Internet.Controls.dll: Controls to be used on all Internet sites and subsites.

We adapt Sitecore 5.3’s structure for solutions:
+ Data (for licences and logs)
+ Databases (uhmm. database files ;))
+ Website (webroot)

Hans, Coffee?