Fundamentals 14 min read

How to Write Code Nobody Can Maintain – A Satirical Anti‑Pattern Guide

This satirical guide enumerates absurd techniques—from confusing naming conventions and deceptive comments to overloaded functions and excessive nesting—that deliberately make code hard to read, test, and maintain, offering a tongue‑in‑cheek look at worst‑case software engineering practices.

Programmer DD
Programmer DD
Programmer DD
How to Write Code Nobody Can Maintain – A Satirical Anti‑Pattern Guide

1. Naming

Easy‑to‑type variable names . e.g., Fred, asdf

Single‑letter names . e.g., a, b, c, x, y, z (or a1, a2…)

Creative misspellings . e.g., SetPintleOpening, SetPintalClosing

Abstract names . e.g., ProcessData, DoIt, GetData

Acronyms . e.g., WTF, RTFSC, BT, TMD, TJJTDS

Random capitalisation . e.g., gEtnuMbER

Reuse names . Using the same variable name in nested blocks

Accent letters . e.g., int ínt

Underscores . e.g., _, __, ___

Mix languages . e.g., English, German, Chinese pinyin

Symbolic names . e.g., slash, asterix, comma

Irrelevant words . e.g., god, superman, iloveu

Confuse l and 1 . l vs. 1

2. Disguised Deception

Interleave comments and code .

for(j=0; j<array_len; j+=8){
    total += array[j+0];
    total += array[j+1];
    total += array[j+2]; /* Main body of
      total += array[j+3]; * loop is unrolled
      total += array[j+4]; * for greater speed.
      total += array[j+5]; */
    total += array[j+6];
    total += array[j+7];
}

Code/display mismatch . UI says “postal code” but code uses “zipcode”.

Hide globals . Pass globals as function parameters to disguise them.

Similar variable names . swimmer vs. swimner, ilI1|, oO08, parselnt vs. parseInt, D0Calc vs. DOCalc, xy_Z, xy__z, _xy_z, _xyz, XY_Z, xY_z, Xy_z.

Function overload with unrelated behavior .

Operator overload abuse . Overload ! to return an integer, then apply !!, !!!, etc.

3. Documentation and Comments

Lie in comments . Never update comments after code changes.

Write nonsense in comments . e.g., /* add 1 to i */

Comment what, not why .

Avoid documenting secrets . Never mention hidden complexities in docs.

Over‑detail . Write exhaustive design docs with hundreds of sections and pages.

Never comment traps .

Vent frustrations in comments .

4. Design Practices

Java casts . Overuse type casting from collections.

Exploit Java redundancy . e.g., Bubblegum b = new Bubblegom();

Never validate input or return values .

Don’t encapsulate . Expose all details to callers.

Copy‑paste cloning . Rely on copy‑paste instead of understanding code.

Massive listeners . One listener handling all button logic.

Higher‑dimensional arrays . Use 3‑D or even 4‑D arrays unnecessarily.

Mix getters/setters with public fields .

Deep wrapper layers . Wrap APIs 6‑8 times, 4+ layers deep.

Make everything public . No access restriction.

Swap parameter order . e.g., drawRectangle(height,width) → drawRectangle(width,height) → revert later.

Rename methods inconsistently . setAlignment → setLeftAlignment, setRightAlignment, etc.

Keep dead code . Preserve unused variables, methods, and classes.

Seal subclasses . Declare all child classes final.

Avoid layout managers . Hard‑code absolute coordinates or GridBagLayout.

Misuse environment variables . Initialise class members from env vars instead of constructors.

Global variables everywhere . Initialise globals in unrelated functions and pass them implicitly.

Configuration file name mismatch . Parameter names in config differ from code.

Inflate classes . Provide methods for every possible scenario even if unused.

Deep inheritance hierarchies . Ten levels of inheritance, each in separate files.

XML bloat . Replace short code with massive XML.

Decompose conditions . a==100 → a>99 && a<101

Semicolon tricks . if (a); else; { int d; d=c; }

Indirect casting . new Double(d).toString() instead of Double.toString(d)

Excessive nesting . >10 parentheses levels or >20 nested blocks.

Long lines . Write extremely long statements.

Avoid early returns . Use deep if‑else chains instead of break.

Omit braces . Write if‑else without {} and mis‑indent.

Trivial encapsulation . Wrap a bool in a class that does nothing.

Swap loops . Replace for‑loops with while, invert conditions, change step direction.

5. Testing

Never test . Skip all error‑handling tests and system‑call return checks.

Never do performance testing . Blame the user’s hardware if it’s slow.

Don’t write test cases . Avoid code‑coverage and automation.

View testing as cowardice . Claim brave programmers need no tests.

6. Other Tips

Obey the boss blindly . Follow any unreasonable directive.

Hide bugs from the help desk . Ignore user reports or blame the user.

Keep big bugs secret . Never disclose major issues.

Spin hype . Label terrible code with GoF patterns and agile buzzwords.

Source: http://mindprod.com/jgloss/unmain.html – Translator: 陈皓 (@左耳朵耗子)
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Software Engineeringmaintainabilityprogramming humorbad practicescode anti-patterns
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.