Archive for August 22nd, 2011

Many years ago, I started collecting maxims about program design that – in my opinion – reflect the essence of what good programming should be. You could say that I wanted to capture “programming meta-standards”, that can be applied to programming regardless of the programming language, runtime or operating system you are using. Christopher Diggins had tha same idea, and his list of “Principles of Good Programming”┬áis virtually identical to mine – now I don’t have to publish it myself ;-)

Oh, you want to know what was different in my list? I did not have the “Principle of least astonishment“; that must have seemed too obvious to me. And instead of “Write Code for the Maintainer” I have the very similar “The best comment is the code itself” (aka.”The best comment is no comment“). Using sound algorithms and good names for constants, functions, methods, variables, etc. you (almost) don’t need explicit comments, and that is a good thing because the maintainance of code is hard enough without having to to maintain the comments as well. Some developers apply the same principle to documentation, but that goes too far in my book.

As mentioned in a comment on the original version of Christophers blog post, there is a nice Clean Code Cheat Sheet that may help as well – it also lists a fine collection of “code smells”, i.e. indicators of bad code…

Read Full Post »