- Simple means one fold.
- Complex means many folds.
- They are opposites.
Complexity is seen in the sense of how you create a complex pattern or structure by braiding (plaiting) or weaving.
-
Braiding interlocks strands (components/concerns) together.
-
Interlocking forms tight bonds between the strands.
-
Tight bonding between components/concerns is the problem.
-
It causes them to become indistinguishable from each other.
What are the implication of complexity?
-
We can not comprehend in isolation.
-
You have to understand it as a whole.
What does this mean for us?
-
Our capacity to comprehend complexity is finite and quite limited.
-
Statistically we do not vary that much.
-
We have to be able to analyse a system to change it.
-
Type checking and automated test are not enough.
-
Ignoring complexity is not an option.
-
Essential complexity, complexity that is part of the problem you are solving.
-
Accidental complexity, complexity introduced via the tools and constructs we use.
The aim is to minimize accidental complexity.
How do we introduce complexity?
Braiding
-
Multiple concerns in a single component.
-
Tightly bonding concerns.
Complex constructs
-
State, conflates value and time.
-
Objects, conflates idenity and value.
-
Syntax, conflates meaning and order.
-
Inheritance, conflates types.
-
Variables, conflates value and time.
-
Actors, conflates what and who.
-
ORM, Oh my giddy aunt.
-
Conditionals conflate rules and program organisation.
How do we make things simple?
Chose simple constructs.
They allow you to focus on what the software is supposed to do rather than how to do it.
Examples of simple constructs:
- Values.
- Persistent collection.
- Standard data strcutures.
- Pure functions.
- Declarative data manipulation.
- Consistency ( transactions and values )
Abstraction: ( write simple stuff )
-
Abstraction means to draw things away, to draw away from the physical nature of something.
-
It is not hiding stuff.