/java-chain-of-responsibility

This Project Implementation the Chain of Responsibility Design Patterns

Primary LanguageJava

Design Patterns

Chain of Responsibility

This Project Implementation the Chain of Responsibility Design Patterns

En

A Desgin Patter "Chain Of Responsibility" is highly recommended when we have scenarios where several rules need to be executed but will only apply the next instruction if the first one fails.

In the example of this code when trying a discount with the "Budget with more five items" rule it validates and if it does not apply it calls the next discount, until it reaches a discount that does nothing.

Pt

Um Desgin Patter "Chain Of Responsibility" é bastante recomentado quando temos cenarios onde varias regras precisão ser executadas porém somente vai aplicar a proxima instrução caso a primeira falhe.

No exemplo deste código ao tentar um desconto com da regra de "Orçamento com mais de cinco items" ele valida e caso não se aplique ele chama o proximo desconto, até chegar a um desconto que não faz nada.