Fundamentals 6 min read

19 Counterintuitive Rules for Writing Deliberately Bad Code

This article presents a tongue‑in‑cheek guide of nineteen "anti‑best‑practice" rules sourced from a GitHub project, illustrating how to deliberately produce unreadable, unmaintainable code by minimizing typing, mixing naming styles, avoiding comments, and other absurd conventions.

ITPUB
ITPUB
ITPUB
19 Counterintuitive Rules for Writing Deliberately Bad Code

The GitHub repository https://github.com/trekhleb/state-of-the-art-shitcode contains a satirical list of "19 rules for state‑of‑the‑art shitcode". The rules are presented as deliberately bad practices; reading them in reverse helps developers recognize and avoid common pitfalls in real code.

Key Rules (selected examples)

Type as little as possible – minimize keystrokes, assuming less typing leaves more time for thinking.

Mix variable and function naming styles – combine camelCase, snake_case, etc., to create inconsistency.

Never write comments – rely on self‑explanatory code or assume nobody reads it.

Write comments in your native language – if your native language is English, you violate the rule by default.

Mix string quoting formats – use single and double quotes interchangeably when they have the same meaning.

Put everything on one line – chain related parameters and calls without line breaks.

Stay silent about errors – do not log or print tracebacks when exceptions occur.

Use global variables extensively – treat globals as essential for "globalization".

Create backup variables – keep spare variables ready for any situation.

Avoid explicit type handling – skip type annotations and checks, assuming "no type" is best.

Include unreachable "Plan B" code – add code that never runs as a fallback.

Apply the nested triangle rule – use triangular indentation for nested structures.

Mix indentation styles – combine tabs and spaces (note: this breaks Python).

Never lock dependencies – always upgrade to the latest third‑party libraries.

Prefer long functions over short ones – place all logic in a single large function, avoiding modular files.

Skip dedicated testing – treat tests as redundant work.

Ignore duplicate code concerns – write freely without worrying about repetition.

Omit README documentation for new projects – defer documentation.

Keep unnecessary code – comment out rather than delete test scaffolding.

Purpose

The list serves as a reverse checklist: by understanding these absurd practices, developers can better appreciate good software engineering principles such as consistent naming, proper commenting, modular design, explicit typing, error handling, dependency pinning, and thorough testing.

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 Engineeringcode qualityGitHubprogramming humorAnti-Patternscoding guidelines
ITPUB
Written by

ITPUB

Official ITPUB account sharing technical insights, community news, and exciting events.

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.