You know what they say about sharp-dressed code. Every dev’s crazy about it… More seriously, developers often fail to notice well-written code, but easily recognize and curse poorly written code. Still, some of the greatest minds in our field have a great passion for well-written code (quotes below). Code clarity directly contributes to understandability, maintenance, quality, and more. Here I’ll discuss practical ways to write clean and maintainable code.
“…the incompletenesses and inconsistencies of our ideas become clear only during implementation.” – Fred Brooks (Mythical Man-Month) “It is widely accepted that creative design is not a matter of first fixing the problem and then searching for a satisfactory solution concept; instead it seems more to be a matter of developing and refining together both the formulation of the problem and ideas for its solution, with constant iteration of analysis, synthesis, and evaluation process between the two “spaces” – problem and solution.” - Nigel Cross and Kees Dorst
“Tools amplify your talent. The better your tools, and the better you know how to use them, the more productive you can be.” – Andrew Hunt (The Pragmatic Programmer)
“Coding ain’t done ‘til the tests run” - The Pragmatic Programmer “The act of writing a unit test closes a remarkable number of feedback loops, the least of which is the one pertaining to verification of the function” – Robert Martin
“.. the high-level language embodies the constructs wanted in the abstract program and avoids all the lower ones, it eliminates a whole level of complexity that was never inherent in the program at all” – Fred Brooks, No Silver Bullet
“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare
There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors. - Phil Karlton Who do we write code for? This question is not often not considered, and so the answer is usually nobody. Thus, nobody is who understands the code.
“Finding the defect – and understanding it – is usually 90% of the work” - Steve McConnell