In this video, we will see what SOLID principles are. As usual, we will approach it in a 100% practical way. Applying a refactoring on existing code to avoid violating the Single Responsibility Principle (or SRP). We will also see how this is related to the Interface Segregation Principle (or ISP). In previous videos, we already saw how to set up our PSR-4 namespaces structure and start using Composer's autoloader and how to apply the PSR-2 coding style standard. Now it's time to roll up our sleeves and dive into deeper topics like SOLID principles.
Video Index
- 0:29 - What are SOLID principles
- 1:28 - Context: What the code to be refactored does
- 5:12 - Violation of the Single Responsibility Principle - SRP
- 7:07 - Issues when violating SRP
- 9:57 - Refactoring the registerNewUser method
Refactoring respecting the SOLID Principle of Single Responsibility - 17:41 - Violation of the Interface Segregation Principle - ISP
Violation of the SOLID principle of Interface Segregation
Video
Related material
- Don't Create Objects That End With -ER: Article theorizing on why not to create classes like "Manager", "Processor", etc.
- Extract Class Refactoring: Extract Class refactoring process.
- Parallel Change Refactoring: Explanation of what it is and how to carry out the Parallel Change refactoring technique.
- SOLID: Part 1 - The Single Responsibility Principle: Series of Tuts+ tutorials on SOLID.
- Domain-Driven Design: Code Structure and Application Services: Video on Application Services and layer separation.
Upcoming videos
- SOLID - Dependency Inversion Principle (Intermediate)
- Interview!
- DTOs / Anemic Domain Models vs Domain Models (Intermediate)
- Composition over Inheritance - A turning point (Intermediate)