0% found this document useful (0 votes)
35 views81 pages

SE UML Module 5

The document covers Module-5 of a Software Engineering course, focusing on object modeling using UML and object-oriented software development methodologies. It explains key concepts such as objects, classes, inheritance, polymorphism, and encapsulation, along with the advantages of object-oriented design. Additionally, it details the use of UML for modeling systems and provides examples, including a supermarket prize scheme, to illustrate the application of these concepts.

Uploaded by

21053225
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views81 pages

SE UML Module 5

The document covers Module-5 of a Software Engineering course, focusing on object modeling using UML and object-oriented software development methodologies. It explains key concepts such as objects, classes, inheritance, polymorphism, and encapsulation, along with the advantages of object-oriented design. Additionally, it details the use of UML for modeling systems and provides examples, including a supermarket prize scheme, to illustrate the application of these concepts.

Uploaded by

21053225
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 81

Software Engineering

Module-5

Faculty :
Dr. Suchismita Rout
Associate Professor
1
Module-4 Contents

 Object Modeling Using UML:


 Object-Orientation Concepts
 Unified Modeling Language (UML)

 UML Models:
 Use Case Model, Class Diagram, Interaction Diagrams,
Activity Diagram, State Chart Diagram, Package, Component
and Deployment Diagrams

 Object-Oriented Software Development:


 OOAD Methodology
2
Introduction

 Object-oriented approach is a widely used


approach to s/w development
 In OO Approach, the problem domain is divided into
 A set of objects
 Each object has specific attributes
 A set of operations are defined on it
 The objects collaborate or communicate through
messages for accomplishing some result

3
Introduction

 The methodology of modeling a system from ‘object


oriented point of view’ is called :
Object modeling
 Steps
1. OO Analysis - Identify objects & classes in the
problem domain
2. OO Design – Create the architecture, interfaces &
component-level details
 Produce UML diagrams
4
UML

 Unified Modelling Language (UML) is a


modelling language

 Like DFD, it provides :


Set of notations/ symbols/ guidelines for
creating model of a system

 These Models document the results of OOA &


OOD
5
Object-oriented Concepts

 Basic Mechanisms

 Object

A real-world or conceptual entity


A system is designed as a set of interacting
objects
Consists of data (attributes) & functions
(methods) that operate on data
Hides internal information (Data abstraction)

Ex: an employee, a book, a scheduler etc..


6
Object-oriented Concepts

 Class

An object is an instances of a class


Contains generic behaviour of some objects
It is a template for object creation

Ex: set of all employees, different types of book

Sometimes not intended to produce instances


(abstract classes)
7
Object-oriented Concepts

m8 m7
mi are methods
of the object

m1 m6
Data
m2 m5

Object

m3 m4
Model of an object

8
Object-oriented Concepts

 Methods & messages

 Operations supported by an object

 The manipulation the data of other objects


 Is done by sending message

 Ex: calculate_salary(), issue-book(),


member_details() etc.

9
Object-oriented Concepts
 Inheritance
 Allows to define a new class (derived class) by extending /
modifying existing class (base class)
 Represents Generalization-specialization relationship
 Allows redefinition of the existing methods (method
overriding)

LibraryMember Base Class

Derived
Faculty Students Staff
Classes

UnderGrad PostGrad Research


10
Object-oriented Concepts
 Multiple Inheritance
 Subclass can inherit attributes /methods from more than one
base class
 Multiple inheritance is represented by arrows drawn from the
subclass to each of the base classes

LibraryMember Base Class

Faculty Students Staff

Multiple
Inheritance

UnderGrad PostGrad Research


11
Object-oriented Concepts

 Abstraction
Consider relevant aspects only
Suppress non-relevant aspects

 Advantages of abstraction
Reduces complexity of software
Increases software productivity

12
Object-oriented Concepts

 Encapsulation

 Object’s data & methods are encapsulated within


itself
 Not directly accessible to other objects

Objects communicate outside world through


messages

