1.3 Explain the difference between physical and logical data independence.
Answer:
Answer:
Answer:
Look at the database that was used in exercise 1. Make a UML class diagram of this mini world (or use the class diagram technique you prefer). In particular pay attention to which attributes that you add to each class, and how classes are associated (object reference and aggregation). Also, sketch the methods for each class. Then answer the following questions.
Q: Does a class correspond to a table?
A: Not exactly. A class specifies both data and methods. A table only stores data.Q: Does each tuple in a table correspond to an object?
A: Again, not exactly because an object has associated both data and methods, whereas a tuple only stores data. However, you could make an object persistent by storing it as one or more tuples, e.g., by making each stored data item in the object a column in a table. However, this would require writing mapping methods to store and retrieve and objects from disk. These mappings may be non-trivial because an object can contain pointers to other objects and both the pointers and the objects pointed to must be stored in (retrieved from) tables.Q: Exercise 1 used a file with queries and modifications (insert/delete/updates). Would you map each query and modification to a method?
A: Yes. You could make the queries and modifications a bit more flexible by making each method take parameters, such that you can, e.g., retrieve all employees from the Shoe department and later retrieve all the employees from the Outdoor department simply by calling the method with different parameters.Q: How would you handle queries from interactive users?
A: That is a problem using, e.g., Java. You execute the same query but specify different parameters, as described above. However, if you want to execute a total different query you have to add a new method to your class.Q: Can a UML diagram be used for generating a relational schema (tables)?
A: Yes tools exists that can map UML diagrams to tables.