← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
← Back to glossary

KISS Principle

Code Quality PHP 5.0+ Beginner
debt(d7/e5/b7/t5)
d7 Detectability Operational debt — how invisible misuse is to your safety net

Closest to 'only careful code review or runtime testing' (d7). The detection_hints state automated detection is 'no' and the tool listed (phpstan) cannot reliably flag over-engineering or unnecessary abstraction — it catches type and static errors, not design violations. Identifying KISS violations requires human judgment in code review; the pattern (factory factory factories, excessive abstraction layers) is invisible to most automated tooling.

e5 Effort Remediation debt — work required to fix once spotted

Closest to 'touches multiple files / significant refactor in one component' (e5). The quick_fix frames it as a reflective question rather than a mechanical swap. Common mistakes involve accumulated abstraction layers (design patterns, extra indirection, over-engineered error handling) that, once in place, typically require refactoring across multiple related files or components to remove — not a one-liner, but not necessarily a full architectural rework.

b7 Burden Structural debt — long-term weight of choosing wrong

Closest to 'strong gravitational pull' (b7). KISS violations tend to be load-bearing: an over-engineered abstraction layer or unnecessary design pattern shapes every subsequent feature built on top of it. Because it applies across web, cli, and queue-worker contexts, the accumulated complexity tax affects many work streams. Every new contributor must navigate the unnecessary complexity, and removing it requires cross-cutting effort.

t5 Trap Cognitive debt — how counter-intuitive correct behaviour is

Closest to 'notable trap — a documented gotcha most devs eventually learn' (t5). The misconception field directly identifies the trap: developers frequently equate KISS with 'avoid all abstractions and patterns,' when KISS actually permits well-placed patterns that genuinely reduce complexity. This is a well-documented misreading that causes both under-engineering (stripping useful patterns) and over-engineering (misapplying 'best practices') — a real but learnable gotcha.

About DEBT scoring →

Also Known As

KISS Keep It Simple Stupid simplicity principle

TL;DR

Keep It Simple, Stupid — prefer the simplest solution that solves the problem over clever or complex abstractions.

Explanation

KISS (variously: Keep It Simple, Stupid; Keep It Short and Simple) advocates simplicity as a primary design goal. Unnecessary complexity is the root cause of many bugs and maintenance burdens — complex code is harder to understand, harder to test, and harder to change. KISS is not an argument against abstraction but against incidental complexity: solve the essential complexity of the problem without adding accidental complexity through clever patterns, premature optimisation, or speculative architecture.

Common Misconception

KISS means avoiding all abstractions and patterns. It means solving the actual problem without unnecessary complexity — a well-placed design pattern that genuinely simplifies future change is KISS-compliant; premature abstraction is not.

Why It Matters

Unnecessarily complex solutions are harder to understand, maintain, and debug — simplicity is a feature, and KISS forces the question: 'can this be solved more directly?'

Common Mistakes

  • Implementing a design pattern because it is a 'best practice' when a simple function or array would solve the problem.
  • Adding abstraction layers before there is evidence they are needed — YAGNI is KISS's sibling.
  • Over-engineering error handling: try/catch around every single line rather than at appropriate boundaries.
  • Mistaking familiarity with simplicity — a pattern you know well may still be overkill for the problem.

Avoid When

  • Using simplicity as an excuse to skip error handling, logging, or security controls — simple code still needs to be correct.
  • Conflating simple with familiar — a recursive solution may be simpler than an imperative one even if it looks less familiar.
  • Oversimplifying until the code no longer handles real edge cases — simplicity must not sacrifice correctness.

When To Use

  • When reviewing a solution that has grown complex — ask whether a simpler approach solves the same problem.
  • Architecture decisions — prefer the simplest design that meets the requirements, not the most flexible one imaginable.
  • Code review — flag unnecessary abstraction, premature generalisation, and clever tricks that obscure intent.
  • Teaching and onboarding — simple, readable code is self-documenting and lowers the learning curve.

Code Examples

💡 Note
Add abstraction layers only when there is a concrete, present reason — not a speculative one.
✗ Vulnerable
// Over-engineered: AbstractStrategyFactoryBuilderProvider
class UserSorterStrategyFactoryBuilderProvider {
    public function buildStrategyFactory(): UserSorterStrategyFactory { ... }
}
✓ Fixed
// KISS: just a function
function sortUsersByName(array $users): array {
    usort($users, fn($a, $b) => strcmp($a->name, $b->name));
    return $users;
}

Added 15 Mar 2026
Edited 25 Mar 2026
Views 58
Rate this term
No ratings yet
🤖 AI Guestbook educational data only
| |
Last 30 days
0 pings T 0 pings W 2 pings T 0 pings F 0 pings S 0 pings S 1 ping M 0 pings T 1 ping W 0 pings T 1 ping F 0 pings S 3 pings S 0 pings M 1 ping T 0 pings W 1 ping T 0 pings F 0 pings S 0 pings S 1 ping M 0 pings T 0 pings W 2 pings T 0 pings F 0 pings S 0 pings S 0 pings M 0 pings T 0 pings W
No pings yet today
No pings yesterday
Amazonbot 9 Scrapy 5 Google 4 Ahrefs 4 Perplexity 3 SEMrush 3 Majestic 2 Bing 2 ChatGPT 2 Unknown AI 1 Claude 1 Meta AI 1
crawler 34 crawler_json 3
DEV INTEL Tools & Severity
🔵 Info ⚙ Fix effort: Low
⚡ Quick Fix
Before adding abstraction, ask: does this complexity exist in the problem domain or did I create it? — if the latter, remove it
📦 Applies To
PHP 5.0+ web cli queue-worker
🔗 Prerequisites
🔍 Detection Hints
Multiple abstraction layers wrapping simple operations; factory factory factories; over-engineered simple CRUD
Auto-detectable: ✗ No phpstan
⚠ Related Problems
🤖 AI Agent
Confidence: Low False Positives: High ✗ Manual fix Fix: High Context: File Tests: Update


✓ schema.org compliant