willkergomes / spring-boot-clean-architecture

A example of a clean architecture implementation with a spring boot project.
1 stars 0 forks source link

Validators and rules purpose #1

Open j0rgedev opened 5 months ago

j0rgedev commented 5 months ago

Hello! Thank you for sharing your knowledge about clean architecture with this project. I was reviewing it and I didn't get to know what the purpose of validators and rules is. I see many interfaces with methods such as isWishlistProductsNull(), but I could validate it with != null. I'd never seen such an implementation and I'd like to know more about it. Big thanks again!

willkergomes commented 5 months ago

Hi Jorge, thank you very much for your comment. I appreciate your review. This approach represents my perspective on a comprehensive Clean Architecture (CA) design implementation. The goal is to fully isolate the business domain layer by defining rules and validation contracts that should be implemented by the model classes and used by the application service layer. I believe this approach reduces coupling and prevents duplication of rule checks, resulting in a single domain access point for maintenance and testing. In other words, it makes it easier to identify and locate validations while avoiding dependencies on third-party frameworks. Additionally, it provides self-contained functions that enhance domain ownership through model classes. These model classes understand their role in the business and remain isolated from the service layer, which the application must implement. What are your thoughts on this? Do you see its practical applicability for microservices and other types of projects? I’m interested in your suggestions and any design improvements.