Question: Table 1 shows the difference between decorator pattern and Inheritance. Please write which label ( Decorator , Inheritance ) the columns belong to . Table
Table shows the difference between decorator pattern and Inheritance. Please write which label DecoratorInheritance the columns belong to
Table
tableUsed to extend the functionality of a particular object.,tableUsed to extend the functionality of a class ofobjectsDoes not require subclassing.,Requires subclassing.DynamicStatic.Runtime assignment of responsibilities.,Compile time assignment of responsibilities.tablePrevents the proliferation of subclasses leading to lesscomplexity and confusion.tableCould lead to numerous subclasses, explodingclass hierarchy on specific occasions.More flexible.,Less flexible.tablePossible to have different decorator objects for a givenobject simultaneously. A client can choose whatcapabilities it wants by sending messages to anappropriate decorator.tableHaving subclasses for all possible combinations ofadditional capabilities, which clients expect out ofa given class, could lead to a proliferation ofsubclassestableEasy to add any combination of capabilities. The samecapability can even be added twice.Difficult.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
