I have a contract with restrictions and discounts that needs to be checked against a carRental.
Example: User rent a car with the possible following properties:
1.Rent date between A and B 2.Type of car (SUV, luxury, sport) 3.location of rent
(in future can add more)
*assuming the contract speaks only about eligible discounts
The contract offers discount if the rent is in certain location (eg., rent from JFK airport) or the dates is between Jan-01 and Jan-20 etc.
My question is this: how should I design a contract where the discount can change periodically, manning a new discount will be added (eg next month the carRental will add this discount: if car is Yellow give extra 10% discount or if car is not �new� add 15% discount. )
I thought of an interface of discount and every discountClass will implement the interface but I�m not sure how to have it work in terms of contract checks for all possible restrictions/discount
A "rule engine" is software that lets you implement business rules in a declarative way that's easy for business folks to understand. The rules are kept separate from the applications code; they're expressed in a "rule language" which is more appropriate to the task. This makes them easier to modify and easy to track, version, and otherwise manage.