The Raison d’être of the Software Architect is designing all the layers of a system and the 20% percent of the packages which do the 80% of system’s tasks. Likewise the Software Designer main deliverable is the 20% of the classes’ design and development which do the 80% of the system’s task. Software Architect’s main focus is non-functional requirements; Software Designer’s main focus is functional requirements. In general, layers and packages’ design are very important tasks.
While designing layers bear in mind:
- Granularity: not too much, not too few. Group code in layers using a consistent abstraction level.
- Communication: it can be:
- Top/down: any of a top level with any of a bottom level.
- Strict iteration: upper layers communicate only with the next lower one.
- Loose iteration: no order. Any with any.
- Ask yourself:
- Will functional requirements cross cut layers?
- Which non-functional requirements are common to all layers?
- Which tiers host which layers?
- Minimize dependencies between layers with:
- Facades/Gateways which hides the internal working.
- Well defined inputs/outputs. Accomplish this with:
- Simple value types or composite types (i.e. adapters or decorators).
- Embrace dependency inversion (common interfaces/shared abstractions) if necessary. Decouple for a good reason.
- Commands, messages or events.
While designing packages bear in mind: Group sets of related functionality in packages. If a package has only one class your abstraction level is not consistent (in other words, you’re looking for details in some packages only). The same if you find a package with more than 7 classes.
In general: define a (small) set of rules and FOLLOW them. A sample rules could be: Given the rule that communication is strict then no element (e.g.: packages, layers, Facades,.) should communicate with another element in the same hierarchy level, so business rules Facades should communicate using events injected by controllers.
Javier Andrés Cáceres AlvisMicrosoft Most Valuable Professional – MVP Intel Black Belt Software Developer