Tuesday, March 17, 2009

What's in a name?

Like I mentioned previously, I'm reading the book "Clean Code" right now.  Great book.  There are lots of great tips on how to write clean code. There's a whole section dedicated to naming (and rightly so).  

Its easy to overlook how important it is to use care when naming classes, methods, variables, etc. Two of the tips seem like statements of the obvious, but I have found to be more valuable than one might guess:
  • Use Pronouncable Names
  • Use Searchable Names
Pronouncable names make it easy to discuss the code with other developers, which leads to better code (and a better understanding of the code by the development team).  Searchable names make it easy to find specific parts of the code that you may need to come back to at some later date.

These two simple items will make your life much easier over the long haul (since we all know that often the code we write lives much longer than we ever expected it to...).

No comments:

Post a Comment