liveBook · Manning

Chapter 8: Stratified design: Part 1

What you will learn in chapter 8 of Grokking Simplicity

The chapter introduces stratified design as writing functions in terms of functions defined in lower layers.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The chapter introduces stratified design as writing functions in terms of functions defined in lower layers.

Key terms: stratified design, lower layers

8.1 What is software design?

Defines software design as using aesthetic judgment to make software easier to develop and maintain.

Key terms: software design, aesthetic sense

8.2 What is stratified design?

This section defines stratified design as building software in layers and explains why arranging those layers calls for design judgment.

Key terms: stratified design, layers, sense of good design, best design

8.3 Developing our design sense

The section presents stratified design sense as recognizing clues in code and using them to make design decisions, while explaining why that judgment is hard to teach explicitly.

Key terms: stratified design sense, clues, function bodies, layer structure, function signatures, curse of expertise, black box

8.4 Patterns of stratified design

Introduces four patterns for judging whether the layers of a stratified design help programmers work at an appropriate level of detail.

Key terms: straightforward implementation, function signature, code smell, abstraction barrier, interface, implementation detail, minimal interface, business concepts, operations, comfortable layers

8.5 Pattern 1: Straightforward implementations

The section shows how to make shopping-cart code easier to read by replacing low-level details with operations at a consistent level of abstraction and using call graphs to examine the resulting layers.

Key terms: straightforward implementations, low-level code, shopping cart operations, call graph, layers of abstraction, for loop, array index, remove_item_by_name(), isInCart(), layer

8.6 Three different zoom levels

The section uses three call-graph zoom levels to locate stratified-design problems and shows how long arrows reveal uneven implementation detail.

Key terms: global zoom level, layer zoom level, function zoom level, call graph, straightforward implementation, arrows, intermediary functions, remove_item_by_name()

8.7 Extracting the for loop

The section refactors shopping-cart functions into clearer layers and uses their call graphs to evaluate reuse and design tradeoffs.

Key terms: linear search, indexOfItem(), remove_item_by_name(), isInCart(), array index, boolean, setPriceByName(), arraySet(), longer arrows, layers

8.8 Pattern 1 Review: Straightforward implementation

Reviews how straightforward implementations keep code at a consistent level of detail, using function extraction without merely hiding complexity.

Key terms: straightforward implementations, levels of detail, call graph, function signature, body, layers, extract out, more general function, helper functions, serendipitous reuse

8.9 Conclusion

The conclusion recaps how call graphs reveal abstraction layers and how stratified design uses those layers to build straightforward functions.

Key terms: call graph, layers of abstraction, stratified design, straightforward implementations, layer structure

8.10 Summary

8.11 Up next…

This section previews the next chapter’s additional patterns based on code layers.

Where this is used later

Concepts explained in this chapter

← Chapter 7: Staying immutable with untrusted code Chapter 9: Stratified design: Part 2 →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.