13
Object-oriented Concepts
 Polymorphism
 Denotes to poly (many) morphism (forms)
 Same Method call results in different actions
(static binding) based on signature

 Ex
 Class Circle{
 private float x, y, radius;
 private int fillType;
 public create ();
 public create (float x, float y, float centre);
 public create (float x, float y, float centre, int fillType);
 } 14
Object-oriented Concepts

Shape

Circle Rectangle Line

Ellipse Square

Cube

Class hierarchy of geometric objects

15
Advantages of Object-oriented
design

 Code and design reuse

 Increased productivity

 Ease of testing & maintenance

 Better understandability

 Initially incur higher costs, but afterwards substantial


reduction in cost

 S/W dev cost reduces to 20-50% of traditional cost


16
Object modelling using UML

 UML is a language for creating OO models of a


system

 It is the output / result of

 Object-oriented analysis & design phase

17
Object modelling using UML

 Object modelling can be done using many


methodologies:

OMT [Rumbaugh and Blaha 1991]


Booch’s methodology[Booch 1991]
OOSE [Jacobson 1992]
Odell’s methodology[Odell 1992]

18
OMT has profound impact on UML

OMT

UML
Booch
OOSE Methodology

Impact of Different object modeling techniques on UML

19
Object-oriented
Analysis & Design (OOAD)

20
Object-oriented
Analysis & Design Process

User interface
Use case Interaction
or GUI
diagram diagram
prototype

Start

SRS document Domain model Class diagram Code

Glossary

21
Object-oriented analysis
(OOA)

 In OOA approach :

 We organize requirements around real world objects & their


relationships

 We combine both behavioral (process) and structural


(classes & objects) aspects of the system

 Common approaches are to create Use Cases & Object


models

 We can also create prototypes & SRS document


22
Object-oriented Design (OOD)

 In OOD approach :

 We convert the OOA artifacts into UML models

 UML stands for “Unified Modeling Language”

 It is a widely accepted modeling language for designing


systems using OOD approach

 We will go through an example system


“Supermarket Prize Scheme”
23
Example System: Supermarket
Prize Scheme
 Supermarket needs to develop software to encourage regular customers.

 Customer can register by providing his residence address, telephone


number, and the driving licence number.
 Each customer is assigned a unique customer number (CN) by the
computer

 A customer presents his/her CN to the staff when he makes any purchase.

 The value of his purchase is credited against his CN.

 At the end of each year, the supermarket awards surprise gifts to ten
customers who make highest purchase.

 Also, rewards are given to every customer whose purchases > Rs. 10,000.

 The entries against the CN are reset on the last day of every year.
24
Use Case Model

register
Customer customer Clerk

register
sales

Sales Clerk
select
winners

Supermarket
Prize scheme
Manager

25
Initial Domain Model

SalesHistory CustomerRegister

1 1

* *
SalesRecords CustomerRecord

Initial domain model

26
Refined Domain Model

SalesHistory CustomerRegister

1 1

* *
SalesRecords CustomerRecord

RegisterCustomerBoundary RegisterCustomerController

RegisterSalesBoundary RegisterSalesController

SelectWinnersBoundary SelectWinnersControllers

Refined domain model


27
Class Diagram

SalesHistory CustomerRegister

selectWinners findWinnerDetails
registerSales register

1 1

* *
SalesRecords CustomerRecord

salesDetails name
address
computerSales browse
browse checkDuplicate
create create

28
UML

 Unified Modelling Language (UML) is a


modelling language

 Like DFD, it provides :


Set of notations/ symbols/ guidelines for
creating model of a system

 These Models document the results of OOA &


OOD
29
UML diagrams(or models)

 We can draw nine diagrams to capture different


views of a system

 Five Different Views of a system


 User’s view
 Structural view
 Behavioral view
 Implementation view
 Environmental view
30
UML diagrams

31
UML diagrams

 User’s view: (Static view)


 Captures different functionalities a system provides to
