# Stratified design
* Understand **stratified design** and how it can help your team.
* Learn how to **extract functions** to make code cleaner.
## Definition:
Stratified design is a technique for building software in **layers**.
## Advantage:
1. flexible to change
2. Readable
3. Easy to test
4. Reusable
## The inputs to a stratified design sense
* Function bodies (Length/Complexity/Levels of detail/Functions called/Language features used) -> Detail
* Layer structure (Arrow length/**Cohesion**/Level of detail) -> Cohesion
* Function signatures (Function name/Argument names/Argument values/Return value) -> Name
## The outputs from a stratified design sense
* Organization (Decide where a new function goes./Move functions around.)
* Implementation (Change an implementation./Extract a function./Change a data structure.)
* Changes (Choose where new code is written./Decide what level of detail is appropriate.)
# Pattern 1: Straightforward implementations
## Visualizing function calls with a call graph


## Addingremove_item_by_name()to the graph


## All functions in a layer should serve the same pupose (Cohesion)
### Each of these layers is a different level of abstraction. That is, when you are working on functions in one layer, there are some common details that you don’t have to care about.
## Three different zoom levels
1. Globalzoomlevel -> Interaction between layers

2. Layer zoom level -> Implementation of one layer

3. Function zoom level -> Implementation of one function

## At the layer zoom level, we compare arrows across functions



## Summary
* Stratified design organizes code into layers of **abstraction**. Each layer helps us ignore different details.
* The **name** tells us the intent of the function. We can group it with other functions with related intents.
* The body can tell us the **details** that are important to a function. These are clues as to where in the layer structure it goes.
* We can improve the layer structure by extracting out more general functions. **More general functions are on lower layers and are more reusable.**