9 December 2009
I’ve seen many ways of grouping C# source over the years, but one that I never fully appreciated as being disgusting until this year was grouping like PMEs: public methods, protected methods, etc.
Sure, many source formatting guidelines (and perhaps even default StyleCop settings) suggest this grouping style. But, tell me: what is useful about this?
Here’s the Grid.cs source file from WPF. Are the comments helpful? Are the regions?
I’d much rather see this file grouped into like functionality, if regions need to be used: give me size sharing source in one region, basic layout arrangement functions in another, and then perhaps all the dependency properties together.
Not sure what others think, but I hope to never have to open another file like Grid.cs and see this sort of thing. Just not my thing.
Jeff Wilcox is a Software Engineer at Microsoft in the Open Source Programs Office (OSPO), helping Microsoft engineers use, contribute to and release open source at scale.