The Way of the Code Samurai

Wil Shipley has been programming for decades, like me. Recently, he reposted a link to an old post that I think all programmers should read. Go on, read it now. I’ll wait.

In it, he talks of the The Way of the Code Samurai, but really just points out the same topics I try to impress on all programmers I teach.

  • Think first
  • Write all your code “clean” the first time you write it
  • Less source code is better
  • Optimize only after you are done

The only thing missing from my top 5 is the temporal issue

  • There is no later, there is only now. Write only the code you need now, write it well. You will probably not need any of the stuff you imagine you may need later, so don’t write it now. In six months time, another programmer, probably you 6 months older, not you as of now, will come back to this code and thank you. If you added a pile of imagined stuff now, the future you will have more code to examine and more to unravel what was done by the old you, and curse you for it. I should know, I have been me six months later. And in six months time, I’ll be an even better programmer, or maybe I’ll just know more about what the product should be. Either way, I have no idea what my six-month future me will need. No use trying to guess.

Posted By Hilton Lipschitz · Nov 23, 2011 12:02 AM