Chapter 11. Testable Design Patterns
Now that you know how ASP.NET MVC works and (hopefully) understand the basics of Test Driven Development (TDD), it's time to jump into something more concrete: How can you structure your application to be a bit more testable and, moreover, maintainable? Understanding testable development patterns will allow you to work with one of the core strengths of ASP.NET MVC — testability. It should be noted here (and will be noted several more times in this chapter) that the term testability refers solely to your ability to test the code you write — not specifically to TDD, which we covered in the previous chapter. So, if you're thinking that we the authors are going to use this chapter as a TDD soapbox, you can rest assured that we're not.
While it might seem that we're pushing testability as the end goal of these patterns, it really is not the ultimate goal. This chapter contains coverage of some timeless object-oriented design principles that promote low coupling and high cohesion in your code. These principles help to ensure that your code is easy to change and not brittle. It helps to future-proof your code by ensuring that code is extensible from the outside. Testability — the ability to test your code easily — just happens to be a nice side effect of following these principles. Testability is also a form of verification that your code has these positive traits such as loose coupling. We understand that when discussing architecture, there be dragons ...
Get Professional ASP.NET MVC 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.