Business rule validators and command handler in CQRS

It’s important to know that commands can be rejected after they are sent to the handler. At the very least, you could encounter a concurrency violation that cannot be detected until the aggregate root is touched. But also, the validation that can occur outside of the entity is simple validation. Not only string lengths, numeric … Read more

Design Pattern to implement Business Rules with hundreds of if else in java

You should check out the Rules Design Pattern http://www.michael-whelan.net/rules-design-pattern/. It looks very similar to the example code you gave and consists of a base interface that defines a method for determining if a rule is satisfied and then various concrete implementations per different rules. As I understand it, your switch statement would turn into some … Read more

Business logic in MVC [closed]

Fist of all: I believe that you are mixing up the MVC pattern and n-tier-based design principles. Using an MVC approach does not mean that you shouldn’t layer your application. It might help if you see MVC more like an extension of the presentation layer. If you put non-presentation code inside the MVC pattern you … Read more