Single Responsibility Principle – and why it matters

image found from reddit

This image is a perfect example why we need to adhere to SRP (Single Responsibility Principle).

Imagine how terrible would it be to have your elevator disabled due to a light switch that has tight coupling to the main functions of the elevator.

Examples like this are easy to understand because you know what exactly a lightbulb,what exactly an eleveator is and their differences/boundaries but when it comes to coding information systems (like a procurement system and a disbursement system) things get muddy because we dont know what they are, how they work and what their differences/boundaries are. Information Systems are often abstract to programmers until they spend long enough time in the domain.

My advice to circumvent that is to read business books and work closely with business people until you understand how the yout system works. be continued

Other Sources you can read

PHP OOP from ZERO – few concepts/theories, mostly syntax just to get you started

This is not a long-winded theoretical blathering that you see all too often; instead, we actually start writing OO code very quickly. I believe that this ‘hands-on’ style of learning, makes understanding OO (object oriented) PHP much easier… and less boring too!

im keeping this as a bookmark as this site ( really helped me when i was handed with OOP PHP codes back when i did not know OOP.


source(PDF version):