9 Stratified design: Part 2
In this chapter
- Learn to construct abstraction barriers to modularize code.
- Discover what to look for in a good interface (and how to find it).
- Know when design is good enough.
- Discover how stratified design helps maintenance, testing, and reuse.
In the last chapter, we learned how to draw call graphs and look for layers to help us organize our code. In this chapter, we continue deepening our understanding of stratified design and honing our design intuition with three more patterns. These patterns help us with the maintenance, testing, and reuse of our code.
Patterns of stratified design
Just as a reminder, we are looking at the practice of stratified design through the lenses of four patterns. We already covered pattern 1 in the last chapter. Because we’ve already got the fundamentals down, in this chapter we will cover the remaining three. Here they are again for reference.
Patterns
- Straightforward implementations
- Abstraction barrier
- Minimal interface
- Comfortable layers
this chapter will cover the remaining three
Pattern 1: Straightforward implementation
The layer structure of stratified design should help us build straightforward implementations. When we read a function with a straightforward implementation, the problem the function signature presents should be solved at the right level of detail in the body. Too much detail is a code smell.
Pattern 2: Abstraction barrier