8. S ingle Responsibility Principle O pen / Close Principle L iskov Substitution Principle I nterface Segregation Principle D ependency Inversion Principle
16. Definition “Every object should have a single responsibility, and that responsibility should be entirely encapsulated by the class.” “Classes should have one responsibility - one reason to change.”
22. Argument Against SRP “Too many classes and too difficult to understand the BIG PICTURE.” There are no more moving parts in a system with many small pieces than that with a few large pieces. The benefits outweigh this argument. Consistency, good names, and documentation make this a mute point.
23. What are some of the benefits? Reuse - If all your classes follow the srp, you are more likely to reuse some of them Clarity - Your code is cleaner as your classes don’t do unexpected things Naming - As all your classes have a single responsibility, choosing a good name is easy Readability - Due to the clarity, better names and shorter files the readability is improved greatly.