Wednesday, December 31, 2008 10:24 PM
Book Review: ASP.NET 3.5 Application Architecture and Design
I recently read a new book published by Packt Publishing, “ASP.NET 3.5 Application Architecture and Design” by Vivek Thakur. I've noticed a lot of articles and blog posts about design patterns and domain models in the ASP.NET community but it really mystified me until I read this book. Although many of the blog posts I've read have tried to be an introduction to design patterns, I'd have to say they all did a poor job compared to Vivek Thakur's book which explains it all in plain English. I learned how application architecture applies to web development and what advantages it is meant to offer.
For example, the chapter on tiers and layers explains how the business layer, UI layer, and data access layer relates to namespaces and classes you could create to organize your project. The chapter on entity-relationships clarified how the domain model used in the object-oriented system may differ from the logical data model used in the relational database management system.
I also found good explanations of; lazy loading, to defer the loading of all properties until they are really needed, the singleton pattern, which restricts and controls the number of objects instantiated for a particular object during the application life cycle, the factory method, used to create objects without prior knowledge of the object using interfaces, and dependency injection, which allows you to plug-in an implementation that satisfies the interface requirements. Although I've come across these terms before I had no idea what they meant or how they could apply to ASP.NET. You'll find some really basic examples of how you can write code to use these design patterns.
If you are an expert on application architecture and expect in-depth coverage of how to apply the factory method in ASP.NET then you'll be disappointed. I'd say this book is more helpful for someone like me, a developer who is completely mystified by what everyone seems to be writing about these days. That is not to say you might not pick up a few tips from the material. For example, page 137 mentions a lock statement that can be used to ensure thread safety and I'd never encountered that before.
I also appreciated the author's practical approach to design patterns. He does not recommend them for small projects. This kind of lets me off the hook because none of my projects could really justify the additional overhead of a loosely-coupled design. However that is not to say you won't encounter such design patterns in your work. For example, I'm currently trying to customize the Elgg open source web application for social networking and its database schema is a peculiar attempt to incorporate entity relationships directly in the physical data layer. In any event, you are not meant to directly access the database. Instead you should get a reference to an ElggObject and use its properties.
Filed under: ASP.NET, Application Design, lazy loading, singleton pattern, dependency injection, factory method