iluwatar / java-design-patterns

Design patterns implemented in Java
https://java-design-patterns.com
Other
90.17k stars 26.65k forks source link

Rule engine design pattern #1219

Open mohanaraosv opened 4 years ago

mohanaraosv commented 4 years ago

Description: The Rules design pattern is a behavioral design pattern that enables the encapsulation of business rules into isolated, reusable units. This pattern allows for the dynamic application of business logic at runtime and promotes the separation of concerns, making the system more modular and easier to maintain.

Main Elements of the Pattern:

  1. Rule Interface: Defines the contract for all rules, typically including a method to evaluate the rule and another to execute the rule's action.
  2. Concrete Rules: Implementations of the Rule interface, each encapsulating a specific piece of business logic.
  3. Rule Engine: Responsible for managing and executing rules. It evaluates which rules should be applied based on the given context and executes them accordingly.
  4. Context: The data or state that the rules operate on. This is passed to the rule engine and rules during execution.

References:

Acceptance Criteria:

  1. Create a Rule interface with methods to evaluate and execute a rule.
  2. Implement at least three concrete rule classes demonstrating different business logic scenarios.
  3. Develop a RuleEngine class capable of evaluating and executing a set of rules against a provided context.
  4. Include unit tests for the RuleEngine and the concrete rule classes to ensure correctness and robustness.
mohanaraosv commented 4 years ago

I will work on this.

iluwatar commented 4 years ago

Great @mohanaraosv

iluwatar commented 4 years ago

@mohanaraosv are you working on it?

mohanaraosv commented 4 years ago

I didn't get a chance to work on this, But I would like to contribute to this let it be on my name.

iluwatar commented 4 years ago

Ok @mohanaraosv, let me know if you require assistance

arjunduggal commented 3 years ago

hi @iluwatar Can I pick this up if this is still open? Thanks

iluwatar commented 3 years ago

@mohanaraosv was assigned earlier, but no news yet. Are you still working on it @mohanaraosv or could @arjunduggal take it?

mohanaraosv commented 3 years ago

Sorry for the delay!! I have made some progress on this please pick @arjunduggal some other pattern.

guapi777 commented 3 years ago

I would love to solve this issue within one month.........

ohbus commented 3 years ago

Thanks for your interest @guapi777

But @mohanaraosv already seems to be engaged with it. Please contact him if you would like to continue where he left.

Thanks.

mohanaraosv commented 3 years ago

@guapi777 Please pick another issue I have started working on this.

mohanaraosv commented 3 years ago

Expect a PR Timeline: 30-6-2021

iluwatar commented 3 years ago

@mohanaraosv are you still working on this?

mohanaraosv commented 3 years ago

Sorry for the delay I have updated new timeline expect a PR Timeline: 31-10-2021

iluwatar commented 3 years ago

Thanks for the info @mohanaraosv. Looking forward to your PR!

iluwatar commented 3 years ago

@mohanaraosv are you still working on this?

u7076185 commented 2 years ago

Hi @iluwatar, We are interested to pick this up. Would you mind assigning this to me? Thanks.

iluwatar commented 2 years ago

Sure thing, assigned to you @u7076185

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.