Behavioral Patterns -lecture 8
Behavioral patterns focus more on the way objects and classes communicate among themselves, but in a small way also deal with algorithms and the assignment of responsibilities between objects.
There are in total 11 behavioral patterns namely; visitor, template, chain of responsibility, iterator, state, mediator, momento, strategy, observer, command and interpretor.
Unlike in the creational and structural patterns where the either inheritance or composition, behavioral patterns have divided them selves up with some using encapsulation, others composition and inheritance, for example, template uses inheritance, chain of responsibility uses composition and encapsulation is used by the visitor.
chain of responsibility
it does not support the coupling of the sender and receiver objects but instead it gives more than one object the chance of handling the request. this request is passed on from one object to another until it finds the one suitable to handle the request.
This pattern is used in cases where a request is sent out to many objetcs without specifying the receiver explicitly.
Reference:
Gamma, E., Helm, R., Johnson R., & Vlissides, J. (1994) Design Patterns: elements of reusable software, Addison Wesley, ("Gang of Four Book (GoF)") pg 395
Behavioral patterns focus more on the way objects and classes communicate among themselves, but in a small way also deal with algorithms and the assignment of responsibilities between objects.
There are in total 11 behavioral patterns namely; visitor, template, chain of responsibility, iterator, state, mediator, momento, strategy, observer, command and interpretor.
Unlike in the creational and structural patterns where the either inheritance or composition, behavioral patterns have divided them selves up with some using encapsulation, others composition and inheritance, for example, template uses inheritance, chain of responsibility uses composition and encapsulation is used by the visitor.
chain of responsibility
it does not support the coupling of the sender and receiver objects but instead it gives more than one object the chance of handling the request. this request is passed on from one object to another until it finds the one suitable to handle the request.
This pattern is used in cases where a request is sent out to many objetcs without specifying the receiver explicitly.
Reference:
Gamma, E., Helm, R., Johnson R., & Vlissides, J. (1994) Design Patterns: elements of reusable software, Addison Wesley, ("Gang of Four Book (GoF)") pg 395
0 Comments:
Post a Comment
<< Home