About Question enthuware.ocpjp.v7.2.1170 : Is the Composite pattern on the exam?
Posted: Fri May 30, 2014 11:46 am
Would you agree that the definition of composition is distinct from the definition of the composite pattern? The composite pattern has to do specifically with composing a tree structure from objects of a class that implements an interface that declares the tree's behavior. Each object in the tree is a leaf or contains one or more instances of the class of which it itself is an instance. Since the tree is created from instances of the same class, the class does provide the implementation of its owned components; it delegates behavior to other instances of its own class. So, the composite pattern implements a specific kind of composition. Unlike other implementations of composition, then, the composite pattern is not properly characterized as having "no control over how [the] functionality is implemented".
Given the definition of the composite pattern, as distinct from the definition of composition, would you agree that the third option would better be stated as, "One drawback of composition is that it is not possible to change or customize the aggregated functionality"?
References:
en.wikipedia.org/wiki/Composite_pattern
c2.com/cgi/wiki?CompositePattern
en.wikipedia.org/wiki/Object_composition
Given the definition of the composite pattern, as distinct from the definition of composition, would you agree that the third option would better be stated as, "One drawback of composition is that it is not possible to change or customize the aggregated functionality"?
References:
en.wikipedia.org/wiki/Composite_pattern
c2.com/cgi/wiki?CompositePattern
en.wikipedia.org/wiki/Object_composition