February 04, 2007

If you read one technical book this year I implore you to consider Rockford Lhotka's Expert C# 2005 Business Objects (or Expert VB 2005 Business Objects if curly braces don't float your boat). This book does a marvelous job of describing the necessity for developers to strive towards a flexible means of interacting with data in a manner that's separated from presentation, modular, secure and scalable. The book then introduces CSLA - the author's answer to this need in the form of a free .NET library. After finishing the book and completing two projects that follow the CSLA methodology, I'm very pleased with the results and plan to continue using this framework in the future.

With CSLA, developers are encouraged to design responsibility-driven business objects that receive much of their core functionality by inheriting from the framework. This way all the plumbing for authorization, validation, n-tier scalability and n-level undo is already baked in. Additionally, care was taken to made sure that objects adhering to CSLA ideals are still first class citizens when data binding to WinForms and WebForms.

Throughout the book Rocky takes time to explain his choices regarding the code and design patterns that went into developing CSLA. It gave me an appreciation for the elegance and flexibility of his solution and prepared me for the later half of his book detailing usage of the framework in a sample project.

Using CSLA in my own projects has forced me to look beyond the practice of mapping objects 1-1 against a database schema (eg. the ADO.NET DataSet). Instead, it has led me to write my data-related objects based on the needs of my application, not the structure of my database. This subtle shift in mindset has greatly helped me to plan my projects more effectively and has generally resulted in more organized code.

The latest version of CSLA along with news regarding Rocky's books can be found here. Be sure to check it out!