Tag: clean-code
Extract Class Refactoring
Extract Class splits a large class into two — moving a cohesive subset of fields and methods into a new class that the original delegates to.
2mo ago
quality intermediate
Reducing Cyclomatic Complexity Techniques
Cyclomatic complexity counts independent code paths — reduce it by early returns, extracting conditions to named functions, using lookup tables, and replacing switch/if chains with polymorphism.
2mo ago
quality intermediate
Refactoring Boolean Flag Parameters
Boolean flags as function parameters obscure intent — replace with enums, separate functions, or named options objects for self-documenting APIs.
2mo ago
quality intermediate
Cognitive Load in Code Design
The mental effort required to understand code — good design minimises extraneous cognitive load so developers can focus on the problem, not the code structure.
2mo ago
general intermediate
Named Constructor Pattern PHP 5.0+
Static factory methods with descriptive names that replace overloaded constructors — making object creation intent clear when multiple creation paths exist.
2mo ago
php intermediate