Basic SOLID: must to do
SOLID principles are an essential base of software engineering because they give recommendations for projects on how to change and add new functionality without breaking existing code and creating bugs, save maintainability and easy understandable software.
SOLID principles are:
Using all 5 principles at the same time may be complicated (with good or bad consequences) and is not necessary for quality software, but there is an approach on how to deal with common software engineering problems. These principles should be applied depending on the actual problem and situation.
Let’s start with an overview of each of 5 principles.
With time, the complexity of class will grow dramatically and it will cause code redundancy, maintaining difficulties and as a result higher code breaks probability.
Write the class with the 1 only aim, for more - extend super class with subclass.
Avoid tight coupling!
Tight coupling is the state of a system where the components are highly dependent on each other. Better use loose coupling (state of a system where components are independent).
Don’t change the class, add new functionality to it with subclass.
Stop breaking other parts of software that are dependent on the piece of code you change. If new functionality for your software, add it but don’t erase the existing versions.
领英推荐
Similarities in behavior are:
Read more about Liskov substitution principle.
Don’t add a lot of not necessary functionality in 1 class, break it in many ones.
This way dependency “high-class -> low-level class” is changed to “high-level class -> abstract class <- low-level class”.
High level classes has high-level abstraction classes and low-lever classes depend on high-level abstraction class.
Source: DEV.to / Julie Cherner
Freelance Product Designer I Passionate about accessibility in design
5 个月???? ??? ?? ??????! ?????? ?? ????? ??? ?????? ??????: https://chat.whatsapp.com/HWWA9nLQYhW9DH97x227hJ
Junior SEO & B.Sc. in Digital Communication and Marketing
6 个月???? ??? ?? ?? ???????? ??????? ?? ????? ??? ?????? ??????: https://chat.whatsapp.com/DsQ1OBdSeGsBd6rKgnnE1L
CEO and security engineer
6 个月???? ??? ?? ?? ???????? ??? ???? ???? ????? ???? ?????? ???: https://chat.whatsapp.com/DsQ1OBdSeGsBd6rKgnnE1L
Freelance Mechanical Designer
6 个月???? ??? ?? ?? ???????? ??????? ?? ????? ??? ?????? ??????: https://chat.whatsapp.com/DsQ1OBdSeGsBd6rKgnnE1L