I'm Brett Slatkin and this is where I write about programming and related topics. You can contact me here or view my projects.

14 July 2012

How to write code effectively

  1. Decide on the single thing you care about the most and make it work
  2. Write a test for that important case
  3. Sketch out many other tests for cases you think could be important
  4. Rewrite the code two or three times while filling in the tests
Crucially, if you don't do #3, you can never do #4 because you won't know if your rewrites will be correct. Tests are insurance against making mistakes. They take time, but they let you move faster ultimately because you can be more confident in taking risks, which is the whole point anyways.
© 2009-2024 Brett Slatkin