

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Analyze how the core of the collections hierarchy makes use of the following design patterns: • Factory (any variant: abstract factory, factory method). • ...
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Although this exercise is not graded, it is highly recommended to also do them on your own. Just looking at a solution is much easier in comparison to actually coming up with it. Support can be found in the office hours of our tutors and in the forum at https://www.fachschaft.informatik.tu-darmstadt.de/forum/viewforum.php?f=234.
In the project for the first exercise, you will find the source code for the Scala 2.7 standard library, which contains a collection hierarchy. Note: do not expect to be able to compile it with a current Scala compiler or in Eclipse / IntelliJ. We know that Scala 2.7 is an old version, but newer versions are too complex, please do not try to analyze other Scala versions than 2.7. Analyze how the core of the collections hierarchy makes use of the following design patterns:
Look at all of the following classes and traits and their corresponding companion objects:
For each pattern name the participants, which roles they have, how they collaborate and how they might vary from the standard text book examples. Explain the pattern in terms specific to the current pattern instance, e.g., don’t just copy text from a design patterns book. Your analysis should be complete and you should mention how often a specific pattern is used in comparison to others. If a pattern is used in a similar way in many different places, give a detailed analysis of a single example and say how other instances of the pattern in the collection hierarchy relate to it.
Now have a look at the SynchronizedMap trait in the package scala.collection.mutable. Which design pattern is used to add synchronization to maps? Does the design pattern that is used resolve the fragile base class problem? Justify your answer. For this task you can use the current version of the Scala standard library.
The word has spread about your successful implementation of the order management system (OMS) for Starbuzz Inc. You received an email from the manager of TastyPizza Inc. who heard about your success. He wants you to implement a new OMS for his pizza delivery shop. For the first milestone, he has defined several requirements that need to be fulfilled by your OMS:
The manager sent you the menu card of TastyPizza for a better understanding of their available items:
Pizzas Calories Price Pizza Margherita (tomato, cheese) 1104 4. Hawaiian Pizza (tomato, cheese, ham, pineapple) 1024 6. Salami Pizza (tomato, cheese, salami) 1160 5. Family Size for Pizza x 1.95 + 4.
Toppings Calories Price Cheese 92 0. Ham 35 0. Onions 22 0. Pineapple 24 0. Salami 86 0.
Drinks Calories Price Lemonade (0.33l) 128 1. Water (0.5l) 0 1. Wine (0.75l, 13%) 607 7.
Franchise Price TastyPizza Shirt 21. TastyPizza Mug 4.
Your tasks for this exercise are as follows: