Software Engineering for Smart Data Analytics & Smart Data Analytics for Software Engineering
In the following you are asked to apply your knowledge to refine a model of a zoo. Animals in a zoo live in enclosures. These enclosures are maintained by zoo keepers. Of course, these keepers as well feed the animals in the enclosures.
Express the following assertions in OCL:
Picture © German Federal Archives, https://commons.wikimedia.org/wiki/File:Bundesarchiv_Bild_102-08468,_Hamburg,_Tierpark_Hagenbeck.jpg
Consider the Map interface in the java.util package. A Map contains values identified by keys. Write pre- and postconditions in OCL for the following operations:
V get(Object key): Returns the value for the given key, or null if none is available.
V put(K key, V value): Stores the given value of the given key in the map.
remove(Object key): Remove the key-value pair with the given key from the map.
void clear(): Removes all key-value pairs from the map.
Consider the following class diagram representing the domain of commercial properties (buildings owned by companies).
Task a), Relational Databases: We presented three alternatives to map a class hierarchy to a relational database. Describe the three alternatives and how the tables would look like for the classes
Warehouse. Discuss the benefits or drawbacks with respect to performance of queries (runtime), changes to the attributes (evolution), storage consumption.
Task b) Java Code: Map the complete model (i.e. including
Company) to Java code strictly following the mapping presented in the lecture. We will evaluate the mapping of the three different associations and the presence of the getter and setter methods for the attributes. As explained in the lecture there is a benefit in not being creative here. Explain this in one or two sentences.
Task c) OCL, optional: The mapping of the associations is constructed to fulfill certain invariants. Describe for each of the three associations the invariants the construction guarantees. Remember: Constraints are only expected to be fulfilled on well defined points in time. Add a note for each constraint when it will be valid and when it is invalid.