Single Responsibility Principle
- Every class should have a single responsibility.
- There should never be more than one reason for a class to change.
- Your classes should be small. No more than a screen full of code.
- Avoid 'god' classes.
- Split big classes into smaller classes.
Open Closed Principle
- Your classes should be open for extension.
- But closed for modification.
- You should be able to extend a classes behavior, without modifying it.
- Use private variables with getters and setters only when you need them.
- Use abstract base classes.
Liskov Substitution Principle
- Objects in a program would be replaceable with instances of their subtypes without altering the correctness of the program.
- Violations will often fail the "is a" test.
- A square "is a" rectangle.
- However, a rectangle "is not" a square.
Interface Segregation Principle
- Make fine grained interfaces that are client specifc.
- Many client specific interfaces are better than one "general purpose" interface.
- Keep your components focused and minimize dependencies between them.
- Notice relationship to the Single Responsibility Principle?
- Avoid 'god' interfaces.
Dependency Inversion Principle
- Abstractions should not depend upon details.
- Details should depend upon abstractions.
- Important than higher level and lower level objects depend on the same abstract interaction.
- This is not the same as Dependency Injection - which is how objects obtain dependent objects.
foerifiehi Jorge Harth link
ResponderEliminarrepothunve
inulXneru Srinivas Blaschko CyberLink PowerDVD
ResponderEliminarCorelDRAW
JetBrains RubyMine 2022.2
UltraISO
ticksolsuce