Beware Cognitive Load

Cognitive load is the amount of working memory your brain requires while solving a problem. The more complex a problem is, the heavier the cognitive load.

Today I was building a new feature for the engine that powers the exports of Arcade. Fueled by platform-specific configuration files, what started as a simple series of functions to generate file strings has grown to a complicated beast of code. The engine has become very difficult to operate in.

You know when your computer has a million programs open and everything is becoming really slow as your machine gets hotter and hotter? Yeah, that's pretty much my brain while building new features in the engine.

This is a warning sign. If something is so complicated that it's difficult to work on, then it's probably not written well. A heavy cognitive load is a red flag to be beware of in software; if it's hard for me to understand, it'll be impossible for other developers in the future.

Unfortunately, it's hard to imagine a better way to do it. It's not like I just hashed this thing together willy nilly. There was a lot of thought that went into the engine. It's one of the features that defines the power of Arcade. It has to be rigid with defined rules, yet be flexible enough to handle the needs of any format.

So, optimizing for cognitive load will be an investment. I need the engine to be easier to work on so I can make it better. This means I'll need to avoid creating cognitive debt. If I'm not simplifying, stop, and rethink.

Simplification through addition isn't easy. But it'll be worth it.