1

I really have trouble with validation and business rules programming(design) within Spring application standard architecture (controller -> service -> DAO...).

Bit by bit, service layer classes are becoming overloaded with ugly if-s, naive-refactored methods which unifies some common validations on class level etc. Simply, all this requires a some more refactoring practice to make code more maintainable.

I know for Business Rule Management Systems, and things like Hibernate Validator, but i don't want to use third party solutions if possible.

Recently, I read about Domain Driver Design and Specification pattern looks like attractive solution for business rules organization. I have also read different views about Spring and DDD combination.

Because i'm beginner, probably my idea will look naive, but i was thinking to combine AOP capabilities of Spring framework and Specification pattern as convenience approach to formulate business rules and logic. In that combination, AOP would be used just to insert specific business rule in specific service method. As some extension, i thought that maybe Strategy pattern will help for defining different validation strategies.

But, many questions arises. How to variate strategy according to validation context, class number explosion, pattern overusage etc?

I just want to hear some thoughts about this idea and advices about mentioned problem. Thanks

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.