Question: QUESTION 1 [ 1 5 points ] Table 1 shows the difference between decorator pattern and Inheritance. Please write which label ( Decorator , Inheritance
QUESTION points
Table shows the difference between decorator pattern and Inheritance. Please write which
label DecoratorInheritance the columns belong to
Table
Used to extend the functionality of a particular object. Used to extend the functionality of a class of
objects.
Does not require subclassing. Requires subclassing.
Dynamic. Static.
Runtime assignment of responsibilities. Compile time assignment of responsibilities.
Prevents the proliferation of subclasses leading to less
complexity and confusion.
Could lead to numerous subclasses, exploding
class hierarchy on specific occasions.
More flexible. Less flexible.
Possible to have different decorator objects for a given
object simultaneously. A client can choose what
capabilities it wants by sending messages to an
appropriate decorator.
Having subclasses for all possible combinations of
additional capabilities, which clients expect out of
a given class, could lead to a proliferation of
subclasses.
Easy to add any combination of capabilities. The same
capability 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
