Blogs

Clean Clear Correct Code

November 22, 2018

One of my favorite questions to ask during a job interview for a software developer position is, “What order of importance would Clean, Clear, and Correct code be and why?”. I feel this question indicates if they have thought about the importance of each and gives a sense of project life cycle experience. Clean code means the code is more easily maintainable and portable. Clear code means the code is more easily readable and understandable. Correct code means the code is reliable and traceable to requirements.

Most interviewees order them as Correct, Clear, and Clean. While others order them as Clear, Correct, and Clean. Clean seems to always be last. The usual reason for placing Correct first is “if the code doesn’t work then nothing else matters.” The usual answer for placing Clear first is “if it’s more readable, then it will be easier to debug.” However, not many have explained why Clean is last.

The great thing about this question is that the order doesn’t have much importance; it is the reasoning behind the order that interests me. We all have different experiences during our development career that make us order these differently. The order may also change over a project’s life cycle. For example, as requirements change, Clear code may become most important because the code is no longer Correct. When a new product is introduced, Clean code may become most important for code reuse. And if the code is auto generated, then being Correct might be all that matters.

Nobody has yet to answer “your question is misleading because they are all equally important and the order can change depending on the current project’s status and needs”. Luckily, I ask this question towards the end of the interview because if I ever got that answer, I’d be so shocked that I’d have to go home early. How would you order Clean, Clear, and Correct code and why? 

Leave a Reply

Your email address will not be published.