Monday, November 10, 2014

Why your code is so hard to understand

“What the hell was I thinking?!?”

It’s 1:30AM and I am staring at a piece of code I wrote no more than a month ago. At the time it seemed like a work of art. It all made sense. It was elegant and simple and amazing. Not anymore. I have a deadline tomorrow and discovered a bug a few hours ago. What seemed simple and logical at the time just doesn’t make sense anymore. Surely if I wrote the code I should be smart enough to understand it?

After one too many experiences like this I started thinking seriously about why my code makes perfect sense while I am writing it but looks like gibberish when I go back to it a few weeks or months later.

  1. Overly complex mental models
  2. Poor translation of semantic models into code
  3. Not enough chunking
  4. Obscured usage
  5. No clear path between the models
  6. Inventing Algorithms
Read more here

Leave a Reply

All Tech News IN © 2011 & Main Blogger .