I have had the book Code Complete 2 by Steve McConnell for quite some time, but I find myself often drifting asleep as I start reading it. I don't know if the book itself doesn't engage my interest enough or if I just happen to be overly tired those nights when I attempt to read it :)
Last night, however, a particular section caught my attention as it reinforces those things I have been talking about for the past 2 weeks. A particular section in the book is entitled “Desirable Characteristics of a Design.“ It just so happens that a lot of these desirable charasteristics, say of an ASP.NET Website Architecture, are the same characteristics described by the GRASP Patterns I have been discussing from Applying UML and Patterns; in particular, the Low Coupling GRASP Pattern and the High Cohesion GRASP Pattern. These are the same terms that were mentioned in Domain-Driven Design when I talked about Layered Applications.
Steve mentions several desirable characteristics of a design and also mentions how some of these design goals contradict other goals. This really gets us to the heart of our jobs as developers / architects - creating a good set of tradeoffs between competing characteristics. Well said, Steve.
Most of these design characteristics are common sense, but good to keep in view as you are working through application design:
- Minimal complexity - Avoid making “clever“ designs. Clever designs are usually hard to understand. Keep it simple.
- Ease of maintenance
- Loose coupling - Loose coupling means designing so that you hold connections among different parts of a program to a minimum.
- Extensability - You should be able to change a piece of the system without causing a huge impact to other pieces of the system.
- Reusability
- High fan-in - Refers to having a high number of classes that use a given class. High fan-in implies that a system has been designed to make good use of utilitity classes at the lower levels in the system.
- Low-to-medium fan-out - A given class should use a low-to-medium number of other classes. High fan-out (more than about seven) indicates a class uses a large number of other classes and may be overly complex.
- Portability
- Leanness
- Stratification - Try to keep the levels of decomposition stratified so you can view the system at any single level without dipping into other levels.
- Standard techniques - Give the whole system a familiar feeling by using standardized, common approaches.
Pretty sound advice from only 2 pages of an 850+ page book :)