Out of the Tarpit
Yesterday Romeu Moura was our guest at DDDBE with an excellent session on complexity in software. His talk “Out of the Tarpit” is a dissection of the paper by Ben Mosely and Peter Marks, written in 2006.
If you’re interested in reading the paper, it’s important to know that the authors are using the term “simple” as the the opposite of “compound”.
Technical debt in software is always compound: it adds up complexity, leading to exponential growth of complexity. Therefore, it’s important to limit creation of complexity in a system.
Let’s have a look at the types of complexity in a system:
- Essential complexity: your domain (business logic)
- Accidental but mandatory complexity: the language, state
- Accidental but spurious complexity: everything else and should be avoided
A great example on how you can limit complexity is by protecting your system from an invalid state. By using Value Objects, the states in your system are reduced and therefore it reduces the complexity of your system.
Mutability is another source of complexity that we are almost blind for as an industry. We believe everything is mutable by nature but it’s actually the opposite.
No man ever steps in the same river twice, for it’s not the same river and he’s not the same man.
What else can we do to limit complexity?
- Separate the essential complexity from mandatory complexity. They have different reasons to change, a different lifetime,…
- Don’t optimize locally, think globally
- Describe the problem in your software, not the solution
- Use adapters by default :)
“Out of the Tarpit” proposes to separate Logic, Control and State. Romeu explained how one can achieve this with terms like Referential transparency, functional relational programming and partial function application which made my head explode :)
See you next time!