Today I had a discussion about coding guidelines and in particular about the size of a class, the number of methods in a class and the number of lines of code per class. What is right?
Ofcourse a little search on Google revealed millions of hits. Some of the more useful ones were:
Most standards don't say much about the size of a class, the number of methods in a class and the number of lines of code per class. The few that do say something come fairly close.
Here's the sum of guidelines that I think I'll stick by:
Ad 2.This is the average I found and seems to make sense, since this means that with one look at the screen your brain can absorb the whole method.
Ad 3.I'm not convinced this is a very important rule. Having 2000 lines of code in one file or spread across two classes in two files doesn't really make that big a difference to me. See also ad 5.
Ad 4.This is mainly because of Intellisense. Ten methods will provide optimum use of Intellisense.
Ad 5.Partial classes are great!
dasBlog theme by Mads Kristensen
Concepts LINQ Entity Framework WCF WPF RESTful Web Unit Testing .NET Workflow More >>
Tools Visual Studio Windows IIS Silverlight More >>
Type Screencast Tools Video Newsletter Sample Article Books Magazine How To Demo Course Products More >>