users
 Considered as the central view
 The users’ view is a black-box view of the system
 Internal structure, dynamic behavior of system components
are not visible

 Structural view: (Static view)


 The structural view defines the types of objects (classes)
 Shows Classes/Objects & relationships among them
 The structural model is also called the static model (as
structure does not change) 32
UML diagrams

 Behavioral view
 The behavioral view captures how objects interact with
each other to realize the system behavior
 Captures the time-dependent (dynamic) behavior of the
system

 Implementation view:
 This view captures the components of the system & their
dependencies

 Environmental view:
 This view models how the different components are
implemented & deployed on different pieces of hardware
33
Use Case model
 The use case model captures interaction between
the system and it’s users
 The use case model for any system consists of a set
of “use cases”
 An “use case” represents a piece of functionality a
system provides to it’s users
 Elements of use case model are :
 1. Actors, 2. Use cases and 3. Use case
description
 A simple way to find all the use cases of a system is
to ask the question:
 “What the users can do using the system?” 34
Use Case model

EX:
 Thus for the Library Information System (LIS), the
use cases could be:
 issue-book
 query-book
 return-book
 create-member
 add-book etc.

 Use cases correspond to the high-level functional


requirements
35
Example of Use Cases

Issue Book

Query Book

Return Book

Create Member
Member
Add Book

LIS
Use case model
36
Ex1: Use Case diagram for LIS

Issue Book

Query Book

Return Book

Create Member
Member
Add Book

LIS
Use case model

37
Example System: Supermarket
Prize Scheme
 Supermarket needs to develop software to encourage regular customers.

 Customer can register by providing his residence address, telephone


number, and the driving licence number.
 Each customer is assigned a unique customer number (CN) by the
computer

 A customer presents his/her CN to the staff when he makes any purchase.

 The value of his purchase is credited against his CN.

 At the end of each year, the supermarket awards surprise gifts to ten
customers who make highest purchase.

 Also, rewards are given to every customer whose purchases > Rs. 10,000.

 The entries against the CN are reset on the last day of every year.
38
Ex2 : Use Case Diagram of

Supermarket Prize scheme

register
Customer customer Clerk

register
sales

Sales Clerk
select
winners

Supermarket
Prize scheme
Manager

39
Factoring Use Cases

 Complex use cases need to be factored into


simpler use cases

 Three ways of factoring :

1. Generalization (OR)
2. Includes (Necessary parts)
3. Extends (Optional parts)

40
Factoring Using
Generalization (‘Or-relationship’)

Pay membership fee

Pay through credit card Pay through debit card

Use case generalization

41
Factoring Using
Includes (Included use case is necessary part of
base use case)

<<include>> Child
Base use case
use case

Use case inclusion

42
Factoring Using
Extends (extended use cases are optional
part of base use case)

Base <<extends>> Common


use case use case

Use case extension

43
Hierarchical Organization
of Use Cases
use case 1 use case 3

use case 2

use case 3.1 use case 3.3

use case 3. 2

use case 3.2.1 use case 3.2.2

use case 3.2.3

Hierarchical organization of use cases


44
Use Case Packaging

45
UML diagrams

46
(2) Class diagram
 Describes static view of a system

 Main components are :

1. Classes

2. Their relationships ( 5 types )


1. Association
2. Aggregation
3. Composition
4. Inheritance
5. Dependencies
47
Class diagram

 Objects with common features


(attributes & operations) are
classified into classes

 Classes are represented as


solid outline rectangle with
compartments in UML

 Compartments for Class name, attributes &


operations
 Attribute and operation compartment are
optional 48
Example of Classes

LibraryMember LibraryMember
Member Name
Membership Number
Address
Phone Number
E-Mail Address
Membership Admission Date
Membership Expiry Date
Books Issued

Different representations of the LibraryMember class

49
Relationships
1. Association
 Association shows connection between classes

 It enable classes to communicate with each


other

 Usually binary but more classes can be involved

 Class can have relationship with itself


