Skip to main content

Quality

So what is code of high quality? In the beginning I said that I won’t give you a definition of what “quality code” is, and instead try to paint an image in your head by giving many examples, techniques, ideas, guidelines. Now that we're at the end of the book and you’ve taken all this in, I think you’re in a position to read a succinct definition of “quality code” and actually know with precision what I mean by it.

To any task that is to be accomplished through code, there’s some “essential” complexity. It’s usually reasonably straight forward. There’s also some “unavoidable” complexity brought about by the fact that the languages and frameworks don’t perfectly match the problem domain. So, to me, “quality code” is

code written in such a way that the only type of complexity that is evident to the reader is essential and unavoidable, i.e. there is no incidental complexity.

The programmer’s job is, then,

to write code with no incidental complexity that solves the problem correctly.

Comments