Rant of the day – OOP design principles

July 18, 2007

Coming from the background of enterprise-level software applications development, it is often sad to see development of software being pushed into dead-ends with end-less and count-less bug fixes, and feature break-downs. Though Object-Oriented software design approach was introduced many years ago (or at least 10-15 years ago), it is still surprisingly common to find so many software packages created with lack of basic understanding of OOA&D principles in mind. The other day after I finished reading this Head First Object-Oriented Analysis and Design book from O’Reilly, I feel this book should be recommended to anyone who seriously considering a career in the software development field, at least anyone who are using or planning to use object-oriented language to develop software packages. Here is a nice summary of OOA&D principles. Personally I found the following principles of are very important to understand and follow wisely to build a successful and adaptable system:

Also in general, programming to interfaces, not inheritances can help a big time in many cases. Composition, decorator (or helper service)-based approach is more adaptive than inheritance based approach. We learned that in one of my previous projects in a hard way.

WPF is an excellent example of the extensive usage of decorator (helper-service) approach – through DependentProperty, AttachedProperty, you don’t have to subclass the existing UI elements to add new behaviors. Instead, you build decorators and through AttachedProperty, you can modify or extend behaviors of existing UI elements.