Called recursive association
Library Member
1 borrowed by * Book

Association between two classes


50
Association ..
 Arrowhead used along with name, indicates
direction of association
 An instance of association is called link

 Multiplicity indicates no. of instances of one class


associated with no. of instances of other class
 So link is a physical or conceptual connection
between two object instances

Library Member
1 borrowed by * Book

Association between two classes 51


(2) Aggregation
Relationship
 Represent a whole-part relationship

 Represented by diamond symbol at the


composite end

52
(3) Composition Relationship

 Life of one class depends on another


class

1 *
Order Item

Representation of composition

53
(4) Inheritance Relationship

Library
Book

issuable reference

Single Volume Single Volume


BookSet BookSet
Book Book

Representation of the inheritance relationship

54
(5) Dependency

Dependent Class Independent Class

Representation of dependence between class

Employee Organization

55
Consists of :
(3) Object diagram • Objects
• Relationships

LibraryMember LibraryMember LibraryMember

Mritunjay Mritunjay
B10028 B10028
C-108, Laksmikant Hall C-108, Laksmikant Hall
9224356788 9224356788
[email protected] [email protected]
25-02-04 25-02-04
25-03-06 25-03-06
3 3

IssueBook( );
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );

LibraryMember object

56
Interaction diagram

 Models how groups of objects


interact/collaborate to achieve some functionality

 Two types:
1. Sequence diagram
2. Collaboration diagram

 Two diagrams are equivalent but portrays


different views of the system

 These diagram play a very important role in the


design process

57
4. Sequence diagram
:Library
:Library
:Library Book :Library
Book :Book
Boundary(UI) Renewal Member
Register
Controller

renewBook find MemberBorrowing


displayBorrowing
selectBooks bookSelected
* Check for renew
[reserved] Return status
[reserved] apology
Update status
apology
Confirm
renewal

Confirm
renewal
updateMemberBorrowing

Sequence Diagram for the LIS - book renewal use case


58
Sequence diagram

 Shows interaction among objects


In form of sequence of messages to achieve
some functionality

 Objects are shown as boxes at top

 Existence of objects are shown as dashed lines


(lifelines)

 Object’s activeness, shown as rectangle on


lifeline

59
 If an object is in active state :

1. It responds to messages(events) by
performing some operations
2. Or generate messages to other objects

 So messages(events) are external stimulus or


stimulus from other objects

60
 Messages are shown as arrows

 Message is labelled with message name

 Message can be labelled with control


information

 Two types of control information:


 condition ([])
 iteration (*)

61
Example Sequence diagram of LIS – Book
Renewal module

:Library
:Library
:Library Book :Library
Book :Book
Boundary(UI) Renewal Member
Register
Controller

renewBook find MemberBorrowing


displayBorrowing
selectBooks bookSelected
* Check for renew
[reserved]
[reserved] apology
Update status
apology
Confirm
renewal

Confirm
renewal
updateMemberBorrowing

Sequence Diagram for the renew book use case


62
 Book register, Book, Library Member are real
world entities called objects

 The Boundary and Controller objects control


the execution of the real world objects

63
5. Collaboration diagram
6: * find
:Library
Book :Book
[reserved] Register
9: update
8: apology 5: book 10: confirm
Selected
1: renewBook :Library [reserved]
:Library Book 7: apology
Boundary 3: display Renewal
Borrowing Controller

4: selectBooks
2: findMemberBorrowing

12: confirm
:Library
Member
13.updateMemberBorrowing

Collaboration Diagram for the renew book use case


64
 Shows both structural and behavioural aspects

 Objects are collaborators, shown as boxes

 Messages between objects shown as a solid line

 Message is shown as a labelled arrow placed


near the link

 Messages are prefixed with sequence numbers


to show relative sequencing
65
Example collaboration diagram
6: * find
:Library
Book :Book
[reserved] Register
9: update
8: apology 5: book 10: confirm
Selected
1: renewBook :Library [reserved]
:Library Book 7: apology
Boundary 3: display Renewal
Borrowing Controller

