Repository navigation
Behavioral Patterns
#Chain of Responsabillity To consider a more formal example, assume a scenario where you’ve a banking system, and you want to implement some kind of Loan approval. The customer may request a loan, and if it is below a specific amount, the cashier may approve it directly. If it is above the specified amount, he might pass the request to his manager for approval.
So you may use Chain Of Responsibility implementation to hand over the request/command to the correct approver. For an example, consider this implementation of the above Bank account scenario. Our business rule is something like, a cashier can approve the request if the amount is lesser than 1000
We have the following components.
LoanRequest – A concrete request IRequestHandler – Abstract request handler implementation Concrete handlers like Cashier and Manager implement this Has a reference to the successor to pass the request Program – The main driver
resources: http://www.codeproject.com/Articles/283346/Chain-Of-Responsibility-Design-Pattern-in-Csharp-u
##Command
Description: Encapsulate a command request as an object In other words
Intent
Represent an Action as an object
Decouple clients that execute the command from the details and dependencies of the command logic
Enables delayed execution