An Experimental Comparison of ER and UML
Class Diagrams for Data Modelling
Experimental Material
-January 14, 2009
Abstract
This report describes the experimental material used in three sets of controlled experiments carried out to compare ER and UML class diagrams for data mod-elling. In particular, the experimentation aimed at comparing the support given by ER and UML class diagrams in comprehension, maintenance, and verification of data models. The experiments involved university students with different levels of ability and experience. The comparison provides qualitative and quantitative results that can be used by project managers to evaluate the possibility of adopt-ing a design method within their own organisation, dependadopt-ing on the skills of the involved human resources.
1
Comprehension Tasks: questionnaire and artefacts
This section describes the two tasks used to analyse the comprehensibility of ER and UML class diagrams. To evaluate it, we asked the subjects to answer a questionnaire consisting of 5 multiple choice questions where each question can have one or more correct answers. It is important to note that the number of answers was the same for each question (i.e., three answers), while the number of correct answers was different. The questions cover all the entities and the relationships of the data model presented to the subjects.
Next section shows the questionnaire and the ER and UML class diagrams (see
Figure 1) for the taskT1c on the data modelADAMS-TeamManagement. Moreover,
Section 1.2 shows the ER and the UML class diagrams (see Figure 2), as well as the
questionnaire, for the taskT2con the data modelEasyClinic-BookingManagement.
1.1
Task T1
cThe questionnaire used for theADAMS-TeamManagementsystem is:
Q1 Consider the relationship between Artefact and Version and select the correct statements:
2 An artefact can have more versions
2 An artefact can have at most one version
2 An artefact could have no versions
Q2 Consider the relationship between Artefact and Resource and select the correct statements:
2 On an artefact can be allocated one resource
2 On an artefact can be allocated at least one resource
2 On an artefact could be no resources allocated
Q3 Consider the relationship between Version and File and select the correct state-ments:
2 A version can have more associated files
2 A version could be no associated files
2 A version can have at most one associated file
Q4 Consider the class Resource and its relationships. Which are the correct state-ments:
2 Skills of a resource can be identified
2 It is possible to verify if a resource is allocated on an artefact
(a)
(b)
Figure 1: Data model ofADAMS-TeamManagementrepresented by an ER diagram (a)
and an UML class diagram (b)
Q5 Consider the class Artefact and its relationships. Which are the correct state-ments:
(a)
(b)
Figure 2: EasyClinic data model represented by ER diagram (a) and UML class dia-gram (b)
2 It is possible to identify the artefact manager
2 It is possible to identify the date of an artefact version
1.2
Task T2
cThe questionnaire used for theEasyClinic-BookingManagementsystem is:
statements:
2 A patient can make only one reservation
2 A patient has to make at least one reservation
2 A patient could not make a reservation
Q2 Consider the relationship between Patient and Visit and select the correct state-ments:
2 A patient can make only one visit
2 A patient has to make at least one visit
2 A patient can make more than one visit
Q3 Consider the relationship between Booking and VisitType and select the correct statements:
2 A reservation has to refer to only one type of visit
2 A reservation could not refer to any type of visit
2 A reservation is referred to at least one type of visit
Q4 Consider the class Patient and its relationships. Which are the correct statements:
2 It is possible to establish the reservations of a patient
2 It is possible to establish when a patient has been registered
2 It is possible to establish the reservation cancelled by a patient
Q5 Consider the class Booking and its relationships. Which are the correct state-ments:
2 A reservation can be made by more than one patient
2 Given a reservation, it is possible to establish the of the booked visit
2
Maintenance Tasks: questionnaire and artefacts
This section describes the two tasks used to analyse the maintainability of ER and UML class diagrams. In order to evaluate it we adopted a similar approach as the assessment of the comprehension level. In particular, we asked the subjects to answer a questionnaire consisting of 5 multiple choice questions, but in this case each question has only one correct answers. It is important to note that the number of answers was the same for each question (i.e., three answers). In each question we present a change request and ask to the subjects to select which are the correct changes to perform on the data model to satisfy the request.
Next section shows the questionnaire and the UML class diagram (see Figure 3)
for the taskT1mon the data model Company. Moreover, Section 2.2 shows the ER
diagram (see Figure 10), as well as the questionnaire, for the taskT2mon the data
modelUniversity.
Figure 3: Company data model represented by UML class diagram
2.1
Task T1
mThe questionnaire used for theCompanysystem is:
Q1 We want to keep track of the projects completed by each unit (by storing start and end date of the project). What are the modifications to be accomplished in order to carry out this request? Select the correct UML class diagram in Figure 2.1:
Employee firstName lastName SSN{Id} birthDate address Unit number{Id} location 1..* name Projects location number{Id} name 1 1…* 1 0…1 1…* Manager companyPhone companyCar projectBenefit Developer noLanguages 0…1 0…* Startdate startDate +supervisor +supervised works_on chairs works_for supervises 1…* WorksOn hour 1…* 1 controls Question Q1 Unit number{Id} location 1..* name Projects location number{Id} name 0…* 1…* 1…* 1 controls CompleteProjects startDate endDate completeProjects (a) (a) Unit number{Id} location 1..* name Projects location number{Id} name 1…1 0…* 1…* 1 controls CompleteProjects startDate endDate completeProjects (b) Unit number{Id} location 1..* name Projects location number{Id} name startDate endDate 1…* 1 controls (c) (b) Unit number{Id} location 1..* name Projects location number{Id} name 1…1 0…* 1…* 1 controls CompleteProjects startDate endDate completeProjects (b) Unit number{Id} location 1..* name Projects location number{Id} name startDate endDate 1…* 1 controls (c) (c)
Figure 4: Question Q1 - Select the correct UML class diagram
Q2 We want to keep track of the dependent people for each employee, by storing Social Security Number (SSN), first name, last name, birth of date. What are the modifications to be accomplished in order to carry out this request? Select the correct UML class diagram in Figure 2.1:
Question Q2 Employee firstName lastName SSN{Id} birthDate address 1…1 0…* DependentOf firstName lastName SSN{Id} birthDate depend (a) Employee firstName lastName SSN{Id} birthDate address 1…* 0…* DependentOf firstName lastName SSN{Id} birthDate depend (b) (a) Question Q2 Employee firstName lastName SSN{Id} birthDate address 1…1 0…* DependentOf firstName lastName SSN{Id} birthDate depend (a) Employee firstName lastName SSN{Id} birthDate address 1…* 0…* DependentOf firstName lastName SSN{Id} birthDate depend (b) (b) Employee firstName lastName SSN{Id} birthDate address 1…1 1…* DependentOf firstName lastName SSN{Id} birthDate depend (c) Question Q3 Employee firstName lastName SSN{Id} birthDate address Unit number{Id} location 1..* name 1…* 1…* worked Worked startDate endDate (a) (c)
Q3 We want to keep track of all unit for which an employee worked, by storing the start date and the end date (note that that an employee can work for a department at most once and an employee works for one and only department at a given date). What are the modifications to be accomplished in order to carry out this request? Select the correct UML class diagram in Figure 2.1:
Employee firstName lastName SSN{Id} birthDate address 1…1 1…* DependentOf firstName lastName SSN{Id} birthDate depend (c) Question Q3 Employee firstName lastName SSN{Id} birthDate address Unit number{Id} location 1..* name 1…* 1…* worked Worked startDate endDate (a) (a) Employee firstName lastName SSN{Id} birthDate address Unit number{Id} location 1..* name 1…1 1…* worked Worked startDate endDate (b) Employee firstName lastName SSN{Id} birthDate address Unit number{Id} location 1..* name 1…* 0…* worked Worked startDate endDate (c) Question Q4 (b) Employee firstName lastName SSN{Id} birthDate address Unit number{Id} location 1..* name 1…1 1…* worked Worked startDate endDate (b) Employee firstName lastName SSN{Id} birthDate address Unit number{Id} location 1..* name 1…* 0…* worked Worked startDate endDate (c) Question Q4 (c)
Figure 6: Question Q3 - Select the correct UML class diagram
Q4 We want to keep track of the seniority years of the manger and developers. What are the modifications to be accomplished in order to carry out this request? SSe-lect the correct UML class diagram in Figure 2.1:
Employee firstName lastName SSN{Id} birthDate address Manager companyPhone companyCar projectBenefit seniority Developer noLanguages seniority (a) Employee firstName lastName SSN{Id} birthDate address seniority Manager companyPhone companyCar projectBenefit Developer noLanguages (b) (a) Employee firstName lastName SSN{Id} birthDate address Manager companyPhone companyCar projectBenefit seniority Developer noLanguages seniority (a) Employee firstName lastName SSN{Id} birthDate address seniority Manager companyPhone companyCar projectBenefit Developer noLanguages (b) (b) Employee firstName lastName SSN{Id} birthDate address seniority Manager companyPhone companyCar projectBenefit seniority Developer noLanguages seniority (c) (c)
Figure 7: Question Q4 - Select the correct UML class diagram
Q5 Consider the database schemas before and after a maintenance activity on the relational schemas PROJECTS e UNIT (see Figure 8). Note that the attributes with a line are the primary keys while the starred attributes are reference keys. Select the correct UML class diagram (regarding PROJECTS e UNIT classes) from Figure 2.1 for the relational schema after the maintenance activity.
(a) (b)
Figure 8: Company Schema before the maintenance activity (a) and after the mainte-nance activity (b)
(a) (b) (c)
Figure 10: University data model represented by ER diagram
2.2
Task T2
mThe questionnaire used for theUniversitysystem is:
Q1 We want to keep track of the module completed by each student, storing the vote and the date. What are the modifications to be accomplished in order to carry out this request? Select the correct ER diagram in Figure 2.2:
MODULE Code Year Semester ATTENDS (1,N) STUDENT RegistrationYear Code (1,N) Presence Vote Date (c) Question Q2 MODULE Year Semester Room (1,1) IN Floor Hour LESSON (1,1) (a) MODULE Year Semester Room (1,1) IN Floor Hour LESSON (1,N) (b) (a) MODULE Code Year Semester ATTENDS (1,N) STUDENT RegistrationYear Code (1,N) Presence Vote Date (c) Question Q2 MODULE Year Semester Room (1,1) IN Floor Hour LESSON (1,1) (a) MODULE Year Semester Room (1,1) IN Floor Hour LESSON (1,N) (b) (b) MODULE Year Semester Room (0,1) IN Floor Hour LESSON (1,N) (c) Question Q3 MODULE Code Year Semester TEACHES FACULTY Salary Position (1,N) (1,N) Hour Responsability (a) MODULE Code Year Semester TEACHES FACULTY Salary Position (1,N) (1,1) Hour Responsability (b) MODULE Code Year Semester TEACHES FACULTY Salary Position (0,N) (0,N) Hour Responsability (c) (c)
Q2 We want to keep track of the information on the lessons for each module by storing room, floor, and hour. What are the modifications to be accomplished in order to carry out this request? Select the correct ER diagram in Figure 2.2:
MODULE Code Year Semester ATTENDS (1,N) STUDENT RegistrationYear Code (1,N) Presence Vote Date (c) Question Q2 MODULE Year Semester Room (1,1) IN Floor Hour LESSON (1,1) (a) MODULE Year Semester Room (1,1) IN Floor Hour LESSON (1,N) (b) (a) MODULE Code Year Semester ATTENDS (1,N) STUDENT RegistrationYear Code (1,N) Presence Vote Date (c) Question Q2 MODULE Year Semester Room (1,1) IN Floor Hour LESSON (1,1) (a) MODULE Year Semester Room (1,1) IN Floor Hour LESSON (1,N) (b) (b) MODULE Year Semester Room (0,1) IN Floor Hour LESSON (1,N) (c) Question Q3 MODULE Code Year Semester TEACHES FACULTY Salary Position (1,N) (1,N) Hour Responsability (a) MODULE Code Year Semester TEACHES FACULTY Salary Position (1,N) (1,1) Hour Responsability (b) MODULE Code Year Semester TEACHES FACULTY Salary Position (0,N) (0,N) Hour Responsability (c) (c)
Figure 12: Question Q2 - Select the correct ER diagram
Q3 We want to keep track of all teacher that teach a Module, by storing their respon-sability and the number of hour (taking into account that a module can be held by more than one teacher). What are the modifications to be accomplished in
order to carry out this request? Select the correct ER diagram in Figure??:
MODULE Year Semester Room (0,1) IN Floor Hour LESSON (1,N) (c) Question Q3 MODULE Code Year Semester TEACHES FACULTY Salary Position (1,N) (1,N) Hour Responsability (a) MODULE Code Year Semester TEACHES FACULTY Salary Position (1,N) (1,1) Hour Responsability (b) MODULE Code Year Semester TEACHES FACULTY Salary Position (0,N) (0,N) Hour Responsability (c) (a) MODULE Year Semester Room (0,1) IN Floor Hour LESSON (1,N) (c) Question Q3 MODULE Code Year Semester TEACHES FACULTY Salary Position (1,N) (1,N) Hour Responsability (a) MODULE Code Year Semester TEACHES FACULTY Salary Position (1,N) (1,1) Hour Responsability (b) MODULE Code Year Semester TEACHES FACULTY Salary Position (0,N) (0,N) Hour Responsability (c) (b) MODULE Year Semester Room (0,1) IN Floor Hour LESSON (1,N) (c) Question Q3 MODULE Code Year Semester TEACHES FACULTY Salary Position (1,N) (1,N) Hour Responsability (a) MODULE Code Year Semester TEACHES FACULTY Salary Position (1,N) (1,1) Hour Responsability (b) MODULE Code Year Semester TEACHES FACULTY Salary Position (0,N) (0,N) Hour Responsability (c) (c)
Figure 13: Question Q3 - Select the correct ER diagram
Q4 We want to keep track of the telephone number of teachers and students. What are the modifications to be accomplished in order to carry out this request? Select the correct ER diagram in Figure 2.2:
Question Q4 PERSON SSN Firstname Lastname BirthDate Address STUDENT FACULTY Salary Office RegistrationYear Position Code Telephone Telephone (a) PERSON SSN Firstname Lastname BirthDate Address STUDENT FACULTY Salary Office RegistrationYear Position Code Telephone (b) PERSON SSN Firstname Lastname BirthDate Address STUDENT FACULTY Salary Office RegistrationYear Position Code Telephone Telephone Telephone (c) (a) Question Q4 PERSON SSN Firstname Lastname BirthDate Address STUDENT FACULTY Salary Office RegistrationYear Position Code Telephone Telephone (a) PERSON SSN Firstname Lastname BirthDate Address STUDENT FACULTY Salary Office RegistrationYear Position Code Telephone (b) PERSON SSN Firstname Lastname BirthDate Address STUDENT FACULTY Salary Office RegistrationYear Position Code Telephone Telephone Telephone (c) (b) Question Q4 PERSON SSN Firstname Lastname BirthDate Address STUDENT FACULTY Salary Office RegistrationYear Position Code Telephone Telephone (a) PERSON SSN Firstname Lastname BirthDate Address STUDENT FACULTY Salary Office RegistrationYear Position Code Telephone (b) PERSON SSN Firstname Lastname BirthDate Address STUDENT FACULTY Salary Office RegistrationYear Position Code Telephone Telephone Telephone (c) (c)
Figure 14: Question Q4 - Select the correct ER diagram
Q5 Consider the database schemas before and after a maintenance activity on the relational schemas Faculty and Department in Figure 15. Note that the attributes with a line are the primary keys while the starred attributes are reference keys. Select the correct ER diagram (regarding Faculty and Department entities) from Figure 2.2 for the relational schema after the maintenance activity
(a) (b)
Figure 15: Company Schema before the maintenance activity (a) and after the mainte-nance activity (b)
(a) (b) (c)
3
Verification Tasks: questionnaire and artefacts
This section describes the two tasks used to analyse the support give by ER and UML class diagrams during verification activities. In order to evaluate it we presented to the subjects a list of requirements and asking them to highlight in the data models the points that did not satisfy the requirements.
Next section shows the requirements and both the ER and UML class diagram (see
Figures 3.1 and 3.1) for the taskT1v on the data modelADAMS-EventManagement.
Moreover, Section 3.2 shows both the ER and UML class diagrams (see Figures 3.1
and 3.1), as well as the requirements, for the taskT2von the data model
EasyClinic-VisitManagement.
3.1
Task T1
vThe following diagram represents the data model of an artefact management system, called ADAMS.In particular, the diagram describes the management of the files as-sociated to an artefact and the event subscriptions mechanism of ADAMS. The dia-gram contains some defects, e.g., missing attributes or relationships, wrong cardinality. Analyse the requirements of the system and highlight in the data models the points that do not satisfy the requirements
Figure 17: UML class diagram of ADAMS-EventManagement
Figure 18: ER diagram of ADAMS-EventManagement
– is characterised by a name, a description, a status, a creation data, a starting
and ending date;
– has a type. The artefact type is characterised by a name, a description, an
icon, and an identifier. Moreover, almost a file type has to be specified for each artefact type. Clearly, the same file type (characterised by a name, a description and an extension) can be associated to one or more artefact types;
– should depend by other artefacts (target). In this case, it is necessary to
specify the direction as well as the stereotype of the dependence;
– should be composed of one or more artefacts. In this case, for each
compo-nent artefacts (child) it is necessary to specify its position in the hierarchy;
– has at least one resource allocated on it. Each resource allocated on an
artefacts has the possibility to subscribe an event on it specifying the
sub-scription level (eventLevel).
3.2
Task T2
vThe following diagram represents the data model of a software system implementing all the operations required to manage a doctor’s office, called EasyClinic.In particular, the diagram describes the management of the patients’ visits and bookings. The dia-gram contains some defects, e.g., missing attributes or relationships, wrong cardinality.
Figure 19: UML class diagram of EasyClinic-VisitManagement
Figure 20: ER diagram of EasyClinic-VisitManagement
Analyse the requirements of the system and highlight in the data models the points that do not satisfy the requirements.
• A visit...
– is characterised by a date, a code, an anamnesis, and a therapy;
– should require some laboratory exams. In this case is specified when the
exam is performed (i.e., date) and the results of the exam. Clearly, the same exam should be required in one or more visit. Each exam is characterised by a name and a description, and it is performed in a laboratory. Each laboratory is characterised by a name and an address. Moreover, each lab-oratory is specialised in several exams and only one lablab-oratory is able to perform a particular exam;
– is performed by at least one doctor. In this case is specified the role of the
doctor;
– requires a booking. Clearly, a booking should exist without a visit (it is not