SOLID - Single Responsibility Principle SRP and Interface Segregation Principle ISP

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
    code of the RegisterNewUserUseCase class
    Refactoring respecting the SOLID Principle of Single Responsibility
  • 17:41 - Violation of the Interface Segregation Principle - ISP
    code of a DatabaseRepository interface with the methods getUser and insertUser
    Violation of the SOLID principle of Interface Segregation

Video

Related material

Upcoming videos

Pay according to your needs

lite (only monthly)

19 €
per month
  • Access to a subset of courses to lay the foundation for maintainable, scalable, and testable code
  • Company invoice
PopularLaunch Week

standard

20,75 €
Save 171
Annual payment of 249
per month
  • Full course catalog
  • Receive job offers verified by Codely
  • Company invoice
Launch Week

premium

37,42 €
Save 139
Annual payment of 449
per month
  • All previous benefits
  • Early access to new courses
  • Discount on workshops

We won't increase the price while your subscription is active