4: selectBooks
2: findMemberBorrowing

12: confirm
:Library
Member
13.updateMemberBorrowing

Collaboration Diagram for the renew book use case


66
Module-4 Contents

 Object Modeling Using UML:


 Object-Orientation Concepts
 Unified Modeling Language (UML)

 UML Models:
 Use Case Model, Class Diagram, Interaction Diagrams,
Activity Diagram, State Chart Diagram, Package, Component
and Deployment Diagrams

 Object-Oriented Software Development:


 OOAD Methodology
67
6. Activity diagram
Shows control flow of activities required to achieve a functionality

Admission Section Accounts Section Hostel Office Hospital Department

check
student
records
receive
fees

allot create
hostel hospital
record
register
Receive hostel
in
fees
course
conduct
allot medical
room examination

issue
identity card
Activity diagram for student admission procedure at an University
68
 Represents control flow of activities

 Activity can have one/many outgoing


transitions

 Representing 2 types activities:


 Parallel activities (Forks, Joins)
 Synchronized (sequential) activities

 Swim lanes group activities based on who


is performing them
69
7. State Chart diagram
 Shows how the state of an object changes in its
lifetime
 Ex: Unprocessed Order  Accepted Order  Fulfilled Order

 Transitions connect different states

 Elements of state chart diagram

 Initial State: Filled circle


 Final State: Filled circle inside larger circle
Unprocessed
 State: Rectangle with rounded corners
Order
 Transitions: Arrow between states

70
Example : Order Processing

order received
Unprocessed
Order
[reject] checked [accept] checked

Rejected Accepted
Order Order
[all items available]
[some items not processed / deliver
available] processed

[all items
Pending available] Fulfilled
Order newsupply Order

Example: State chart diagram for an order object


71
Object-oriented
Software Design Process

User interface
Use case Interaction
or GUI
diagram diagram
prototype

Start

Domain model
SRS document to identify Class diagram Code
Classes

72
8. Component Diagram

Uml diagram classification:

 Static : Use case diagram, Class diagram


 Dynamic : State chart diagram, Activity diagram,
Sequence diagram, Collaboration diagram
 Implementation : Component diagram, Deployment
diagram

Implementation diagrams:

 Describe the different elements required for


implementing a system
73
Component diagram - elements
 Component :
A component is shown as a
Rectangle with a the component
Name Inside

 Usage dependencies:
One element requires another
element for its Implementation

 Ports: Interaction point between


a component and it’s environment

 Connectors: Connect two components (TCP/IP)


74
CASE Study

75
8. DEPLOYMENT Diagram

 Deployment diagrams :
 Show the physical relationship between hardware
(nodes) & software elements in a system

 Hardware elements:
 Computers (clients, servers)
 Embedded processors
 Devices (sensors, peripherals)

 This diagram shows the nodes inside which the


software components reside in the run-time system
DEPLOYMENT DIAGRAMS

 Contains nodes and connections

 A node usually represent a piece


of hardware in the system

 A connection is the communication


path used by the hardware to
communicate ( Ex: TCP/IP )
DEPLOYMENT DIAGRAMS

 Deployment diagrams
contain Artifact / Software

 Ex: source files, table in


a database
DEPLOYMENT DIAGRAMS
Summary
 We discussed object-oriented concepts
 Basic mechanisms: Objects, class, methods, inheritance etc..
 Key concepts: Abstraction, encapsulation, polymorphism etc..
 We discussed an important OO language UML
 Its origin, as a standard, as a model
 Use case representation, its factorisation such as generalization,
includes and extends
 Different diagrams for UML representation
 In class diagram we discussed some relationships association,
aggregation, composition and inheritance
 Some more diagrams such as interaction diagrams (sequence and
collaboration), activity diagrams, state chart diagram
 We discussed OO software development process and patterns
 In this we discussed some patterns example and domain modelling
80
The End !!!

81

You might also like