I’ve always been a big fan of making simple systems that can express complex things. Most people tend to make complex systems for complex things, but I think that’s it’s a mistake.
The problem with complex systems is that they generally require perfect foresight to properly encode everything that you need. The problem with perfect foresight is that it’s either impossible or expensive (or both). You can make complex systems easily — it’s the simple ones that tend to be harder.
So, what do I mean with emergent complexity anyway?
It’s when you have a set of very simple building blocks, like Legos, that you can piece together in novel ways to express complex ideas.
Take configuration, for instance. You can have a system that for every possible input case you define the outputs. Easy, but complex from a data size and validation perspective.
You can do something simple like just key-value pairs which are simple, but aren’t very flexible.
All you need to do is be able to express conditionals that can operate on things that have been set before and you have something that can start to express something interesting.
Each step can modify the result of the previous step leading to a complex path of evaluation that’s specified in a few steps.
So, let’s say you’re building a web site.
- First time vistors get a special experience (maybe a welcome toast or something)
- …unless you’re mobile, in which case you get the mobile experience
- If you’re from Germany, you get the German site regardless of mobile or not — but you get the toast
- If you’re on a product page, do something special if it’s the first time
So you can have something like:
if first time: set first time, show toast
if product page: special offer (configured from page) instead of toast.
if Germany: show german site
else if mobile: set mobile flag, don’t show toast
This is an overly simple example, but I hope it kind of shows what might be possible. You can encode this in a number ways, but the key is that as you add different conditions and mix them in different ways, you can get a lot of complexity that’s easy to express and validate. Then maybe mix in some page-controlled configuration and you have a lot of complexity without a lot of code. More importantly, all of the configuration is in data and can be examined at once instead of a diffuse set of code that’s spread throughout the system.