A Review of Pro ASP.NET MVC Framework by Steven Sanderson, ISBN 10: 1-4302-1007-9
Update
I started taking notes as I went along, but I’ve not stopped. I really recommend taking this book and working through the exercises. I’m confident you’ll be a better developer even if you’re are not particularly interested in MVC. (Of course, if you are doing web development, you should be interested in MVC)
I did work through the exercises with the added twist that I made the following substitutions:
- I used Microsoft’s Unity framework rather than Castle Windsor for Inversion of Control (IoC)
- I used Microsoft’s Visual Studio Test rather than NUnit fo unit testing
- I used Microsoft’s Entity Framework rather than Microsoft’s LINQ to SQL for data access
So what do I do differently today as a result of reading this:
- Write Unit Tests by hand (rather than use the Create Unit Test… feature in Visual Studio). This lets me create tests in a more organized fashion. That feature puts all the tests at the root level. I prefer the pattern of TestProject/Controller/ProductsControllerTest.cs
- Clearly place // Arrange, // Act, and // Assert in all my unit tests.
- Am even more diligent about keeping logic in my model layer rather than in my MVC application. To do this I follow his advice of not using the Model folder of the MVC application (unless I’m modeling a UI element) but instead keep the models in a separate dll.
- I use Moq now to improve the separation of concerns and the testability of my applications.
- And I’m sure I’ve changed some other habits that at the moment I’m forgetting…
I’ve not finished the book yet, but since the rest of the book seems to be going into much more detail and explaining, “Remember when you did this in the example? Here’s why, and here are all the other details you might want to know.” I wanted to go ahead and get a post up.
Original Notes:
While this is a great book for understanding Microsoft’s recently released ASP.NET MVC (Model View Controller) patter for developing web applications, this book also brings many topics to bear giving you a much better idea of how to write solid code. I’ll not just review some of the key MVC points here, but also some of the software development practices that really resonate with me…
“The domain model is the heart of the application, so it makes sense to start here.”! How many times have I said that? (Actually, I say, “…the heart and soul of the application,…”)
Chapter 4 – SportsStore: A Real Application
So what has me anticipating this exercise? He points out this will not be “Demoware”… i.e., just enough lines of code to make a point, but well developed software. At the point you begin to code that’s when everyone pretends to use the Unit Testing tools, but “That’s an exercise left to the reader”. That is not what Steven does. “As you’ll see, it doesn’t just improve the maintainability in the long term, but it also leads to cleaner application architecture in the short term, because testability forces applications components to be properly decoupled from one another.” writes Steven.
Leave a Reply