Cognitive load

Inspired by an amazing talk by Julia Evans, I will record tools I use to reduce my cognitive load on this page! My favorites will be marked with a ⭐!

Python

I write a lot of Python, and I find these tools reduce my cognitive load and in many cases, also reduce the amount of typing I have to do, which is good for my health.

  • Black: Instead of worrying about formatting, which I can be very picky about, I focus on the problem I’m trying to solve and let Black format for me. In contrast with tools I used previously for this purpose (e.g. Flake8), Black doesn’t just check my formatting, it fixes it. Black is also opinionated, which reduces bikeshedding about formatting on my teams.
  • Ruff: A Python linter written in Rust. Ruff has many new linting rules and has also adopted rules from pre-existing tools. Ruff can also auto-fix a significant portion of rule violations. I need to spend less thought on setting up rules and finding new linters and plugins, and I need to fix fewer problems by hand because Ruff does it for me. In combination with pre-commit and Black, I feel like I’ve reached an almost perfect state in which I’m not distracted by my tools and can focus purely on solving problems while my tools do magical things like upgrade my code to use new features in new Python releases.
  • Python type annotations & checker: While Python is known to be easy to read, it’s possible to write hard-to-read Python. One way is by naming variables ambiguously and passing those variables through a deep stack of function calls. To debug an inner function’s behavior, I have to debug or climb my way up the stack to reason about what’s being passed in. Type annotations enable verifiable self-documentation, so I don’t have to investigate to understand what kind of data I’m working with.

JavaScript

I don’t write JavaScript that often, but when I do:

  • TypeScript: I find JavaScript code requires a lot of cognitive load to read, but with the addition of typing, I find it’s both easier to read and write clean JavaScript. I will always write TypeScript over JavaScript.
  • ESLint: I use this for the same reason I use Ruff.

Bash

I used to write a lot more Bash than I do now, so I’ve forgotten a lot of the Bash trivia I used to have memorized. Thankfully, I have tools to help me 🤓

  • Shellcheck: As mentioned in Julia’s talk, Shellcheck knows most of Bash’s “gotchas” and frees you to worry about your problems instead of Bash’s problems.