⇦ All Posts

Coding Maxims

July 26, 2017

numbered for ease of reference, not for priority

  1. code is debt (and bad code is an unhedged call option (a))
    • cant have 0-days or bugs if I dont write any code
    • our users dont care about the code
    • every line of code has costs (your time, readability, maintainability, complexity)
    • its like owning a house with lots of rooms. its nice when your friends come over once a month, but you pay rent every day
    • dont add features unless you’re sure it is necessary

  3. keep it simple (a) (especially at first)

  4. be consistent

  5. be predictable (aka no magic)

  6. no magic numbers/strings — use constants instead

  7. a good repro is 90% of a bugfix

  8. code is written once, but is read many times

  9. ship early, ship often

  10. first code, then ship, then measure, then optimize

  11. remember the 80/20 rule, and the 90/90 rule

  12. design layers of abstraction with deep modules (a)

  13. write tests. not too many. mostly integration. (a)

  14. comments should describe what’s not obvious (a). i used to hate comments but this book (a) changed my mind.

  15. first you don’t know the rules, then you learn the rules, then you break the rules

See also: programming principles, hacker laws (a), Dieter Rams’ principles (a), the Zen of python (a), Urbit precepts (a)

Originally posted here