Recently I saw a humorous guide on GitHub titled, How To Write Unmaintainable Code. GitHub is primarily a repository for open source software, and therefore serves as a bastion for programmer humor. The author of the guide is claiming to be “passing on these tips from the masters on how to write code that is so difficult to maintain, that the people who come after you will take years to make even the simplest changes” so you can “Ensure a job for life”. While the guide is geared towards Java programming, most of the “tips and tricks” apply to all realms of coding. As an integrator the maintainability of the code is equally as important as functionality, so several of the points (listed below) particularly resonated with me.
A.C.R.O.N.Y.M.S. – “Use acronyms to keep the code terse. Real men never define acronyms; they understand them genetically.”
Code Names Must Not Match Screen Names – “Choose your variable names to have absolutely no relation to the labels used when such variables are displayed on the screen. E.g. on the screen label the field “Postal Code” but in the code call the associated variable “zip”.”
Lie in the comments – “You don’t have to actively lie, just fail to keep comments as up to date with the code.”
Long Lines – “Try to pack as much as possible into a single line.”
Testing is for cowards – “A brave coder will bypass that step.” “If we have full confidence in our coding ability, then testing will be unnecessary.”
Although the full guide is a long read, I highly recommend at least giving it a browse. What are some things you’ve seen that make code horrendously unmaintainable?
Image Source: Freepik