Professional Documents
Culture Documents
Introduction to UML
UML is a language used for visualizing, specifying, constructing and documenting the artifacts of
software intensive system.UML makes a clear conceptual distinction between models, views and
diagrams.
A Model is an element that contains information for a software model.
A View is a visual expression of the information contained in a model, and
A Diagram is a collection of view elements that represent the user’s specific design thoughts.
UML is a language used for visualizing, specifying, constructing and documenting the artifacts of a
software intensive system.
A Modeling Language:
UML provides the vocabulary and the rules for communication and focus on conceptual and physical
representations of the system. So it is a modeling language.
UML Visualizes:
UML includes both graphical and textural representation and makes easy to visualize the system and
for better understanding.
UML specifies:
UML addresses the specification of all the important analysis, design implementation decisions,
developing and deploying a software intensive system.
UML Constructs:
UML models can be directly connected to a variety of programming languages. And it is sufficiently
expressive and free from any ambiguity to permit the direct execution of models, simulation of
systems, and the instrumentation of running systems.
UML Documents:
UML produces variety of documents, in addition to raw executable code, the aircrafts include
requirements, Architecture, Design, Source code, Project Plans, Test, Prototypes, Releases.
Things
Relationships
Diagrams.
Things in UML :
Structural Things
Classes
Interfaces
Collaborations
Use Cases
Active Classes
Components
Nodes Classes
Behavioral Things
Interactions
State Machines
Grouping Things
Packages
Annotational Things
Notes
Relationships in UML:
Dependency
Association
1. Aggregation
2. Composition
Generalization
Realization
Diagrams in UML:
Class Diagram
Object Diagram
Usecase Diagram
Sequence Diagram
Collaboration Diagram
Statechart Diagram
Activity Diagram
Component Diagram
Deployement Diagram
Requirements Analysis
o Use-case diagrams
Analysis
o Class Diagrams, Dynamic Model
Design
Additional Classes etc., Technical Infrastructure
Programming
o Convert classes from design to actual code in OOPL
Unit Testing - Class diagrams and specifications
Integration Testing - Component and Collaboration diagrams
System Testing - Use-case diagrams
Class: A class is the descriptor for a set of objects with similar structure, behavior, and
relationships. It is represented by a rectangle.
Relations:
Association
Dependency
Generalization
Realization
In addition to this there are
Directed Association
Aggregation and
Composition
Association:
An association is a structural relationship that specifies the relation between two objects
when they are at the same level (peer level systems).
An Association can specify the relationship, role of the class and Multiplicity.
An Association used in class diagram, Component diagram, deployment
diagram, usecase diagrams.
The multiplicity can be represented as 1-1..*,*,0…1.
It is represented as follows:
Directed Association:
Symbol:
Aggregation:
Symbol:
Composition:
Generalization:
Generalization is a specification relationship in which objects of the specialized element (the child )
are substitutable for objects of the generalization element (the parent).It is used in class diagram.
Symbol:
Dependency:
A dependency is a semantic relationship in which if there is any change occurred in one object that
may effect other object.
Realization:
Realization is a Specified tool that can be represented by providing a relationship with classifier.
Symbol:
----------------------------------------------
Class diagrams:
A class diagram is that which represents a set of classes, interfaces, and collaborations and their
relationships, graphically a class diagram is a collection of vertices and arcs.
<Attributes>
<Operations>
Uses:
An object diagram shares the same common properties of all other diagrams.
Name
Attributes
Uses:
Operations
An object diagram is used to model the static design view of a system.
UseCase Diagrams:
A usecase diagram shares the common properties as all diagrams. It distinguishes in the contents of
use cases, actors, dependency, and generalization relationships.
Actor
Uses:
Interaction Diagrams:
An Interaction diagram shares the same common properties as all other diagrams. It differs in its
contents
Objects
Links
Messages
Sequence Diagrams:
A sequence diagram emphasizes the time ordering of messages. Sequence diagrams have two
features that distinguish them from collaboration diagrams.
Collaboration Diagrams:
Collaboration diagrams have two features that distinguish them from sequence diagrams.
(i)Path
(ii) The Sequence number
Object: It is an instance of a class.
Symbol:
Object name
Call:
Send:
Return: ------------------------------------------
Create:
<<create>>
Destroy:
<<destroy>>
Uses:
Interaction diagrams are used to model the dynamic aspects of a system. It is obtained in two ways:
State: A state is a condition during the life of an object or an interaction during which it satisfies
some condition, performs some action, or waits for some event. It is represented by a rounded
rectangle.
Symbol:
State Name
Sub machine State: A submachine state is a syntactical convenience that facilitates reuse
and modularity. It is a shorthand that implies a macro-like expansion by another state
machine and is semantically equivalent to a composite state.
Symbol:
Initial State:
Final State: A final state represents the last or "final" state of the enclosing composite state.
There may be more than one final state at any level signifying that the composite state can
end in different ways or conditions. When a final state is reached and there are no other
enclosing states it means that the entire state machine has completed its transitions and no
more transitions can occur.
Symbol:
Symbol:
Transition: A transition is a directed relationship between a source state vertex and a target
state vertex. It may be part of a compound transition, which takes the state machine from one
state configuration to another, representing the complete response of the state machine to a
particular event instance.
Symbol:
Activity Diagram:
Action State: An action state represents the execution of an atomic action, typically the
invocation of an operation. An action state is a simple state with an entry action whose only
exit transition is triggered by the implicit event of completing the execution of the entry
action. The state therefore corresponds to the execution of the entry action itself and the
outgoing transition is activated as soon as the action has completed its execution.
Symbol:
Sub Activity State: A sub activity state represents the execution of a non-atomic sequence of
steps that has some duration; that is, internally it consists of a set of actions and possibly
waiting for events. That is, a sub activity state is a hierarchical action, where an associated
sub activity graph is executed.
Symbol:
Initial State: An initial is a kind of pseudo state that represents the starting point in a region
of a state machine. It has a single outgoing transition to the default state of the enclosing
region, and has no incoming transitions. There can be one (and only one) initial state in any
given region of a state machine. It is not itself a state but acts as a marker.
Symbol:
Final State: A final state represents the last or "final" state of the enclosing composite state.
There may be more than one final state at any level signifying that the composite state can
end in different ways or conditions. When a final state is reached and there are no other
enclosing states it means that the entire state machine has completed its transitions and no
more transitions can occur.
Symbol:
Symbol:
Symbol:
Deployment Diagrams:
Package: A package is a grouping of model elements. Packages themselves may be nested within
other packages. A package may contain subordinate packages as well as other kinds of model
elements. All kinds of UML model elements can be organized into packages.
Symbol:
Symbol:
Node Name
Symbol:
Node Name
With growing usage of the Internet, people are utilizing the convenience of online
shopping and the ability to place an order for what they want at all hours of the day and night, at the
office, home, airport, a cafe, or just about anywhere you can imagine. They want conveniences of
Internet communications to help them improve their productiveness in the day to day balance
between work and personal life. While ATM's have added some convenience to our lives. By using
ATM’s we can make payment transaction at anytime from anywhere.
System
verification
Bank
managedatabase
invalid PIN
<<extend>>
transcation
<<extend>>
invalid client
ACTORS:
1. BANKCLIENT: the bank client is a primary actor which having an ATM card.
2. ATM MACHINE: The ATM machine is a primary actor which is used to
Perform the online transaction. It is an intermediate
between the bank client and bank.
3. BANK: The Bank is a second actor which will verify the bank client account
and also manages the database.
USE CASES SPECIFICATION OF TRANSACTION:
The use case transaction performs the ATM transaction whenever cardholder is valid. It
contains another use cases like deposited, withdrawal & balance enquiry.
I) MAIN FLOW OF EVENTS:
The bank client must be valid person and have a valid PIN number.
II) EXCEPTION FLOW OF EVENTS:
The bank client is an invalid person.
The client had entered the invalid PIN number.
III) PRECONDITION:
The client must already have an account in the Bank.
IV) POSTCONDITION:
The account database of client is modified after transaction.
id()
I) PERSISTENCE CLASSES:
1 : Insert ATMcard()
2 : Request PINnum()
3 : Enter PINnum()
4 : verify PINnum()
5 : valid PIN()
6 : Request amount()
7 : Enter amount()
8 : withdraw checking()
9 : withdraw successfully()
11 : dispense cash()
12 : print reciept()
13 : terminate() <<destroy>>
Insert atmcard
[invalid]
[verification report]
[valid]
give recipt
close transcation
ideal
Insert card
Active
cancel
maintainance
[continue]
selecting processing
[not continue]
printreciept
entry/readcard
exit/ejectcard
RS-232
Bank
ATM.exe
This Library Management System is used accomplish the tasks like ‘issue ‘, ‘return’, ‘renewal’
the book to the library. To computerize the library system, it should validate the students, staff,
etc...By entering the student_id, and staff_id they used to log into the system.
The library has several volumes of books, journals, magazines, news papers so, this system
should maintain the library database and also it should maintain the student, staff database for
validating them.
To full fill these requirements we can to design this system by making use of the UML
diagrams for better understanding the specifications.
The Library Information System is a stand alone system based application used to automate a library.
This system is used by registered users like staff and students.
To borrow the items from library member have option to Enquiry about that item.
The member must confirm the require book is available before borrowing.
The member must reserve book to borrow.
The member got penalty when the period of time is over.
The Librarian can lend the books to registered members.
The Librarian can take books back when members return books.
The Librarian can renew books to members account.
The Librarian can remove reservation of books.
Actors
Staff:-Interactive actor who uses the library to Enquire, Borrow books, applies for Reserve
books and Pay fine.
Librarian:-Interactive actor responsible for Lending articles, Return articles, Renew books
and Remove reservations.
Student:-Interactive actor who uses the library to Enquire, Borrow books, applies for
Reserve books and Pay fine.
Usecases:
For Library system, we can find the following use-cases:
Enquiry
Borrow books
Reserve books
Pay fine
Lending article
Return article
Renew books
Remove reservation
Usecase Diagram
Usecase Descriptions
Alternative Flows
System displays ‘there is no related books/articles in library”.
Preconditions
Member must get memberid from librarian before using the system.
Post-conditions
Member got list of related book information if available, otherwise gives related message.
2. Use-Case Specification: Borrow books
Description
The member wants to borrow books from library through librarian and register it.
Flow of Events
Basic Flow
The librarian can give book if it is available.
Alternative Flows
1. The librarian can’t give books if member cross borrowing limit.
Preconditions
The member must confirm that book is available or not in library.
Post-conditions
The librarian can register the information about borrowing book.
3. Use-Case Specification: Return books
Description
This usecase starts when the user wants to return the borrowed book.
Flow of Events
Basic Flow
Member who borrowed the book is going to return the book.
Alternative Flow
Member is going to penalty when time period is over.
Pre condition
Member has check the time period from the time of borrowing.
Post condition
None.
4. Use-Case Specification: Lending Articles
Description
Librarian is lending the articles to members when they require.
Flow of Events
Basic flow
Librarian checks reservation list from system and lend articles to members.
Alternative flow
None.
Pre condition
Member has provided borrowing book information.
Post condition
Librarian can update article information.
5. Use-Case Specification: Renew books
Description
This usecase is starts when member wants to extends his issue time.
Flow of Events
Basic Flow
Member has the same book by renewing.
Alternative Flow
Member has return book
Pre condition
Member must check time period from issued date.
Post condition
Librarian updates issued list, member gets same copy.
6. Use-Case Specification: Reserve books
Description
This use-case starts when the user wants to make a reservation for an item
Flow of Events
Basic Flow
1. Member who wants to borrow the book, he gives the information about that book.
2. The system marks the item as reserved and associates the borrower with the reservation
Alternative Flows
Member is unable to get book. Re applies for reserve the book.
Pre-conditions
The borrower is viewing a particular title with an item that is not currently available
Post-conditions
The item is marked as reserved and the reservation is saved in the database
Class diagram
Sequence Diagram
Activity diagram
Component Diagram
Deployment Diagram
Aim: To design UML diagrams for Online Book Shop, and the functions takes place in the
application.
Usecase diagram:-
1:login()
2:enter username/password
3:authenticatio
5:valid
6:invalid
7:error message
8:relogin
1:request id
2:enter id
3:verification
4:invalid
5:errormesage
6:re_enterid
7:verified
8:generate reports
2:verify
4:error message
5:verified
6:retrieve data
2:add books
sequence
diagram
3:update books
sequence
diagram
4:delete books
sequence
diagrams
3:verification
5:error message
6:filled property
7:generate id
2:selecting book
3:intimate database
4:retrive data
5:modify
6:verification
7:improper
8:error message
1:select book
2:retriving data
3:deleting
4:update()
1: login()
mainform
8: relogin
3: authentication
7: error m es s age
6: invalid
5: valid
databas e
2: enter id
6: re_enter id 3: verification
administrator mainform controller
1: requestid
8: generate reports
database
7: verified
4: invalid id
5: error message
errormessage
6: retrieved data
database 5: verified
3: not filled properly
4: error message
error
message
manager option
1: to avail option
2: add books
3: update books
4: delete books
book profile
form
7: generate id
database
6: filled properly
errormessage
2: selecting book
manager selector modification
form controller
1: request to select book
6: verification
5: modifying
3: intimate database
modification
form
1: select book
manager selector
form
3: deleting
2: retriving data
4: update()
deletion database
form
Reservation counter.
Identification of actors:
The actors in the system are the passenger, the counter clerk and the reservation
system consisting of form processing, reservation, canceling issued ticket, ticket printing and
updating etc.
Use cases:
System
Passenger CounterClerk
Availability status
Passenger
Print ticket Counter Clerk
System
Counter Clerk
Cancels ticket
Class diagram
Passenger
Clerk
+Name
+Gender +Name
+Age +Gender
+Address +Age
0..* 1..*
+fillForm() +getDetails()
+payFareAmount() +getFareAmount()
+collectTicket() +getTicket()
1 1
1
Reservation System
+processForm()
+reservation()
+fareComputation()
+processTicket()
+printTicket()
1..*
Payment
CreditPayment CashPayment
Interaction diagrams
Sequence diagram
1 : requestForm()
2 : givesForm()
3 : returnsFilledForm()
4 : entersDetails()
5 : checksAvailability()
6 : fareamount
7 : paysAmount()
8 : triggersTicket()
9 : printTicket()
10 : issueTicket()
11 : updates()
Collaboration diagram
1 : requestForm() 4 : entersDetails()
2 : givesForm() 5 : checksAvailability()
3 : returnsFilledForm() 8 : triggersTicket()
: passenger : clerk : reservation system
6 : fareamount 9 : printTicket()
7 : paysAmount() 11 : updates()
10 : issueTicket()
Activity diagrams
Available
Prints Tickets
Not ok
[Form modified] Ok Not [Issue Tickets]
Ok
Ok
[Collect Amount]
Component diagram
reservation.exe
Reservation form
<<artifact>>
update.exe
cancellation.exe
Cancellation form
Deployment diagram
Kiosk
Usecase Diagram:-
Activity Diagram:-
7 Design Problems:
A solution is to configure the RTF Reader class with a TextConverter object that
converts RTF to another textual representation. As the RTF Reader parses the RTF
document, it uses the TextConverter to perform the conversion. Whenever the
RTFReader recognizes an RTF token , it issues a request to the TextConverter to convert
the token. TextConverter objects are responsible both for performing the data conversion
and for representing the token in a particular format.
The builder pattern captures all these relationships. Each converter class is called
a builder in the pattern, and the reader is called the Director. The builder pattern
separates the algorithm for interpreting a textual format from how a converted format gets
created and represented. This lets us reuse the RTFReader’s parsing algorithm to create
different text representations from RTF documents—just configure the RTFReader with
different subclasses of TextConverter.
The Bridge pattern addresses these problems by putting the Window abstraction
and its implementation in separate class hierarchies. There is one class hierarchy
for window interfaces (Window, IconWindow, TransientWindow) and a separate
hierarchy for platform-specific window implementations, with WindowImp as its root.
The XWindowImp subclass, for example, provides an implementation based on the X
Window System.
Use Decorator
1. When more than one object may handle a request, and the handler isn't known a
priori. The handler should be ascertained automatically.
2. When you want to issue a request to one of several objects withoutspecifying
the receiver explicitly.
3. When the set of objects that can handle a request should be specified
dynamically.