[WARNING: LONG AND TECHNICAL]
I recently got a book on design patterns in software. It basically takes a well-known theory on patterns in home and building architecture and applies it to programming. The result is creating software that is incredibly flexible, portable, extensible, and easy to manage. In reading it, I've been identifying ways I can improve the code I've written at Motorola.
One of these improvements lies with IHttpHandler, an interface that defines how an http request from a client is handled and the resulting content delivered. Visual Studio and the standard ASP.NET programming model steer you away from using IHttpHandler directly in favor of the "simpler" technique of subclassing the Page class to create...pages. I put quotation marks around simpler because this technique is only simpler in small, non-complex applications.
When the application reaches a certain complexity, this PageController pattern becomes very cumbersome. This is when you need to create an entity that can make alot of decisions outside the context of a page, delegate data retreival and manipulation to other entities, and let the Page be a very passive participant. This concept is realized in the FrontController pattern, which is easily implemented via the IHttpHandler interface.
It is encouraging to see the concept of Patterns being embraced and documented so well at Microsoft. I'll be implementing some ideas this week, and I'll update you on the progress.
Remember Me
Page rendered at Monday, September 08, 2008 7:36:55 AM (Pacific Standard Time, UTC-08:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.