system modelling with objectives describe unified modeling language (uml) in the context of...
TRANSCRIPT
System Modelling with
objectives
Describe Unified Modeling Language (UML) in the context of Requirements Specification
Re-visit use case, class, object and sequence diagrams
Describe collaboration, statecharts, activity, component and deployment diagrams
Modelling with UML 2
Popular Design and Modelling Tool
• Large systems are easier to understand when you break them down into subsystems
• Good modelling techniques are increasingly important as the size and complexity of systems increase
• Good models promote communication among technical and non-technical workers while ensuring good solutions
requires organisation and planning
• An Object-oriented perspective.
Modelling with UML 3
About it…
• Was created at Rational Software by Booch, Jacobson, and Rumbaugh. The Object Management Group adopted UML as a standard in 1997.
• Is a standard way to specify, construct, and document systems that use OO methods
• Systems you model may be implemented in an OO programming language like Java, C++, C#
• As with flowcharts, pseudocode, hierarchy charts and class diagrams, UML has its own conventions and symbols
• You can the entire specification and usage guidelines from the OMG at www.omg.org/uml/
Modelling with UML 4
UML Diagrams
• Use to create top view diagrams of business processes that let you hide detail and focus on functionality
• Useful with customers who are not technically oriented
• Each type of diagram allow you to see a process from a different angle
• Diagram Types:– Use case diagrams– Class diagrams– Object diagrams– Sequence diagrams– Collaboration
diagrams– Statechart diagrams– Activity diagrams– Component diagrams– Deployment diagrams
Modelling with UML 5
UML diagrams classification
• Those that illustrate the dynamic, or changing, aspects of a system, and
• Those that illustrate the static, or steady aspects of a system
• Dynamic:– Use case diagrams, – Sequence diagrams, – Collaboration diagrams, – Statechart diagrams, – Activity diagrams
• Static:– Class diagrams, – Object diagrams, – Component diagrams, – Deployment diagrams.
Modelling with UML 6
Use case Diagrams
• Shows how a system works for the perspective of those who approach it from the outside or use it
• This includes many types of uses:– Employees, customers, suppliers– Governments, private organisations,
machines or other systems– Easier to think of them as users,
hence the term actors
Modelling with UML 7
Use case diagram for Librarian
• Represent system functions or services that are visible to the actor• Represent cases for which actors interact with system or benefit
from it• Determining all cases help divide a system logically into functional
parts• Establishing use cases usually follows from analysing the main
events in a system
acquireNewBook()
checkOutBook()
librarian
Modelling with UML 8
Variations of use cases
• Extend– Is a use case that shows functions beyond those
found in the base case
• Include– When a use case can be part of multiple use cases
(similar to subroutine or submodule)
• Generalisation– When a use case is less specific that others and you
want to be able to substitute the more specific for a general one
Modelling with UML 9
<<Extend>>
• Example:– Checking out a book for a new library user is
slightly more complicated that checking a book out for an existing user
acquireNewBook()
checkOutBook()checkOutBookfo
rNewUser()<<extend>>
librarian
Modelling with UML 10
<<include>>
• Example:– Issuing a library card might be a function of
checkOutBook() when library user is new– It might also be a function of registerNewUser()
acquireNewBook()
checkOutBook()checkOutBookfor
NewUser()<<extend>>
registerNewUser()
issueLibraryCard()
<<include>><<include>>
librarian
Modelling with UML 11
Use case diagram for Librarianwith Generalisations
• Example:– A librabry has procedures for acquiring new material,
acquireNewItem() is a generalisation of acquiring specific items
acquireNewBook()
checkOutBook()checkOutBookfor
NewUser()<<extend>>
registerNewUser()
issueLibraryCard()<<include>>
<<include>>
librarian
acquireNewVideo()
acquireNewJournal()
Modelling with UML 12
Use case diagram for Librarianwith multiple actors
• Example:– A library clerk cannot perform as many functions as a librarian; the clerk can
check out books and register new library users but cannot acquire new materials.
acquireNewBook()
checkOutBook()checkOutBookfo
rNewUser()<<extend>>
registerNewUser()
issueLibraryCard()<<include>>
<<include>>
librarian acquireNewVideo()
acquireNewJournal()
clerk
Modelling with UML 13
Use case diagram emphasizing actors
checkOutBook()
librarianclerk
Library staff
Library user
Adult userchild user
Cooperating library
checkOutVideo()
checkOutReferenceMaterials()
Modelling with UML 14
Use case diagram emphasizing System Requirements
checkOutMaterials()
Library staff
Library user
Cooperating library
RemoveOldMaterialsFromSystem()
acquireNewMaterials()
Library System
reshelveReturnedMaterials()
Modelling with UML 15
Class and Object Diagrams
• You can use a class diagram to illustrate the names, attributes, and methods of a class or a set of classes
• Class diagrams are more useful to programmers (than users) because they resemble code to be developed
LibraryItem
idNum
Title
author
create()
getInfo()
Book
author
create()
getInfo()
Video
runningTime
create()
getInfo()
rewind()
Showing Generalisation
Modelling with UML 16
Class Diagram with association relationship
• An association relationship describes the connection or link between objects that often includes information about cardinality
• Example: – one Library object
exists and it can be associated with any number of LibraryItem and LibraryUser. A LibraryUser can borrow up to 5 items.
LibraryItem
idNum
Title
create()
getInfo(idNum)
LibraryUser
idNum
Name
Address
create()
getInfo(idNum)
borrowItem()
Library
Name
directorName
Address
phoneNumber
create()
getInfo()
1 0..*
1
0..*
0..5
0..1
Modelling with UML 17
Class Diagram with whole-part relationship
• A whole-part (has-a) relationship describes an association in which one or more classes make up parts of a larger class (aggregation)
Library
Name
directorName
Address
phoneNumber
create()
getInfo()
PersonnelDept
deptName
Director
phoneNo
ReferenceDept
deptName
Director
phoneNo
Modelling with UML 18
Object Diagrams
• Are similar to Class Diagrams, but they model specific instances of classes
LibraryItem
idNum: 23456
Title: Software Engineering
LibraryUser
idNum: 19564
Name: Rana Salah
Address: XXXX
Library
Name: University of Khartoum
directorName: Mustafa Deng
Address: Gam3a Street
phoneNumber: 83 777777
create()
getInfo()
Modelling with UML 19
Sequence and Collaboration Diagrams
• You use a sequence diagram to show the timing of events in a single use case– the x-axis represents objects, starting from left with object or
actor that begins the action– Vertical lines represents the period of time the object
exists– the y-axis represents time, horizontal lines along it show
how objects communicate• Collaboration diagrams emphasize the organisation of
objects that participate in a system– Similar to sequence diagrams except that it contains sequence
numbers to represent the precise order of activities– They show the relationships between the objects and the order
of messages passed between them
Modelling with UML 20
Sequence of events from sequence diagram
BookCheckOutRecord LibraryUser Book
create(User idNum,
Book idNum
getInfo(idNum)
(userInfo)
getInfo(idNum)
(bookInfo)
(checkOutRecord)
Librarian
1.
2.
1.1
1.2
1.3
1.4
Modelling with UML 21
Example: Collaboration Diagram
• Collaboration diagram uses the free-form arrangement of objects as found in an Object diagram, it is a cross between an object diagram and a sequence diagram. The diagram makes it easier to see all interactions involving a particular object.
BookCheckOutRecord
LibraryUser Book
1. create(User idNum, Book idNum
1.1 getInfo(idNum) 1.2 userInfo()
1.3 getInfo(idNum)
1.4 bookInfo()
2. checkOutRecord()
Librarian
Modelling with UML 22
Statechart Diagrams
• These show statuses (changes in behaviour) of a class or object at different points in time.
• Example:State diagram for class Book
not borrowablereturned()
returned()
borrowable
borrowed()[not last copy]
borrowed()[last copy]
guard expression
……
Modelling with UML 23
Activity Diagrams
• Resembles flowcharts showing the flow of actions of a system:– Uses flowchart start and stop symbols– Use empty diamonds to represent decisions
userRequest()
retrieveBook()contactInterLibraryLoan()
checkOutBook()
Library Owns BookLibrary doesn’t Own Book
Modelling with UML 24
Activity Diagrams: Fork and Join
• Many real-life systems contain activities that occur simultaneously– A fork is similar to decision but defines all branches– A join reunites control flow after a fork
memberLibraryRequestBook()
querySudanULibrary()queryGezeriaULibrary()
sendBookToRequestingLibrary()
queryJubaULibrary()
Modelling with UML 25
Component and Deployment Diagrams
• These model physical aspects of systems:– Component diagrams
emphasize the files, database file, documents, and other components that a system’s software uses
– Deployment diagrams focus on a system’s hardware
• You use a variety of icons to symbolize software or hardware components.
• Examples:
Internet Request
Server
Printer
Console
Table
Database
Modelling with UML 26
Example: Component DiagramInternet RequestInternet Request
DatabaseFilled when a part can belong
to only one whole at a time;
Open when it can belong
to several
Library User
table
Book
table
Modelling with UML 27
Example: Deployment Diagram
InternetInternet
Console Console Console
Printer
Server A Server B
Modelling with UML 28
Component Diagrams in Design and Implementation
• Describes the dependencies between various software components, such as executable files, documents, and source files.– A component is represented using a rectangular box,
with two rectangles protruding from the left side
– A Dependency is used to model the relationship between two components. The notation for a dependency relationship is a dotted arrow, pointing from a component to the component it depends on.
Component
Modelling with UML 29
Deployment Diagrams in Design and Implementation
• Models the hardware used in implementing a system and the association between those hardware components. Components can also be shown on a Deployment diagram to show the location of their deployment. – A node represents a piece of hardware in the system.
This entity is represented by a three-dimensional cube.
– An association, drawn as a solid line between two Nodes, indicates a line of communication between the hardware elements.
Node name
Modelling with UML 30
Examples
Deployment diagram:• showing that the
SiteConfig component is deployed onto the Web Server and the BaseDB component is deployed on an App Server. You can also determine that the Web Server communicates with the App Server, and the App Server communicates with the Database Server and a Printer.
Modelling with UML 31
Examples
• Component diagram: identifies the MyWebComps assembly as being dependent on the BaseDB and SiteConfig source files.
• You can use stereotyped icons for components instead of the standard icon
Modelling with UML 32
Deciding which UML Diagrams to use
• Each provide a different view of a system
• Different users have different preferences
• The most important reason you use any diagram is to communicate clearly and efficiently with the people for whom you are designing the system