Dumb Code

2024-01-08


I write dumb code. I never learned Object Oriented theory, I never learned monads in Functional Programming, I never read "Clean Code". Don't get me wrong, I had plenty of opportunities to do those things, but I never felt like I needed to for my own interests or my career. Professionally I read/write mostly Erlang, which despite being labeled as functional, is more about pattern matching and concurrency than monads and currying. I've briefly seen the builder and factory patterns but I couldn't explain them to you. I sometimes write long (>100 line) functions or scripts. I write dumb code.

I write dumb code because I subscribe to a few of beliefs:

  1. That code is not only positive output, but a future liability of tech debt.
  2. That my code is better simple, shipped now, and refactored later then clever, late, and prematurely optimized.
  3. That I get paid to solve business needs not write code.

I do love software. Writing code is one of the best ways to get into a flow state and be productive, but professionally it's just a means to the business / product ends. Because code I write I know I won't maintain forever, I try to make it simple to read and write, and once the first draft is written I'll decide if it needs a refactor now or later to make it more readable. I rarely write code to be "extensibe" outside of the known requirements of the current project, because it's more efficient to refactor it in the future once the future requirements are known.

Dumb code can require less brainpower to read. For example when working with Hack (Meta's PHP), I sometimes Cmd+Click on a method name to jump to the implementation, but that brings me to the definition of the interface, so then I have to find the implementation of that interface to read the actual business logic. In another example, sometimes people write and compose extremely small functions, even one liners, so to understand the busniess logic of a file, you might have to scroll back and forth all over the file to follow the control flow between a bunch of different function calls. When I write dumb code the goal is to require very little brainpower to read. It should read top to bottom, and it should use minimal fluff that isn't the business logic.