HeadlinesBriefing favicon HeadlinesBriefing.com

How to Write Unmaintainable Code: 1999 Java Programming Guide

Hacker News •
×

This 1999 essay by Roedy Green of Canadian Mind Products offers a satirical guide to writing code that's deliberately difficult to maintain. Originally published in 1997 and last updated in November 1999, the piece has been translated into Spanish and remains a cult classic among programmers. Green's tongue-in-cheek advice includes using vague variable names, avoiding comments, and creating unnecessary complexity.

The essay outlines general principles for confusing maintenance programmers, who Green imagines viewing code through a narrow tube. He suggests making code hard to navigate, hiding changes across multiple locations, and using cut-and-paste programming instead of reusable modules. The guide recommends lying in comments, using inconsistent naming conventions, and avoiding encapsulation to maximize confusion.

Specific techniques include using lower case L for long constants, creating variables that differ only in case, and reusing variable names across unrelated contexts. Green advises against automated code tidying, proper indentation, and meaningful variable names. The essay concludes with suggestions like never using local variables and liberally applying goto statements - all designed to ensure job security through impenetrable code that only the original author can maintain.