SOLID principles
Developing and maintaining a software project is time-consuming and not easy. One of the important part in a Software Development Life Cycle is the architecture design of the application. A good architecture design can help in developing a project that is easy to maintain, more secure and less suspectible to bugs (Bugs in software development are errors that produce unintended results).
What is a good architecture design? I believe that a good architecture design must adhere to SOLID principles. Every decision in the design of the architecture must be investigated whether it adhere to the SOLID principles. SOLID is an acronomy of the subset of object-oriented design principles first promoted in 2000 by Robert C. Martin in his article Design Principles and Design Patterns.1
- Single-responsibility principle
- Open-close principle
- Liskov Substitution principle
- Interface Segregation principle
- Dependency Inversion principle
Only the Single-responsibility principle is discussed in this article because of it ease to understand and implement, whether you are doing a small personal project or a large enterprise project. The Single-responsibility principle states that a class should have one and only one reason to change. In other words a class should only have one responsibility. This principle is easy to understand and implement but you find projects that contains API end points, application logic and SQL statements in one class. This shows that there was disregard of SOLID principles during architecture design. The problem in the example is that the class becomes too large and difficult to understand. It would be difficult to understand which part of the code deals with the API layer, the service layer (application logic) and the database layer (SQL). It also makes it difficult to make changes in one part of the code without affecting the other parts. In the example if you were to change from using a SQL database to a no-SQL database you would also affect the service layer and the API layer.
I believe that by dealing with the seperation of concern during architecture design the code will become easy to maintain.
1 Design Principles and Design Patterns [Access: 07 March 2021]