I am the author and maintainer of ModelsBuilder, an essential tool for the Umbraco CMS. If you use it regularly, or any of my other Open Source tools, you may want to consider my GitHub Sponsorship Program and help ensure that the tools you depend on are maintained in a sustainable way. Thanks!

Code Quality Digression

Posted on May 1, 2015 in life

After years of coding in various languages and on various systems, I am now pretty certain of it: my code leaves a lot to be desired.

Oh, I sure wish it had the pure beauty of academic LISP s-expressions, the elegant simplicity of a clever assembly loop, the scientific perfection of lambda calculus when, back at school, we proved that a fragment of code would work.

But let us be honest: it really is some sort of beginner BASIC mixed with a few object-oriented patterns, jotted down in an editor and oh please tell me it works. Of course, I cannot get rid of the delusion that, given enough time, I would evidently be able to produce code that would survive a typical Ayende review. Alas, there is no time, but time to ship—and so it ships, poor little crippled thing.

And in the end, it is not that unique piece of pure jewelry I wish it would be, but only one more drop in the neverending code flow, bound to get lost in time, like tears in the rain.

And why bother, then? PHP FTW!

Unless... someday, someone might have to read that code. We leave a legacy behind us, and I pride myself in believing that there is a responsible way to fail. I code with one goal in mind: to make it as painless as possible for the next coder, who will have to fix the mess I am creating.

Should someone review my code, I would like them to write statements such as "here and here, he is doing this and that, which is soooo wrong for this and that reason, and here is how the code should be refactored". Instead of just throwing the whole thing away in disgust, or committing suicide.

It would mean that they have been able to understand, to recognize that decisions were made, that at least there was an underlying concept or a general idea, and not just uncontrolled random threads of spaghettis. That my code would be worth being improved.

Next week, we will talk about the meaning of life. Actually, no. It is all the same.

comments powered by Disqus