After stumbling with the latest install of Orcas, I loaded up the Silverlight 1.1 chess demo and was blown away with the poor quality of the coding style used in the demo. I'm at a total loss as to how a public demo comes out like this. It truly saddens me because for every 1 shitty demo Microsoft puts out, it probably takes 100 good ones to even out.
Am I being too harsh? Judge for yourself:
1 -
Multiple public types per file which is a direct violation of Microsoft's INTERNAL Design Guidelines.
2 -
The namespace is "Chess", which also violates Microsoft's Design Guidelines.
3 -
The boardui.cs, browser.xaml and default.html.js files are all lowercase - all other files are PascalCased
4 -
Some simple getters are written in a single line, others over multiple lines
5 -
Some types and members rely on implicit visibility (don't specify private/internal/public), others specify it. I don't even know what the default type is...isn't it internal for classes and private for fields?
6 -
Fields are spread all over...most are at the top of the class definition, some are defined above a method half way down.
7 -
Single line case statement which violates Microsoft's Internal design guidelines
8 -
Classes with only static members that aren't sealed and don't have a private constructor (or, in 2.0, aren't marked as static)
9 -
An unbelievable amount of SET-only properties (again, like most of these, violates Microsoft's own design guidelines)
10 -
Within the same method, some fields are accessed with "this." others aren't
11 -
Some 1 line IF's/Loops have braces...some don't
12 -
Properties that call fairly expensive methods
13 -
Some usings are declared inside the namespace, some declared outside
14 -
Many if statements would benefit from Guard Clauses and Decompose Conditional refactoring
15 -
Poor use of #regions and very little of them
There's certainly more. Many of the items above (especially #1 and #6) make the sample very hard to read. Running the project through FxCop came up with 143 issues.
I want to cry.