L545 Systems Analysis & Design

advertisement
Z556: Session 8
Data Modeling
 Entity-Relationship Diagram (ER).
 Unified Modeling Language (UML).
1
Modeling
Cultural Model
Flow Model
Physical Model
Artifact Model
Sequence Model
E-R Diagram
2
What is Data Modeling?
A process for
identifying, documenting & organizing
data elements based on specified
requirements.
3
3
What is Data Modeling?
A design activity that is not
limited to data analysis.
(Be Creative…)
4
4
What is Data Modeling?
Can be presented in many different
ways.
5
E.g.,
Tables
Entity-Relationship
diagram
Class diagram
Activity diagram
5
Why Data Modeling?
To identify essential data elements and
understand their role in supporting
business processes.
6
6
A Little Incentive to Pay Attention
Annual Mean Salary by Job
Financial specialist
Information and Record Clerks
Loan officer
Network & Computer Systems
administrator
Paralegals
Database administrator
$74,270
$32,320
$71,800
$77,910
$51,170
Advertising Sales Agents
$80,740
$57,440
Actuaries
$107,740
Bureau of Labor Statistics http://www.bls.gov/oes/current/oes_nat.htm
7
Data Modeling Language
Entity-Relationship (ER) Diagram
Object-Oriented (OO) Design
Unified Modeling Language (UML)
8
8
Case Study: KCCI Training Center
• KCCI training center organizes training programs
for customers in three different areas: Investment,
Real-Estate, & Human-Resources.
• For each program to run, there is a required
minimum number of attendees.
• To enroll in a program or more, a customer fills a
registration form and send it to the center.
• A training coordinator keeps track of the number
of registered customers. When the minimum
number is reached before the start date of the
program, the coordinator contacts a trainer to run
the program and then sends confirmation/invoice
letters to the customers.
• If no trainer is available or the minimum number
is not reached, cancelation letters are sent to the
customers.
9
Case Study: KCCI Training Center
Problems:
 Ineffective paper-based system that fails to
meet the growing trends of the center.
 Difficulty to track programs and participants.
 Difficulty to locate misplaced or lost files.
 Difficulty to share and access information.
 Underutilized data for future planning.
