liveBook · Manning

Stratified design

As explained in Grokking Simplicity

An architectural pattern that organizes software into layers ordered from relatively stable foundations to more frequently changing elements.

Stratified design organizes software into layers of abstraction. Each layer defines functions in terms of functions below it, creating foundations that change slowly and higher layers that change more often. A common arrangement separates business rules, domain rules, and the technology stack. section 2.9 section 8.2

Use these patterns to shape and review the layers:

  • Build straightforward implementations that solve a function’s problem at one level of detail; treat excess detail as a design smell. section 8.8
  • Create abstraction barriers that hide important implementation details behind interfaces, allowing higher-level code to remain focused. section 9.1
  • Converge important business concepts on a minimal interface whose operations support the rest of the system. section 9.1
  • Keep layers comfortable and purposeful; invest in abstractions that improve delivery and quality rather than adding layers for sport. section 9.14

To improve a design, inspect function names, signatures, bodies, language features, and the call graph. Extract more general functions when a function mixes levels of detail. General functions usually become easier to test, clearer to read, and more reusable. section 8.3 section 8.10

Pizza restaurant software

Separate JavaScript foundations such as arrays and objects from pizza-making rules, then place changing business specifics such as the current menu above them. This arrangement keeps menu changes from affecting much of the underlying code. section 2.9 section 2.19

Image

Use the layer diagram to visualize stable foundations, domain logic, and more changeable business-specific code. section 2.9

How Grokking Simplicity covers it

How deep it goes
Develops four review patterns and uses function clues and call graphs, while leaving the best design partly to judgment.
Examples
Uses pizza software, JavaScript foundations, changing menus, function extraction, and call-graph diagrams as teaching examples.
What you can do after
Apply layered design by locating functions, extracting general operations, and shaping interfaces for clearer testing and maintenance.
How it connects
Connects actions, calculations, data, call graphs, abstraction barriers, minimal interfaces, and onion architecture.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Simplicity. The section links point to the parts of the book it draws on.