← Home ← Codex ← DEBT
Browse by Category
+ added · updated 7d
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Law of Demeter — PHP Examples
The Law of Demeter (don't talk to strangers) limits method chains — each unit should call only its direct collaborators, not traverse object graphs.
3mo ago quality intermediate
Liskov Substitution Principle
Subtypes must be substitutable for their base types without altering the correctness of the program.
3mo ago quality intermediate
Maintainability Index 🧠 3
A composite metric (0–100) combining Halstead volume, cyclomatic complexity, and lines of code to estimate how easy code is to maintain.
3mo ago quality intermediate
Mediator Pattern PHP 5.0+
Centralises complex communications between multiple objects into a single mediator object, reducing direct dependencies between colleagues.
3mo ago quality intermediate
Message Chains
A long chain of method calls ($a->getB()->getC()->getD()) that tightly couples code to the internal structure of multiple objects.
3mo ago quality intermediate
Middle Man
A class that does little more than delegate every method to another object — an unnecessary layer of indirection.
3mo ago quality intermediate
Null Object Pattern PHP 5.0+
Replace null with an object that implements the expected interface but performs no operation, eliminating null checks throughout the codebase.
3mo ago quality intermediate
Null Safety — Null Object vs Optional PHP 7.1+
Strategies for eliminating null reference errors: the Null Object Pattern provides a safe default; Optional-style wrapping makes nullability explicit.
3mo ago quality intermediate
Open/Closed Principle PHP 5.0+
Classes should be open for extension but closed for modification — add behaviour without changing existing code.
3mo ago quality intermediate
Parallel Inheritance Hierarchies
Every time you create a subclass of one class, you must also create a corresponding subclass of another — a sign of entangled designs.
3mo ago quality intermediate
Primitive Obsession PHP 5.0+ 🧠 1
Using raw strings, ints, and arrays to represent domain concepts instead of small dedicated value objects.
3mo ago quality intermediate
Proxy Pattern PHP 5.0+
Provides a surrogate object that controls access to another object, adding indirection for lazy loading, caching, logging, or access control.
3mo ago quality intermediate
Pure Function
A function whose output depends only on its inputs and that produces no side effects — maximally testable and predictable.
3mo ago quality intermediate
Refused Bequest
A subclass that inherits methods it doesn't need or want, signalling a misused inheritance relationship.
3mo ago quality intermediate
Shotgun Surgery
A single change requires making many small edits across many different classes — a sign of poor cohesion.
3mo ago quality intermediate
Side Effects
Observable changes a function makes beyond returning a value — modifying global state, I/O, mutation of arguments — that make code harder to reason about.
3mo ago quality intermediate
Speculative Generality
Unused abstractions, parameters, or hooks added for hypothetical future use that complicate the codebase without present value.
3mo ago quality intermediate
State Pattern PHP 5.0+
Encapsulates the varying behaviour of an object based on its internal state into separate state objects, eliminating state-based conditionals.
3mo ago quality intermediate
Diagram: Strangler Fig Pattern Strangler Fig Pattern PHP 5.0+
Incrementally replace a legacy system by routing new requests to a new implementation while the old system handles the rest.
3mo ago quality intermediate
Switch Statement Smell
Repeated switch/if-elseif chains on the same type indicator signal a missing polymorphic design.
3mo ago quality intermediate
✓ schema.org compliant