Skip to content

Commit f0e2ba6

Browse files
authored
Update README.md
1 parent 6c75134 commit f0e2ba6

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

solid/README.md

+18-14
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,27 @@
99
- Not substitutable
1010

1111
### S.O.L.I.D - Order doesn't matter
12-
1. Interface segregation
13-
1. Helps design good classes
14-
2. Helps write unit test cases
12+
1. Interface segregation
13+
1. Helps design good classes
14+
2. Helps write unit test cases
15+
3. Asks you to create a different interface for different responsibilities, in other words, don't group unrelated behavior in one interface, You break ISP if You have already an interface with many responsibilities, and the implementor doesn't need all this stuff.
16+
4. [https://stackoverflow.com/questions/54480725/the-difference-between-liskov-substitution-principle-and-interface-segregation-p](https://stackoverflow.com/questions/54480725/the-difference-between-liskov-substitution-principle-and-interface-segregation-p)
1517
2. Liskov substitution - how subclasses extend superclasses
16-
1. Object of superclass S can be replaced with objects of any subclass of S
17-
2. Helps design good polymorphism
18+
1. This principle asks you to make sure that all child classes have the same behavior as the parent class. Object of superclass S can be replaced with objects of any subclass of S.
19+
2. Helps design good polymorphism
20+
3. Ex: Square-Rectangle Problem
1821
3. Open/closed - tuning the design
19-
1. Open to extension means adding subclasses a needed
20-
2. Closed to modification avoids "tweaking" the code to handle new situations
21-
4. Dependency inversion - based on packaging the code
22-
1. A direct dependency on a concrete class needs to be "inverted"
23-
2. Depend on abstraction classes
24-
3. Avoid concrete class name dependencies
22+
1. Open to extension means adding subclasses a needed
23+
2. Closed to modification avoids "tweaking" the code to handle new situations
24+
3. A**llow its behavior to be extended without modifying its source code. Factory → we need to update the objects list only, method names are the same.**
25+
4. Dependency inversion - based on packaging the code. Decrease the dependency on another concrete class.
26+
1. A direct dependency on a concrete class needs to be "inverted"
27+
2. Depend on abstraction classes
28+
3. Avoid concrete class name dependencies
2529
5. Single responsibility - summary of other 4 principles
26-
1. One responsibility per class
27-
2. "A class should have one reason to change"
28-
3. Note!! "Single" at what level of abstraction? How are the responsibilities counter?
30+
1. One responsibility per class.
31+
2. "A class should have one reason to change"
32+
3. Note!! "Single" at what level of abstraction? How are the responsibilities counter?
2933

3034
### Other OO Principle
3135
- Don't repeat yourself (DRY)

0 commit comments

Comments
 (0)