Cohesion, coupling, and SOLID in review
Where Part 1 comes together. Fills in the open-closed, Liskov substitution, and interface segregation principles, then revisits everything so far through cohesion and coupling.
Where Part 1 comes together. Fills in the open-closed, Liskov substitution, and interface segregation principles, then revisits everything so far through cohesion and coupling.
Covers how automatic resolution works in the Laravel service container, how bind ties an interface to an implementation class, and how contextual binding switches the implementation per injection site.
Covers the danger of public properties, the tell-don't-ask principle, and how to decide whether you need getters and setters.
Covers checking the shape of a request with a Form Request, and fail-fast design with custom exception classes.
Covers is-a and has-a relationships, and why composition is preferred over inheritance.
Covers designing against contracts with interfaces, and the idea behind the dependency inversion principle.
The introduction to Part 2. Pins down what Fat Controller and Fat Model mean, and states the scope of this part (class design only).
Chapter 1 of the PHP Class Design Guide. Through real examples of god classes and code that resists change, it shows what class design is for and lays out the shape of the whole series.
A 14-chapter guide that takes class design in PHP from first principles to practice. It runs from framework-independent design principles (encapsulation, single responsibility, inheritance versus composition, interfaces, SOLID) through to model and service class design in Laravel.
The basic syntax of classes in PHP. Covers properties, methods, constructors, visibility modifiers, readonly, constructor promotion, and enum.
Refactors the Fat Controller and Fat Model from chapter 8 end to end, using the criteria from chapters 9 to 12. The practical chapter that puts every Part 1 principle to work.
Sets out the responsibilities an Eloquent model should carry (relationships, accessors and mutators, casts, local scopes) against the ones it should not, contrasted with the Fat Model.
How to decide when to extract the processing left in a controller that coordinates several concerns into a service class. Also covers keeping cohesion so the split does not end up as a mere file split.
Gathers the criteria from all 13 chapters into a checklist you can use when facing real code. Also points to what to read next.
The single responsibility principle and the idea of keeping classes small. Covers the signs of a god class and a worked example of splitting responsibilities.