I believe that programmers who have been doing software development for a few years will have such a sigh: "the coupling of this program is too high and cannot be modified. If you really want to extend the function, you can only write it again! ", "This piece of code is too messy. I haven't understood it for a few days !", "The newly added function is useless to the original code !"......
I have heard a lot of such sighs, especially when performing maintenance or version upgrades. The root cause of these problems is that the scalability and reusability of those systems are too low or even not.
So how can we make the system reusable and scalable?
I think there are several processes and steps to achieve this goal: 1) There is a pain point, and the deeper the experience, the better. 2) there is a desire for knowledge and willingness to explore unknown things. 3) with a deep foundation for programming, you must thoroughly understand what interfaces are and what abstract classes are. 4) You must thoroughly understand the basic principles of OO design. 5) You must thoroughly understand and understand the design model, in particular, 23 GOF Models
The following is my learning experience and experience on what interfaces are, what are abstract classes, and the basic principles of OO design.
What is an interface?
......
What is an abstract class?
......
What are the OO design principles?
"Open-Closed Principle or OCP" Principle)
Liskey replacement Principle (Liskov Substitution Principle or LSP)
Dependency Inversion Principle or DIP)
Interface Segregation Principle or ISP)
Combination/clustering Principle (Composition/Aggregation Principle or CARP)
Lawof Demeter or dump)