Posted on Sun 04 July 2021

Complexity Budget

No matter how smart, there's a limit to how much you can keep in mind at once before you start forgetting something. In the context of software engineering, a common term for this is complexity budget: the maximum complexity of a system you can understand at once.

Just as fitting an entire task into the cache of your CPU is orders of magnitude faster than paging in from RAM (or worse, disk!), fitting the entire problem you are working on into your brain can make you many times more productive.

Every line of code you write, every feature you add to your system counts against this budget - proportional to the set of all interactions you need to consider to ensure correctness and performance.

Neither the cost nor the budget are fixed, both are under you control:

  • reduce the cost per line by outsourcing correctness checking to a tool: unit testing, static typing
  • reduce the number of lines by using a more concise language
  • use battle-tested libraries instead of reinventing the wheel
  • avoid incidental complexity, choose the simplest design that solves your actual problem
  • improve your mental capacity - get sufficient sleep, work out to improve your fitness, fix stressors in your life
  • increase your familiarity with the languages, libraries and tools you are using

A sure indication of an effective engineer is being able build to build the same system at a lower complexity cost.

Tags: programming, engineering

© Julian Schrittwieser. Built using Pelican. Theme by Giulio Fidente on github. .