Memento code comments

Posted on 2010/01/25

0


Code comments are equal to flossing: you need to floss regularly or else… But how should a developer approach writing comments? As a personal technique I associate code comments with memento.

What does memento mean?

  • Memento is the Latin imperative “Remember!”
  • A memento is an object that serves the purpose to let us not forget something important.
  • Memento is a famous movie where the protagonist suffers from memory loss.

How are these concepts associated with code comments?

  • As an imperative on myself: “Remember to comment your code!”
  • The reason for commenting code: to lower the possibility to forget something; something that might be overlooked and lead to bugs.
  • A guideline on how to write them: comment your code as if you have no long-term memory. Sometimes I say “this is easy to remember!” and then I forget it the next hour/day/month, because I had hundreds of other small things to remember that pushed away the first ones.
Posted in: Software, Working