LECTURE 11 – DATA MODELLING • Data Dictionaries • Entity Relationship Diagram for Data Modelling • Steps to Construct Entity Relationship Diagrams • Validation of Entity Relationships Diagram Software Project Management Maria Petridou 1
Dec 17, 2015
LECTURE 11 – DATA MODELLING
• Data Dictionaries• Entity Relationship Diagram for Data Modelling• Steps to Construct Entity Relationship Diagrams• Validation of Entity Relationships DiagramSoftware Project Management Maria Petridou
1
DATA DICTIONARIES
Software Project Management
2
Maria Petridou
It is a main method for analyzing the data flows and data stores of data-oriented computer systems.
The data dictionary is a reference work of data about data (metadata)
It collects, coordinates, and confirms what a specific data term means to different people in the organization.
Data dictionaries are created by making a detailed analysis of the data flows, data stores, and processes in data flow diagrams.
DATA DICTIONARIES
Software Project Management
3
Maria Petridou
The data dictionary may be used for the following reasons: Provide documentation Eliminate redundancy Validate the data flow diagram for completeness and accuracy Provide a starting point for developing screens and reports Determine the contents of data that is stored
DATA DICTIONARIES
Software Project Management
4
Maria Petridou
Data dictionaries may be created after the DFDs or at the same time than the DFDs using a top-down approach.
Creating a data dictionary is an iterative and evolutionary process that should be carried out in parallel to the systems analysis and design.
DATA DICTIONARIES
Software Project Management
5
Maria Petridou
Data Repository is a large collection of project information including: Information about system data Procedural logic Screen and report design Relationships between entries Project requirements and deliverables Project management information
DATA DICTIONARIES
Software Project Management
6
Maria Petridou
Data dictionaries contain: Data flow
Each data flow should be defined with descriptive information and it's compound with structure or elements.
Data structures They are a group of smaller structures and elements. Specific arrangementsof data attributed (elements) that define the organization of a singleinstance of a data flow.
Data ElementsThe descriptive property or characteristic of an entity. In database terms,
this is a "attribute" or a "field." Data stores
A inventory of data. The whole of the data in a small system. A database!
ENTITY RELATIONSHIP DIAGRAMS FOR DATA MODELLING
Software Project Management
7
Maria Petridou
Data modelling focuses on data flows and data stores represented in the data flow diagrams.
Data models can be of two types: Logical data models – describe logical organisation and presentation of data.
A technique for logical data modelling is the entity-relationship diagrams. Physical data models – produced in the design phase, give implementation
details about how data will actually be stored in databases and files. An Entity-Relationship Diagram (ERD) shows how the data that flows in
the system is organised and used.
ENTITY RELATIONSHIP DIAGRAMS FOR DATA MODELLING
Software Project Management
8
Maria Petridou
The elements of an ERD are the following: Entity – multiple instances about which the data is collected. Attributes – specific details or information about an entity. Relationships – associations between entities. A relationship has:
Cardinality - The number of instances of entity B that can be associated with each instance of entity A. Minimum Cardinality or Modality - The minimum number of instances
of entity B that may be associated with each instance of entity A. Maximum Cardinality - The maximum number of instances of entity B
that may be associated with each instance of entity A
ENTITY RELATIONSHIP DIAGRAMS FOR DATA MODELLING
Software Project Management
9
Maria Petridou
Relationships A one-to-one relationship (1:1) exists when the maximum cardinality for
each entity in the relationship is 1. A one-to-many (1:N) relationship exists when the maximum cardinality on
one side is 1 and the maximum on the other side is many. A many-to-many (M:N) relationship exists when the maximum on both
sides is many.
ENTITY RELATIONSHIP DIAGRAMS FOR DATA MODELLING
Software Project Management
10
Maria Petridou
Types of entity relationships and example of their representation:
ENTITY RELATIONSHIP DIAGRAMS FOR DATA MODELLING
Software Project Management
11
Maria Petridou
Implement One-to-One Relationships In a relational database, one-to-one relationships between entities can be
implemented by merging the two tables/entities together. Implement One-to-Many Relationships
Place the primary key of the entity that can occur only once as a foreign key in the entity that can occur many times.
Implement Many-to-Many Relationships In a relational database, many-to-many relationships between entities can
be implemented by creating a new entity that links the other two entities together. In most cases, the primary key of the new entity consists of the primary keys of the entities that it is relating together.
Spit it into two one-to-many relationships!
ENTITY RELATIONSHIP DIAGRAMS FOR DATA MODELLING
Software Project Management
12
Maria Petridou
Student Student ID (pk) Student first name Student last name …
Module Module ID(pk) Module name Module Credits …
Student Student ID (pk) Student first name Student last name …
Enrollment Module ID (pk) + (fk) Student ID (pk) + (fk)
Module Module ID(pk) Module name Module Credits …
in
ENTITY RELATIONSHIP DIAGRAMS FOR DATA MODELLING
Software Project Management
13
Maria Petridou
Example of an ERD for the doctor’s office appointments system (see DFD in handouts of Lecture 9).
STEPS TO CONSTRUCT ENTITY RELATIONSHIP DIAGRAMS
Software Project Management
14
Maria Petridou
Like constructing DFDs and data dictionaries, the construction of ERDs is an iterative and evolutionary process that requires refinement as a better understanding of the system to be developed is achieved.
1. Identify entities – use DFDs and use cases to identify multiple instance entities.
2. Add attributes – requires detailed analysis and perhaps use of requirements gathering techniques.
3. Assign identifiers or Primary keys – Each entity type must have an attribute or set of attributes that distinguishes one instance from other instances of the same type.
4. Foreign Keys - The attributes of a foreign key in one entity are the attributes of a primary key in another entity.
5. Identify Relationships – involves establishing the cardinality and the modality of each relationship.
STEPS TO CONSTRUCT ENTITY RELATIONSHIP DIAGRAMS
Software Project Management
15
Maria Petridou
Example: Create a logical data model (based on an ERD) for the University Registration System (see handouts for Lecture 9).
1. Identify Entities
STEPS TO CONSTRUCT ENTITY RELATIONSHIP DIAGRAMS
Software Project Management
16
Maria Petridou
2. Add Attributes
STEPS TO CONSTRUCT ENTITY RELATIONSHIP DIAGRAMS
Software Project Management
17
Maria Petridou
3. Assign Identifiers
STEPS TO CONSTRUCT ENTITY RELATIONSHIP DIAGRAMS
Software Project Management
18
Maria Petridou
4. Identify Relationships
STEPS TO CONSTRUCT ENTITY RELATIONSHIP DIAGRAMS
Software Project Management
19
Maria Petridou
Important guidelines when creating ERDs: Use consistent labels and names Avoid unnecessary attributes Break-down the model if needed Determine cardinality and modality correctly
VALIDATION OF ENTITY RELATIONSHIP DIAGRAMS
Software Project Management
20
Maria Petridou
Two available techniques to validate ERDs are:Normalisation and Balancing DFD/ERD
Normalisation – set of rules applied to the ERD in order to detect problems in the data model. The data model is checked against 1st Normal Form, 2nd Normal Form and 3rd Normal Form.
Balancing DFD/ERD – there should be a balance or correspondence between the data elements in the DFD and the ERD (data stores-entities and data flows-attributes). This may provoke changes to the DFD and the ERD!
VALIDATION OF ENTITY RELATIONSHIP DIAGRAMS
Software Project Management
21
Maria Petridou
The DFD and ERD are balanced when: There is a one-to-one correspondence between data stores in the
DFD and entities in the ERD. Data flows in the DFD are made of data elements corresponding to
attributes in the ERD.
Reading: (Kendall&Kendall,chapter 9) and (Dennis &Wixom,chapter 7).