Search code examples
code-readability

Is Code For Computers or for People?


Ultimately, code compiles down (eventually) into instructions for a CPU. Code, however, (in my humble opinion) is for human beings to read, update, and interact with. This leads me to the following observation:

Code that is unreadable by other engineers, even if it's functional, is bad code.

With that in mind, what can this programmer do to make code more easily read by humans?

  • Naming Conventions? (Joel has a fair amount to say on that one)

  • Code Structure/Layout? (please, for the love of god, don't get into the { placement debate)

  • Phrasing? (Is it possible to write code that looks more like the English language)

Are there good articles out there beyond Joel's.


Solution

  • “Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” -- Martin Fowler, "Refactoring: Improving the Design of Existing Code"

    But since you've already reached that conclusion on your own, suffice to say that this is a huge topic. It's not something you'll be able to get a single answer on. Making your code maintainable is not limited to coding style, but also involves your overall design as well as your construction process. Here's some tags on this site where pretty much all the questions and answers will impinge on this topic: