DEV Community

Cover image for Services and SOLID
Letícia Barreto
Letícia Barreto

Posted on

Services and SOLID

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:

  1. Easy maintenance, understanding and organization;
  2. Open architecture to receive updates, improvements and new features without collateral damage
  3. Application of tests in an easy and simple way
  4. Easy code reuse
  5. Easy adaptation to changes in the scope of the project

Not using SOLID means exposing your application to problems such as:

  1. Code repetition, that is, a simple change must be replicated in several different points of its application
  2. Code without cohesive or standardized structure
  3. Rigidity and fragility, that is, any change causes a cascade of operations or failures in various parts of the system
  4. Difficulty performing and creating tests
  5. No reuse, that is, no or almost no functionality can be reused for other systems

Top comments (2)

Collapse
 
daisy_dani_deeb83780e6d0f profile image
Daisy Dani • Edited

Thank you for sharing your insights on this topic. It’s true that applying reliable services and solid principles is essential for achieving success in any field. In the same way, Advance Grinding Services operates with a strong foundation of excellence and integrity. Their commitment to delivering high-quality solutions, such as Steel Round Bar Chicago, Precision Ground Bars Chicago, and Centerless Grinding Services Chicago, is built on unwavering principles of precision, reliability, and customer satisfaction. Just as solid principles guide us in daily decisions, Advance Grinding Services ensures every project is completed with meticulous attention to detail and a focus on exceeding client expectations. Their dedication to quality and innovation makes them a trusted name in the metalworking industry, serving aerospace, automotive, and manufacturing sectors with exceptional results. When it comes to services that uphold solid principles, Advance Grinding Services leads the way!

Collapse
 
hdjdidsjns_jdjdsjjdjds_a5 profile image
hdjdidsjns jdjdsjjdjds

Awesome work thanks for sharing this The Western Gazette with us.