Ad Code

Use object composition to distribute behaviour

One of the behavior pattern is to "Use object composition to distribute behavior between classes" what does this phrase mean and how we can utilize it in software design? kindly explain with code, if applicable?



As we know that a behavioral pattern describes how a group of peer objects cooperate to perform a task that no single object can carry out by itself. A good software design in one in which, the responsibilities or behavior of the system is distributed among different sub systems. Keeping the same OOD principle in mind, instead of using a single object to handle a complex task, the complexity is decreased by the distributing the responsibilities among different objects using object composition in a class.

You can find a very good code example of behavioral pattern in the link below:

http://en.wikibooks.org/wiki/C++_Programming/Code/Design_Patterns/Behavioral_Patterns
Reactions

Post a Comment

0 Comments