10
Case Study: KCCI Training Center
Solution:
Develop a new information system for
managing, storing, retrieving, and
analyzing all information related to
training programs.
Purpose of data modeling:
To identify essential data elements and
understand their role in supporting
work processes.
11
ER Diagram
Entity
Relationship
Attribute
o The principle data objects about which
information is to be collected.
E.g., person, place, document, etc.
o Entity instance: a particular occurrence of an
entity.
Instances
University
•Indiana University Bloomington
•University of Indianapolis
•University of Phoenix
12
ER Diagram
Entity
Relationship
Attribute
Real-word association among entities.
Entity
Relationship
Entity
Manager
Manages
Department
13
ER Diagram
Entity
Relationship
Attribute
o Connectivity of a relationship :
Describes the constraints on the connection of
the associated instance in the relationship.
Entity
1
Entity
1
Entity
*
1
Entity
Relationship
*
Entity
Relationship
*
Entity
Relationship
14
ER Diagram
Entity
Relationship
Attribute
o Provides descriptive detail about entities and
relationships.
o An attribute value: a particular occurrence of
an attribute within an entity or relationship.
ID
name
Section
date
Student
enroll
Class
15
Title
KCCI ER Diagram
CoID
iscontactedby
1
Coordinator
Name
1
contacts
1
Address
Manage
s
Date
*
Customer
*
enrolls
*
*
Program
is
given
by
*
*
Trainer
1
ProgID
Name
CustID
Phone
Name
Area
Title
TrnID
16
KCCI ER Diagram
CoID
iscontactedby
1
Coordinator
Name
1
contacts
1
Manage
Address
Date
*
Customer
*
enrolls
*
*
Program
is
given
by
*
*
Trainer
1
ProgID
Name
CustID
Phone
Name
Area
Title
TrnID
17
KCCI ER Diagram
CoID
iscontactedby
1
Coordinator
Name
1
contacts
1
Manage
Address
Date
*
Customer
1
* Registration *
1
Form
*
Program
is
given
by
*
*
Trainer
1
ProgID
Name
CustID
Phone
Name
Area
Title
TrnID
18
Implementing
Cust#
100
Name
Peter Alex
Address
335 10th
Phone #
555-4444
19
Entity (Customer)
Implementing
Attribute
(address)
Cust#
100
Name
Peter Alex
Address
335 10th
Phone #
555-4444
data instance
20
Entity
Many-to-Many Relationship
Cust_id F_name
L_name
address
Registration
1234
Mary
Gray
456 Oak street
1235
Bill
Dodds
789 Woodburn street
1236
Justin
Moore
903 College avenue
Class_i
d
Price
Date
Class name
135
100
Oct-1-2013
Customer Service 101
136
200
Nov-1-2013
Types of Investment
137
100
Oct-31-2013 Property Evaluation
21
Many-to-Many Relationship
CUSTOMER
Cust_id
F_name
L_name
Address
REGISTRATION
Registration_id
0088
Cust_id
1234
Class_id
136
PRODUCT
Class_id
Price
Date
Class name
22
Generalization Hierarchy Diagram
Entities with common attributes can be
generalized into a higher entity type
(Superset entity).
Subsets entities can be either
disjoint (d) or overlapping (o).
23
23
Hierarchy Diagram
Overlap (o) Generalization
Name
Disjoint (d) Generalization
StartDate
Phone
ProgID
PerID
EndDate
Email
Program
Person
d
o
Customer
Coordinator
Trainer
Real-Estate
Investment
HumanResources
24
Object-Oriented (OO) Design
Objects are the basic unit which the organization must
keep track of or that participate in a business process.
A system is a set of objects that collaborate and interact
with each other.
UML is a widely accepted standard incorporating OO
concepts, and provides terminology and diagram
conventions.
25
25
Object-Oriented Design
Attributes:
• Properties attached to each object.
Operations :
• Functions that could change the value of
object’s attribute.
Methods:
26
26
• Procedure used to carry on the operations.
OO Concepts
• Classes:
Categories to which an object belong to and share the same
operation, methods, and attributes.
27
Class Name
Customer
Attribute 1
Attribute 2
Attribute 3
Operation 1 ()
Operation 2 ()
Operation 3 ()
CustomerID
Name
Address
SearchProgram()
Enroll ()
Pay ()
27
Class Relationships in UML
Generalization:
A relationship between a more general class and
a more specific class.
Program
Real-Estate
Investment
HumanResources
Association:
Objects in one class linked to objects in the other
class.
Multiplicities: 1 to 1 , 1 to * , * to *
28
Coordinator
28
Program
Class Relationships in UML
Aggregation:
Relationship between a whole and its parts.
Trainer
Program
Composition:
An aggregation relation in which the part belong to only one
whole at a time.
ProgramDescripton
Purpose
TargetAudience
29
Program
29
UML Class Diagram
(Attributes)
1..1
1..*
1..*
Trainer
Program
<pk>TrainerID
Name
PlaceOfWork
Phone
Fax
Email
Note
<pk>ProgramID
Title
TrainingArea
Location
StartDate
EndDate
StartTime
EndTime
Cost
MinAttendees
Coordinator
Status
Note
1..*
1..1
1..1
RegistrationForm
<pk>RegFormID
Date
<pk>CustomerID
<pk>ProgramID
Note
1..1
<pk>CoordinatorID
Name
Phone
Email
Note
<pk>CustomerID
Title
Name
Phone
Fax
Email
Work
Note
1..1
1..*
1..1
Coordinator
Customer
Association Class
Invoice
<pk>InvoiceID
Date
RegistrationForm
Cost
Note
30
UML Class Diagram
(Operation)
Trainer
AddTrainer()
RemoveTrainer()
isAvailable(:Boolean)
1..1
1..*
Program
1..*
1..*
AddProg ()
ConfirmProg ()
CancelProg()
1..*
1..1
Coordinator
ProgStatus ()
ConfirmLetter ()
CanelLetter ()
ContactTrainer()
1..1
1..1
RegistrationForm
AddProgram()
RemoveProgram()
AddCustomer()
RemoveCustomer()
Customer
NewCust()
SignIn()
FindProgram()
Enroll(in enrl: Program)
SendRegForm()
Payment()
1..1
1..1
Invoice
Total (amnt: Dollar)
31
Summary
Data modeling help identify essential data elements and
understand their role in supporting business processes.
Data modeling simplifies communication between system
developers and end users.
Data modeling supports the development of information
systems.
32
32
Develop a Data Model
for Choosing a Job?
• What are the entities/classes?
• What are the attributes?
• What are the relationships?
33
33
Develop a Data Model
for Choosing a Job?
1..1
1..*
ContactPerson
Job
<pk>CP_ID
Name
Phone
Fax
Email
Note
<pk>JobID
<pk>CP_ID
<pk>OrgID
Title
Salary
Responsibilities
Requirements
StartDate
Location
Note
1..*
1..1
Organization
<pk>OrgID
Name
Phone
Fax
Email
Website
Type
Note
34
34
The 7 Habits of Highly Effective Data Modelers
(Moody, 1996)
Knowledge
Skill
Motivation
Habit
Moody, D. (1996) The seven habits of highly effective data modelers.
Database Programming & Design, 9, 10, 57-64.
35
The 7 Habits of Highly Effective Data Modelers
(Moody, 1996)
• See for yourself (observation—Method school of data
modeling)
• Generate alternatives
• Keep it simple (generalization)
• Test the model (prototyping/scenario)
• Know when to stop
• Remember the big picture
• Following through
• Contextual Inquiry
36
Object-Orientation
Attributes:
Color; Size
ILS Z556
• Objects
• An object has attributes and operations
37
Object-Orientation
• Objects
Operations:
Make a call
ILS Z556
• An object has attributes and operations
38
Object-Orientation
• A class is a category to which an object belongs
ILS Z556
• E.g., Smartphone is a class for Nexus and iPhone; both
share the same attributes and operations
39
Object-Orientation
• Attributes of: size,
location, background
color, etc.
ILS Z556
• Window is a class
that has:
40
Object-Orientation
• Operations of: open,
close, resize, etc.
ILS Z556
• Window is a class
that has:
41
UML and ER
• UML class diagrams =~ ER diagrams
• Classes =~ Entities
Attribute 1
Class Name
Attribute 1
Attribute 2
Operation 1()
Operation 2()
Entity Name
42
UML and ER
• UML class diagrams =~ ER diagrams
• Classes =~ Entities
Example
Class Name
Customer
Attribute 1
Attribute 2
<pk>Customer_id: string
Customer_name: string
Address: string
Operation 1()
Operation 2()
creditRating ()
43
UML and ER
• UML class diagrams =~ ER diagrams
• Classes =~ Entities
Example
Create
Read
Update
Delete
Class Name
Customer
Attribute 1
Attribute 2
<pk>Customer_id: string
Customer_name: string
Address: string
Operation 1()
Operation 2()
creditRating ()
44
UML: Class Diagram
Customer
Order
name
address
0..*
1
association
Payment
date
status
calcTax
calcTotal
calcTotalWeight
1
1
1..*
aggregation
amount
line item
1..*
OrderDetail
specialization
quantity
taxStatus
Credit
number
type
expDate
Cash
cashTendered
Check
name
bankID
calcSubTotal
calcWeight
45
authorized
authorized
http://edn.embarcadero.com/article/images/31863/classdiagramno3d.gif
Download