Question
In object-oriented design, another frequently occurring scenario is the misuse of inheritance, aggregation, and compositional relationships between objects. For example, inheritance may be used for
In object-oriented design, another frequently occurring scenario is the misuse of inheritance, aggregation, and compositional relationships between objects. For example, inheritance may be used for the sole reason of reusing functions, even though the subclass unnecessarily has an "is-a" relationship with its parent. This makes the program susceptible to errors when the parent class is modified, as the behavior of all its subclasses changes unexpectedly.
A solution to this anti-pattern is Aggregate abstraction. From your textbook, "Aggregate abstraction. An aggregate abstraction reorganizes class relationships to improve their structure and extensibility. This transformation can take several forms: (a) conversion of inheritance relationships to aggregate relationships, (b) migration of aggregated classes to component relationships, or (c) migration of component relationships to aggregate relationships." Show an example object-oriented design, distinct from examples presented in your textbook, that illustrates this anti-pattern and another object-oriented design that fixes it by applying aggregate abstraction. Your example may be modeled after other examples.
For this homework, along with the side of your designs (using diagrams and class descriptions), you may include programming code if it is necessary to illustrate your design
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started