Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
Due at Friday, July 2nd, 23:59 |
---|
4 points |
---|
In this task you will learn how to use the Abstractness-Stability-Diagram to decide whether a certain design pattern is appropriate or not. As the pattern wasn't covered in the lecture we quickly introduce it here:
6 points |
---|
In the lecture you became familiar with Creational Pattern (Abstract Factory, Builder), Structural Pattern (Adapter, Bridge, Composite, Facade, Proxy), Behavioral Pattern (Command, Observer, Strategy), and the Architectural Pattern “Model View Controller”. Knowing design pattern is essential for being productive in Object Oriented Software Construction. In addition they are not only useful for the construction of software, but as well for reading and understanding it.
Prepare the software you are about to study:
Your task is to find three design pattern in the source code (there are more!) and be ready to explain them. Write a short text describing where to find the design pattern in the code and how it works. For each design pattern you should at least describe
Write it in your own words! Don't copy from the thousand resources you can find on the web about JHotDraw. Of course you can read them, but don't copy them. You even find explanations in the project itself e.g.in the pattlets folder.
So for e.g. the Composite Pattern we would like to know: Which class is the Composite (See above)? Which class plays the Component role? How many classes are playing the Leaf role? Which? How does the Composite implement most of its operations? Does the rest of the code distinguish between Composites and Leaves? If “yes”: How? If “no”: Why?
5 points |
---|
Lets assume the bike rental outlets should also support motorbike renting. We updated the analysis model accordingly, here is an excerpt:
The class Bikes is a list that only contains bikes. It is used to present vehicles rentable by all users.
a) Write the two pre-conditions with OCL. Hint: The boolean function oclIsTypeOf(TypeName) checks if an instance is of type TypeName or not. Do the constraints follow contract inheritance? Write a Java sample project (at least a snippet) to illustrate the problem.
b) Lets assume you want to use the Vehicles class for all logged-in users. So you restrict the use of the Vehicles::add(Vehicle) method with the following precondition: “if the vehicle is a motor bike the user must be older than 18 years and own a drivers license”
Write the constraint as an OCL constraint.