I gave a talk about ReSharper today, and I used the PetShop demo app as the base code. I have purposefully avoided looking at the source code of the sample until today, because I wanted to get a gueniue experience, rather than a rehearsed one. I don't think it went as well as it could have, but that is not the point of this post. The point is to talk about just the code quality of the PetShop application.
First, let us see what the PetShop application is:
The Microsoft .NET Pet Shop 2.0 illustrates basic and advanced coding concepts within an overall architectural framework
The Pet Shop example is supposed to illustrate "coding concepts", but mostly it demonstrate those that you want to avoid. I was shocked by what I was seeing there.
I am going to touch just the account class, because if has enough issues all on its own. The account class is supposed to be a domain entity, but what do you see when you open it?
And I really don't like to see SQL inside my code.
And then there is this:
And suddenly I am confused, because I see a class that is doing the work of three classes, and that is just by casual browsing.
And then we had this:
Somehow, public fields and violating the .NET naming conventions doesn't really strikes me as a good idea.
Code duplication, like between the Account.Insert() and Account.Update(), both have significant duplication in the form of:
I thought that the whole idea of a sample app was to show of best practices, and that is... quite not so, in this case.