Thursday, January 21, 2010

.NET Namespace Naming Convention with Team Name in it

I hated naming conventions from collage time and nothing is much different today. Saying that, I also must accept that I secretly liked Microsoft's guidelines about naming conventions as it gives more freedom and meaningful restrictions than others (specially Sun Java). Let's leave other naming conventions and concentrate on namespace's maming convention of your assembly and classes.

Why namespace naming is important?
A namespace gives first hand impression on what the class and its method must be doing. With that, a class should get a unique identification based on its namespace. Carelessly crafted names are misleading advertisement which repulses intended audience or create confusion.

How Microsoft Tells us to name a namespace?
is what Namespace Naming Guidelines tells. Example being Microsoft.Build.Tasks

Is it long enough?
Organizations, with help of smart programmers, are now taking little more effort to refactor the code to extract common code which can be reused across teams. It is not impossible (infact it's more frequent) to have multiple implementation approach of a 'similar' feature by different team. For example team 'TreamA' and 'TeamB' in organization 'MyOrg' might have taken differnt approach to develop a media content viewer optimized for their own scenarios. If the organization want to share these media viewers across many teams to use, 'unique identification' functionality of namespace stands violated as media viewer class from both the team will look like,
This would not have occured if the namespace of viewers were named "MyOrg.Media.TreamA.Viewer" and "MyOrg.Media.TreamB.Viewer" beforehand.

I believe we should giving implementing team name in name as ending part of namespace. So my format would be

No comments: