MOSS Solution and Code Naming Conventions

This will be a short post, I simply want to put this out because I’m asked the same question from time to time. 

So what are the naming conventions for code, files, and folders associated with MOSS solutions development and deployment (and .NET in general). My answer is that it’s better to adopt community standards but your company may have other ideas. Naming conventions alone will never make or break a products quality. That is, no one should worry if your company decides on it’s own standards.

However, Microsoft and the .NET community do publish standards and suggestions. So given the choice its likely better “form” to learn and practice community and Microsoft standards as individual developers than just making them up as you go. I shy away from the term “industry” standards because it’s within your community or extended network of favorite .NET developers that you seek help and share code.

To begin, start using tools like FxCop and/or StyleCop because lots of others do so as well. The rules are embedded already. These analysis tools contain hundreds of rules for evaluating your code including naming conventions, security, and a bunch of other factors that go into thoughtful design. These tools are more like “quick start” guides. StyleCop is about layout and readability while FxCop is more about good code practices. These tools can also be incorporated into Team Foundation Server and run with scheduled builds.

What about MOSS specifically? The answer is, as always, to study from the masters directly. You find out how Microsoft names its files and folders simply by looking into the 12 hive directory structure. Make note of how control templates, master pages, and folders are named. Follow the leader in this regard and learn from the best.

If you still want to go “old school” and examine naming rules more directly, say to add to your companies documentation for example, then you have a couple of choices. The first is to reverse engineer the rules out of FxCop and StyleCop (or maybe add your own). The second is to read the Microsoft and community commentary on the subject (although it seems to me just updating the Fx rules should be enough) . Here are some selected links – be aware not everyone will agree with everyone else.

Selected Community Contributions

http://www.irritatedvowel.com/Programming/Standards.aspx

http://weblogs.asp.net/lhunt/pages/CSharp-Coding-Standards-document.aspx (contains a PDF download on the site)

Microsoft – http://msdn.microsoft.com/en-us/library/aa291596(VS.71).aspx

FxCop – http://www.microsoft.com/downloads/details.aspx?FamilyID=9aeaa970-f281-4fb0-aba1-d59d7ed09772&displaylang=en

StyleCop – http://code.msdn.microsoft.com/Release/ProjectReleases.aspx?ProjectName=sourceanalysis&ReleaseId=1425

Team Foundation Server –  http://msdn.microsoft.com/en-us/teamsystem/default.aspx

This MS link is not so much about naming conventions but does capture related best practices – http://technet.microsoft.com/en-us/library/cc707802.aspx 

Happy coding!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s