How to Write Unmaintainable Code

DZone 's Guide to

How to Write Unmaintainable Code

"Testing is for Cowards" and other great advice on how to make sure your code will be impossible to manage.

· Agile Zone ·
Free Resource

A little over ten years ago, I came across a gem of an essay, called, "Unmaintainable Code".

A tongue-in-cheek look at what are essentially anti-patterns, or, "what not to do", the essay is full of great insight as well as non-stop laughs.  The essay is meant for developers of all skill levels; however, the more years you have in the industry, the more of the points made will ring true as well as be even funnier.

Image title

(Courtesy: frinkiac.com)

Included in the essay are examples of the anti-patterns themselves which really help drive the author's point home.

Still not convinced?  To give you a sense of what the essay has in store, here are a couple of excerpts from my favorite section:

"Testing is for Cowards"

A brave coder will bypass that step. Too many programmers are afraid of their boss, afraid of losing their job, afraid of customer hate mail and afraid of being sued. This fear paralyzes action and reduces productivity. Studies have shown that eliminating the test phase means that managers can set ship dates well in advance, an obvious aid in the planning process. With fear gone, innovation and experimentation can blossom. The role of the programmer is to produce code and debugging can be done by a cooperative effort on the part of the help desk and the legacy maintenance group.

If we have full confidence in our coding ability, then testing will be unnecessary. If we look at this logically, then any fool can recognise that testing does not even attempt to solve a technical problem, rather, this is a problem of emotional confidence. A more efficient solution to this lack of confidence issue is to eliminate testing completely and send our programmers to self-esteem courses. After all, if we choose to do testing, then we have to test every program change, but we only need to send the programmers to one course on building self-esteem. The cost benefit is as amazing as it is obvious."

If you can make it all the way through that passage without both recognizing someone who is guilty of the sin mentioned as well as not falling out of your chair laughing, you are a better person than I am.

Here is another excellent excerpt with an example to help underscore this particular anti-pattern:

"Accented Letters"

Use accented characters on variable names, e. g.:

typedef struct { int i; } ínt;

Where the second ínt’s í is actually i-acute. With only a simple text editor, it’s nearly impossible to distinguish the slant of the accent mark."

I wholly encourage any and all developers to read through the entire piece.  Yes, it is a bit of a long read, but it is most definitely worth your time.  After all, we could all use a refresher in what not to do, and what to look for, so why not have a laugh or two while (not?) doing it?

anti pattern, essay, humor

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}