Why do I need to use services?
Microservices are an architectural approach based on building an application as a collection of small services.
The service will store the business rule of your application, that is, everything that is very specific within your application.
What is SOLID?
SOLID stand for:
- S - Single responsibility principle
- O - Open closed principle
- L - Liskov substitution principle
- I - Interface segregation principle
- D - Dependency Inversion principle
🚀Single responsibility principle:
Principle of Single Responsibility ⇒ A class must have one, and only one, reason for changing.
🚀Open/closed principle
Open / Closed Principle ⇒ You must be able to extend a class's behavior without having to modify it.
🚀Liskov substitution principle
Liskov substitution principle ⇒ Derived classes must be substitutable for their base classes.
🚀Interface segregation principle
Principle of interface segregation ⇒ Many specific interfaces are better than a single general interface.
🚀Dependency inversion principle
Dependency inversion principle ⇒ Depend on abstractions, not implementations.
By applying the principles we gain object-oriented benefits for our application, such as:
- Easy maintenance, understanding and organization;
- Open architecture to receive updates, improvements and new features without collateral damage
- Application of tests in an easy and simple way
- Easy code reuse
- Easy adaptation to changes in the scope of the project
Not using SOLID means exposing your application to problems such as:
- Code repetition, that is, a simple change must be replicated in several different points of its application
- Code without cohesive or standardized structure
- Rigidity and fragility, that is, any change causes a cascade of operations or failures in various parts of the system
- Difficulty performing and creating tests
- No reuse, that is, no or almost no functionality can be reused for other systems
Top comments (1)
Awesome work thanks for sharing this The Western Gazette with us.