Introduction to EntityRelationship Diagrams, Data
Flow Diagrams, and UML
Todd Bacastow
Penn State University
Geography 583
Geospatial System Analysis & Design
1
Data Modeling
Data modeling – a technique for organizing
and documenting a system’s data.
Sometimes called database modeling.
Entity relationship diagram (ERD) – a
data model utilizing several notations to
depict data in terms of the entities and
relationships described by that data.
8-2
2
Data Modeling Concepts: Entity
Entity – a class of persons, places,
objects, events, or concepts about
which we need to capture and store
data.
– Named by a singular noun
8-3

Persons: agency, contractor, customer,
department, division, employee,
instructor, student, supplier.

Places: sales region, building, room,
branch office, campus.

Objects: book, machine, part, product, raw material, software
license, software package, tool, vehicle model, vehicle.

Events: application, award, cancellation, class, flight, invoice,
order, registration, renewal, requisition, reservation, sale, trip.

Concepts: account, block of time, bond, course, fund,
qualification, stock.
3
Data Modeling Concepts: Attributes
Attribute – a descriptive
property or characteristic of an
entity. Synonyms include
element, property, and field.
– Just as a physical student
can have attributes, such
as hair color, height, etc.,
data entity has data
attributes
Compound attribute – an
attribute that consists of other
attributes. Synonyms in
different data modeling
languages are numerous:
concatenated attribute,
composite attribute, and data
structure.
8-4
4
Data Modeling Concepts: Identification
Key – an attribute, or a group of
attributes, that assumes a unique
value for each entity instance. It
is sometimes called an identifier.
8-5
– Concatenated key - group of
attributes that uniquely identifies
an instance. Synonyms:
composite key, compound key.
– Candidate key – one of a
number of keys that may serve
as the primary key. Synonym:
candidate identifier.
– Primary key – a candidate key
used to uniquely identify a single
entity instance.
– Alternate key – a candidate key
not selected to become the
primary key. Synonym:
secondary key.
5
Data Modeling Concepts: Relationships
Relationship – a natural business
association that exists between one
or more entities.
The relationship may represent an
event that links the entities or merely
a logical affinity that exists between
the entities.
8-6
6
Data Modeling Concepts: Cardinality
Cardinality – the minimum and
maximum number of occurrences of
one entity that may be related to a
single occurrence of the other entity.
Because all relationships are
bidirectional, cardinality must be
defined in both directions for every
relationship.
bidirectional
8-7
7
Data Modeling Concepts: Degree
Degree – the number of entities that
participate in the relationship.
A relationship between two entities is
called a binary relationship.
A relationship between three entities
is called a 3-ary or ternary
relationship.
A relationship between different
instances of the same entity is called
a recursive relationship.
8-8
8
Why Logical System Models
• Logical models remove biases that are
the result of the way the system is
currently implemented, or the way that
any one person thinks the system might
be implemented.
• Logical models reduce the risk of missing
business requirements because we are
too preoccupied with technical results.
• Logical models allow us to communicate
with end-users in nontechnical or less
technical languages.
9-9
9
Process Modeling and DFDs
Process modeling – a technique used to
organize and document a system’s processes.
–
–
–
–
Flow of data through processes
Logic
Policies
Procedures
Data flow diagram (DFD) – a process model
used to depict the flow of data through a system
and the work or processing performed by the
system. Synonyms are bubble chart,
transformation graph, and process model.
– The DFD has also become a popular tool for
business process redesign.
9-10
10
Differences Between DFDs
and Flowcharts
• Processes on DFDs can operate in parallel (atthe-same-time)
– Processes on flowcharts execute one at a time
• DFDs show the flow of data through a system
– Flowcharts show the flow of control (sequence and
transfer of control)
• Processes on a DFD can have dramatically
different timing (daily, weekly, on demand)
– Processes on flowcharts are part of a single
program with consistent timing
9-11
11
What is the UML?
• Unified Modeling Language
• It is a modeling language, not a
process
• In 1996, work on the UML was
begun by Rational.
12
UML Diagrams
1.
2.
3.
4.
5.
6.
7.
8.
9.
Class Diagrams
Use Case Diagrams
Collaboration Diagrams
Sequence Diagrams
Package Diagrams
Component Diagrams
Deployment Diagrams
Activity Diagrams
State Diagrams
13
Class Diagrams
• Are the most fundamental UML
Diagram.
• Describe the classes in the
system, and the static
relationships between classes.
• Class diagrams are used during
Analysis, Design and
Development.
14
UML Class Diagram
Customer
1
Rental Invoice
Rental Item
1..*
1
0..1
1
Checkout Screen
DVD Movie
VHS Movie
Video Game
15
UML Class Diagram
Multiplicity
Customer
Class
Simple
1
Aggregation
Rental Invoice
Abstract
Class
Rental Item
{abstract}
1..*
1
0..1
Composition
Simple
(Dependency)
Generalization
Association
Checkout Screen
DVD Movie
VHS Movie
Video Game
16
Parts of a Class
• Classes can have
four parts
–
–
–
–
Name
Attributes
Operations
Responsibilities
• Classes can show
visibility and types.
• All parts but the
Name are
optional.
MyClassName
+SomePublicAttribute : SomeType
-SomePrivateAttribute : SomeType
#SomeProtectedAttribute : SomeType
+ClassMethodOne()
+ClassMethodTwo()
Responsibilities
-- can optionally be described here.
17
Object Diagrams
• An Object is an
instance of a class.
• Object names are
underlined.
• Object diagrams
are similar to class
diagrams. Many of
the same notations
are used.
• Object diagrams
capture instances
of classes, and
allow the dynamic
relationships to be
shown.
ThisOne : MyClassName
+SomePublicAttribute : SomeType
-SomePrivateAttribute : SomeType
#SomeProtectedAttribute : SomeType
+ClassMethodOne()
+ClassMethodTwo()
18
Class and Object Diagrams
Class Name
Association Name
Customer
Rental Item
Rents
+id:integer
+name:string
0..1
0..n +id:integer
+released:date
Class Diagram
Attributes
Object Name
Joe: Customer
Casablanca: Movie
+id:1667
+id:22340
+name:Joe Smith
+released:1942
Object Diagram
19
Use Cases
• Describe interactions between users
and computer systems (both called
actors) .
• Capture user-visible functions.
• Achieve discrete measurable goals.
• Are typically used during Analysis
and Design.
20
Use Case Diagram
Use Case
Actor
Identify Movie
Customer
Open Account
Clerk
Return Movie
In-Store
Customer
Telephone
Customer
Review
Account Status
21
Use Case Report
• The Use Case
Report provides
documentation for
the Use Case.
• A Use Case is not
complete without
the report.
• The elements of
the Use Case
Report are shown
on the right.
• Brief description
• Precondition
• Flow of events
– Main flow
– Subflows
– Alternate flows
• Postcondition
• Special Requirements
• Enclosures
– Diagrams
– Pictures of the UI
22
Collaboration Diagrams
• Collaboration diagrams describe
interactions and links
• Focus on exchange of messages
between objects
• Appears during Analysis phase
• Enhanced during Design phase
23
Collaboration Diagram - Rent Movie
:Rented
Items
1: enter_customer()
5: add(customer, movies)
8: generateRentalTotal()
Object
3: enter_movies()
2: IsValidCust(CustId)
7: print invoice()
:Check-out
Manager
:Customer
:Clerk
4:GetMovieByBarcode()
:Invento
ry
Message
24
Sequence Diagrams
• Can be “morphed” from Collaboration
Diagrams.
• Describe interactions between objects arranged
in time sequence
• Focus on objects and classes involved in the
scenario and the sequence of messages
exchanged
• Associated with use cases
• Used heavily during Analysis phase and are
enhanced and refined during Design phase
25
Sequence Diagram - Rent Movie
:CheckoutMgr Cust:Customer
:
:Inventory
:RentedItems
Employee
1: find customer()
2: search (string)
3: enter movie()
4: search (string)
Object
Activation
Message
5: rent (movie)
6: add(Cust, item)
Lifeline
7: printInvoice()
8: generateRentalTotal()
26
Package Diagram
Clerk User Interface
Customer Data
Class
«facade»
Business
System
Client
Rental Screen
(to business
system)
Package
27
Component Diagram
Component
«library»
DB Server
Interface
(dbsvr.dll)
«library»
Application
Framework
(appfr.dll)
Interface
Dependency
«application»
Video
Workstation
(vstation.exe)
Note
Supplied by
Microsoft
28
Deployment Diagram
Node
Communication
Association
Phone Clerk Terminal
:Clerk Client
Check Out Terminal
:Clerk Client
:Store Server
Server
DB
«TCP/IP»
«TCP/IP»
Store
Server
App
29
Activity Diagram
Start State
Action State
Identify
Caller
Obtain Name
& Address
Current
Customer?
Decision
Open
Account?
[no]
[no]
[yes]
[yes]
End State
Create
Account
30
Swimlanes and Fork/Join Points
Customer
Identify
Movie
Manager
Walking Clerk
Fork Point
Place
Order
Place
Order
Pay
Collect
Money
Pickup
Movie
Deliver
Movie
Fill
Order
Join Point
31
State Diagram
Guard
Event
Transition
[more videos]
/get next video
customer appears
Validate
do/check
account
[account valid]
/get first video
Activity
State
[account not
valid]
Check-Out
do/check-out
video
Action
[no more videos]
Check-Out
Complete
32
UML Diagram Usage
Development
Phase
UML Diagrams
Analysis
Use Cases, Class Diagrams, Activity
Diagrams, Collaboration Diagrams,
Sequence Diagrams
Class Diagrams, Collaboration
Diagrams, Sequence Diagrams, State
Diagrams, Component Diagrams
Deployment Diagrams
Collaboration Diagrams, Sequence
Diagrams, Class Diagrams, State
Diagrams, Component Diagrams,
Deployment Diagrams
Package Diagrams, Deployment
Diagrams
Design
Development
Implementation
33
Conclusion
• UML is a robust notation that can express
information gathered throughout a
project’s lifecycle.
• Adopting standard use of UML can
improve communication between clients
and developers.
• UML can be used as an effective data
modeling tool as well as an object
modeling tool.
34
Descargar

Introduction to UML - Pennsylvania State University