Beruflich Dokumente
Kultur Dokumente
Page Nos.
3.0 Introduction
3.1
3.2
3.3
3.4
3.4.1
3.4.2
3.4.3
3.4.4
3.5
3.0
Class Diagram
Object Diagram
Component Diagram
Deployment Diagram
Behavioral Diagrams
3.5.1
3.5.2
3.5.3
3.5.4
3.6
3.7
3.8
39
40
40
41
47
Objectives
UML: Introduction
Object Modeling Notations: Basic Concepts
Structural Diagram
50
55
56
56
INTRODUCTION
One of the major issues in software development today is quality. Software needs to
be properly documented and implemented. The notion of software architecture was
introduced for dealing with software quality. For successful project implementation
the three essential components are: process, tools and notations. The notation serves
three roles:
Process
Tools
Object Oriented
Modeling and UML
3.1
OBJECTIVES
In this Unit we will discuss object modeling notations, structured diagrams and
behavioral diagrams of systems.
3.2
UML: INTRODUCTION
The Unified Modeling Language (UML) is used to express the construct and the
relationships of complex systems. It was created in response to a request for proposal
(RFP) from the Object Management Group (OMG). Earlier in the 1990s, different
methodologies along with their own set of notations were introduced in the market.
The three prime methods were OMT (Rumbaugh), Booch and OOSE (Jacobson).
OMT was strong in analysis, Booch was strong in design, and Jacobson was strong in
behavioral analysis. UML represents unification of the Booch, OMT and OOSE
notations, as well as are the key points from other methodologies. The major
contributors in this development shown in Figure 2.
UML is an attempt to standardize the artifacts of analysis and design consisting of
semantic models, syntactic notations and diagrams. The first draft (version 0.8) was
introduced in October 1995. The next two versions, 0.9 in July 1996 and 0.91 in
October 1996 were presented after taking input from Jacobson. Version 1.0 was
presented to Object Management Group in September 1997. In November 1997, UML
was adopted as standard modeling language by OMG. The current version while
writing this material is UML 2.0.
Booch
Rumbaugh
UML
Development
Jacobson
Mayer
Harel
Brock
Odell
Mellor
Gamma
Embley
Fusion
Figure 2: The Input for UML development
Using UML
Dynamic Model
Static Model
Class Structure
Logical Model
Object Structure
Physical Model
Module Structure
Process Structure
The Logical view of a system serves to describe the existence and meaning of the key
abstractions and the mechanism that form the problem space, or that define the system
architecture.
The Physical model describes the concrete software and hardware components of the
systems context or implementation.
UML could be used in visualizing, specifying, constructing and documenting object
oriented systems. The major building blocks of UML are structural, behavioral,
grouping, and annotational notations. Let us discuss these blocks, one by one.
a.
b.
c.
d.
3.3
Object Oriented
Modeling and UML
Message
Component
Component
Node
42
Node
Using UML
Use Case
Use Case
<<user>>
Use Case
Actor
Use Case
Use Case
Actor
Figure 9: Relationship between actor and use case
Links
Object Oriented
Modeling and UML
and attributes as shown in Figure11. Packages are used widely in a Java based
development environment. You may refer to the Unit 3 of Block 2 of the MCS-024
course for more details about packages.
Package
Name
Package Name
+Attribute 1
+Attribute 2
-Attribute 3
Figure 11: Package Diagram
<<uses>>
Use case
<<extends>>
Use case
Use case
Relationships exists in many forms. The notation for different form of relationship is
shown as:
Inheritance
Dependency
Aggregation
Containment
Association
Directed
Association
Realization
44
Using UML
Component
Component
Dependency
Component
Hospital
Node Course
Node Course
Hospital
Hospital
45
Object Oriented
Modeling and UML
The four enhancements that apply to association are name, role, multiplicity, and
aggregation. Each class participating in an association has a specific role which is
specified at the rear end of the association.
Multiplicity specifies how many objects may be connected across an instance of an
association which is written as a range of values (like 1..*). The notation for roles and
multiplicity between classes is shown as:
name
Class A
Class B
role
Class A
Class B
role
Company
* many
0.. * zero or many
1..*
1.. * one or many
Person
*
Message
A state encompasses all the properties of the object along with the values of each of
these properties.
An instance is a concrete manifestation of an abstraction to which a set of operations
can be applied and which has a state that stores the effect of the operation.
A transition is a relationship between two states indicating that an object in the first
state will perform certain action and enter the second state when a specific event
occurs and specific conditions are satisfied.
A note is a graphical symbol for rendering constraints or comments attached to an
element or collection of elements.
1)
....
46
2)
Using UML
OMT is
a)
Object Methodology Gateway
b) Objective Methodology Gateway
c)
Object Management Gateway
d) Object Management Group
...
3)
....
4)
5)
Behavioral
b)
Grouping
c)
Transactional
d)
Annotational
For object modeling some standard notations are used. Now let us discuss these basic
notations. A well-defined logical notation is important in the software development
process. It helps the software architect to clearly establish the software architecture
and implement module integration. In order to define the commonly used diagrams in
UML, it is essential to understand the basic concepts of the object modeling.
3.4
STRUCTURAL DIAGRAMS
Class Name 2
Attribute
Attribute: type
Attribute = Value
Stat Operation ()
Operation (x: T)
Operation (y): T
Attribute
Attribute: type
Attribute = Value
Association name
Rolename 1
Rolename 2
Stat Operation ()
Operation (p: T)
Operation (q): T
47
Object Oriented
Modeling and UML
If in any college, there are limited classrooms that have to be allocated to different
classes and instructors are fixed for all classes, then the class diagram for the
allocation of classrooms and instructors is shown as:
Interface Controller
Reservation Repository
CurrentUser
addreservation ()
removeReservation ()
makeweeklyschedule()
makeinstructorSchedule()
Login ()
add student ()
1
add instructor ()
makeRoomScheduler()
addRoom()
remove student ()
removeinstructor ()
removeRoom ()
Instructor
Reservation
Name class
date
1
Student
1
Name
Class
Batch
Room
1
Location
capacity
Check Class
Check Batch()
Name: Classname2
Association Name
Attribute = value
Rolename1
Attribute = value
Rolename2
Specification
Using UML
Body
Component
Component
Card Packet
Cash Disposer
ATM.scores
Card Packet
Cash Disposer
ATM.scores
Device
Name
Name
Name
Processor
49
Object Oriented
Modeling and UML
Client
application
Serial
start
ODBC
DB Server Solar
Persistence
infrastructure
e.g. container
Student
Student
database
Class
schedule
Class
database
Student
directory
Web services
Class
Management
Now you are familiar with structured diagram. To represent dynamic aspect of the
structured system, behavioral diagrams are used. In the next section, we will study
various behavioral diagrams.
3.5
BEHAVIORAL DIAGRAMS
<<include>>
Base Cases
<<extend>>
Extend Cases
Figure 26: Relationship among use cases
50
Using UML
Sequence Diagrams
A sequence diagrams are interaction diagrams that emphasize the time ordering of
messages. In UML it is shown as a table that shows objects arranged along the X axis
and messages, ordered in increasing time, along the Y axis. It has a global life line and
the focus of control. An object life line is the vertical dashed line that represents
existence of an object over a period of time. The focus of control is tall and thin
rectangle that shows the period during which an object is performing an action. The
notation for depiction of sequence among objects with certain conditions is shown as:
Role: baseClass
Message (x)
: Baseclass
BaseClass ()
: Baseclass
<<Distroy>>
Return (Y)
The sequence diagram for sending the document along the network is shown as:
Network Listener
Request Processor
File loader
CGI Script
Network Writer
Request ()
load Files ()
[Error]
send Error ()
[HTML]
send Document ()
[CGI] process ()
[Error]
send Error ()
sendDocument ()
51
Object Oriented
Modeling and UML
3.5.2.2
Collaboration Diagrams
1: y=message (x)
Role: BaseClass
The collaboration diagram for the execution using J2ME and EJB from the remote
database is shown as:
1: Request
J2ME (View)
Serviet (Controller)
6: Response
2: Request
5: Response
EJB (Modal)
3: Request
4: Response
Database
information
Figure 30: Collaboration diagram for execution using J2ME, Servlet and EJB
52
Using UML
Establish E-mail
Communication
Send E-mail
Receive
Response
Receive
Response
See Subsidiary
State
Activity Diagram
do.
UMLactivity
Activity
Diagram-Email
Encryption
else
Private
control
Wait 1 hour
after sending
send
Encrypted
Send
E-mail
E-mail
End Flow
Proper reply
Communication
Established
State
do activity
State
do activity
State
do activity
53
Object Oriented
Modeling and UML
1)
2)
3)
Object
Component
b)
d)
Collaboration
Deployment
.
.
4)
class
use case
b)
d)
object
component
5)
rectangle
ellipse
b)
d)
circle
oval
.
.
6)
initial state
final state
b)
d)
action
event
.
.
7)
class
use case
b)
d)
object
interaction
.
.
8)
Which view plays a special role integrating the contents of other views?
a)
c)
b)
d)
Process view
Implementation view
.
.
54
Using UML
3.6
Implementation
View
Analysts/Designers
Structure
Programmers Software
management
End-users
Use-Case View
Process View
Deployment View
System Integrators
Performance Scalability
Throughput
a.
Logical view
b.
Implementation view
c.
Process view
d.
Deployment view
Object Oriented
Modeling and UML
e.
For an iterative and incremental life cycle, the two criteria are time and process. The
major components of showing a project development along with time scale, inception,
elaboration, construction and transition. When the project is structured along with the
process scale, then the major steps are business modeling, requirements, analysis and
design, implementation, testing and deployment. The mapping between time and
process scale can be shown diagrammatically for more clarity.
Using UML, it is possible to generate code in any programming language from UML
model (called forward engineering) and reconstruct a model from an implementation
into UML (called reverse engineering) as show in the Figure 34 given below.
Specifies
UML Model
Object Structure
Abstract view of
Abstract view of
Programming
Language
Executing
Program
Source Code
Compile time
Run Time
1)
...
2)
...
3.7 SUMMARY
This Unit provides an introduction to the basic concept of object modeling notations.
The major diagrams used with UML have been discussed. An idea has been provided
about different views and the corresponding diagrams. This Unit only contains the
introduction of various diagrams, and the student is not expected to be an expert in
designing every diagram.
3.8
SOLUTIONS /ANSWERS
2. d)
3. c)
4. b)
56
1. a)
2. c)
3. b)
4. d)
5. d)
6 .c)
7.d)
8. a)
Using UML
0.1
Entry Manipulate
Search Phone
Book
Add New
Entry
0.1
0.1
0.1
0.1
Cell Phone
User
Edit Entry
Add New
Entry
Contact
Person
Delete Entry
0.1
Delete Entry
0.1
Edit Phone
Book Option
Please Call
Send
Message
2)
GUI
GUI
GUI
GUI
GUI
GUI
Start Program
Display login
Name Password
Logon (name pass)
Is valid-in
Database (name)
alt
true
[Is Valid =
true]
[else]
User Type
alt
Display Administrator
Interface
[(user Type)
admin]
user
Display user Interface
57