Database Reference
In-Depth Information
UML includes several types of diagrams, each with its own special purpose. Figure 9-23 describes the pur-
pose of some of the most commonly used UML diagrams.
Diagram Type
Description
Class
For each class, shows the name, attributes, and methods of the class, as well
as the relationships between the classes in the database.
Use Case
Describes how the system is to behave from the standpoint of the
system's users.
State
Shows the possible states of an object. (For example, an order could be in
the placed, open, illed, or invoiced states.) Also shows the possible transi-
tions between states (for example, placed→open→illed→invoiced).
Sequence
Shows the sequence of possible interactions between objects over time.
305
Activity
Shows the business and operational step-by-step worklows of components
in a system.
Component
Complex software systems are usually subdivided into smaller components.
This type of diagram shows these components and their relationships with
each other.
FIGURE 9-23
UML diagrams
The type of diagram most relevant to database design is the class diagram. Figure 9-24 shows a sample
class diagram for the Premiere Products database. A rectangle represents a class. The top portion of a rectangle
contains the name of the class, the middle portion contains the attributes, and the bottom portion contains the
methods. The lines joining the classes represent the relationships and are called associations in UML.
Rep
#RepNum : char(2)
#LastName : char(15)
#FirstName : char(15)
#Street : char(15)
#City : char(15)
#State : char(2)
#Zip : char(5)
#Commission : decimal(7,2)
#Rate : decimal(3,2)
+AddRep( )
+DeleteRep( )
+ChangeAddress( )
+ChangeRate( )
+ChangeCommission( )
Name of class
Part
#PartNum : char(4)
#Description : char(15)
#OnHand : decimal(4,0)
#Class : char(2)
#Warehouse : char(1)
#Price : decimal(6,2)
+AddPart( )
+DeletePart( )
+ChangePartData( )
+ChangeOnHand( )
+ChangePrice( )
Customer
#CustomerNum : char(3)
#CustomerName : char(35)
#Street : char(15)
#City : char(15)
#State : char(2)
#Zip : char(5)
#Balance : decimal(8,2)
#CreditLimit : decimal(8,2)
+AddCustomer( )
+DeleteCustomer( )
+ChangeAddress( )
+ChangeCreditLimit( )
+ChangeBalance( )
Attributes
Data types
Methods
(operations)
1..1
0..n
1..1
Multiplicity (cardinality)
1..1
Orders
#OrderNum : char(5)
#OrderDate : date
+AddOrder( )
+DeleteOrder( )
+ChangeOrderDate( )
0..n
OrderLine
#NumOrdered : decimal(3,0)
#QuotedPrice : decimal(6,2)
+AddOrderLine( )
+DeleteOrderLine( )
+ChangeOrderLine( )
0..n
1..1
Association
(relationship)
1..n
FIGURE 9-24
Class diagram for the Premiere Products database
Search WWH ::




Custom Search