Learn to write better code with JMAC
summary
Ten concrete refactors: enforce PSR-2 formatting with PHP_CodeSniffer or StyleCI; remove commented and unreachable code via PHP Mess Detector or PhpStorm inspections; collapse nested conditionals into guard clauses and early returns; replace primitive clumps with value objects (Money, Range) and small enums/bitwise flags; break large controller methods into Form Requests, named constructors and model methods; prefer reasonable empty returns (empty arrays or Guest objects); follow the rule of three; aim for symmetry in names and CRUD signatures.
AI-written summary · about
chapters (16)
- 0:00Introduction
- 0:23Bad code and over engineering
- 3:31Coding with empathy
- 5:16Ten practices for better code
- 5:37Practice 1: Formatting
- 9:08Practice 2: Dead code
- 13:41Practice 3: Nested code
- 18:36Practice 4: Using objects
- 23:56Practice 5: Big blocks
- 30:26Practice 6: Naming
- 34:42Practice 7: Removing comments
- 41:44Practice 8: Reasonable returns
- 45:18Practice 9: Rule of three
- 47:44Practice 10: Symmetry
- 54:38Summary of practices
- 55:21Q&A
