29
Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Embed Size (px)

Citation preview

Page 1: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.1

Unit 4:

Unified Modeling Language

Software Engineering Process - II

Page 2: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.2

What are your expectations from this chapter?

Before You Begin…

Page 3: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.3

Unit Objectives

Explain the components of UML.

Explain objects, classes, and relationships.

Describe and create use-case models.

Describe and create UML diagrams during analysis.

Define and create UML diagrams during design.

Define and create UML diagrams during implementation.

Page 4: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.4

What is UML

UML includes a set of concepts, notations, and diagrams necessary for developing object-oriented systems.

Page 5: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.5

Objects

An object is an entity that has a state and a defined set of operations that operate on that state.

Objects have attributes and behavior.

Objects interact by sending each other messages.

Values of an object's attributes determine its state.

An abstraction of a real world problem containing objects is called a model.

Page 6: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.6

Object Class

An object class depicts a set of objects with common attributes and operations.

It is represented as a rectangle with three sections.

Page 7: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.7

Class Activity - 1

List at least three objects from SITS project and draw their object class diagrams complete with three attributes and two operations.

Page 8: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.8

Object Class Diagrams

Student

-StudentId:int

-EmailId:char

-Phone:int

-name:char

+AddStudent():void

+DeleteStudent():Integer

Registration

-RegistrationId:int

-RegistrationStatus:char

-ConfirmEmailStatus:int

-EmailSentDate:time

+DoRegistration():void

+GetRegistrationStatus():void

+SendEmail():void

Payment

-PaymentId:int

-PaymentType:int

-PaymentAmount:float[]

+DoPayment():void

+Cancelpayment():void

Page 9: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.9

Relationships

Association: An instance of one class must know about the other to perform its operation. Depicted by a link connecting two classes.

Generalization (Inheritance): UML refers to inheritance as generalization. Depicted by a triangle pointing from the subclass to

the superclass.

Aggregation: An association in which one class belongs to a collection. Depicted by a diamond pointing to the collection

object.

Page 10: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.10

Multiplicity

Number of instances of the class associated with a single instance of the class on the other end.

Multiplicity

Description

0..1 Zero or one instance. The notation n . . m indicates n to m instances.

0..* or * No limit on the number of instances – includes none.

1 Exactly one instance.

1..* At least one instance.

Page 11: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.11

Use-Case Diagram

A use-case diagram:

Depicts a scenario(s) for a single task.

Includes actor, communications, and use-cases.

Includes actors that are represented as stick figures, use-cases as ovals, and communications are lines that link actors to use-cases.

Has an associated description defining the use-case that helps identify objects and operations in the system.

Page 12: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.12

Use-Case Relationships

A includes B: Indicates that the source element includes the functionality of the target element. Include connections are used in use-case models to reflect that one use-case includes the behavior of another.

A extends B: Indicates an element extends the behavior of another. Extensions are used in use- case models when one use-case (optionally) extends the behavior of another. A is a base use-case; B is an extending use-case.

Page 13: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.13

Class Activity - 2

Draw a use-case diagram for SITS representing all the actors, use-cases, and the include and extend relationships.

Page 14: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.14

Use-Case Model - SITS

Page 15: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.15

Class Activity - 3

Draw a class diagram of SITS showing all the classes and corresponding multiplicities.

Page 16: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.16

Class Diagram

Student

Registration

Payment

Address

Cancellation

Credit card Check

Refund

1..*

Batch selection1..*

Course material

1..*

0..1

0..1 *

1..*

Page 17: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.17

Sequence Diagrams – Behavior Modeling

In addition to use-cases, these diagrams can be used to show the sequence of actions.

Objects and actors are aligned along the top of the diagram.

Arrow labels show operations.

The vertical line indicates the timeline.

Sequence of operations is from top to bottom.

The return action can be shown using a dotted arrow.

Page 18: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.18

Class Activity - 4

Draw a sequence diagram for the Registration activity.

Page 19: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.19

Sequence Diagram - Registration

Page 20: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.20

Activity Diagrams

An activity diagram: Looks like a flowchart

Provides a good way to understand/model business processes

Focuses on the flow of activities involved in a single process of the system

Shows how the system activities depend on each other

Begins with a black circle at the top and ends with a concentric white/black circle at the bottom

Contains activities shown by rounded rectangles

Page 21: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.21

Class Activity - 5

Design an activity diagram for the Registration process of SITS.

Page 22: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.22

Activity Diagram

Page 23: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.23

State Diagrams

A state diagram:

Captures the lifecycle of an object

Represents different states an object can assume and the events that cause the changes in state

In a state diagram:

States are shown by rounded rectangles

Transitions are shown by arrows

Events that trigger state changes are written beside the arrows

Page 24: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.24

Collaboration Diagrams

Collaboration diagrams:

Are also interaction diagrams

Like sequence diagrams, represent object interactions, but the focus is on object roles

Show how critical objects collaborate within a use-case

Focus on key transactions

Page 25: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.25

Collaboration Diagram - Example

Page 26: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.26

Package Diagrams

A package diagram:

Shows logical grouping of objects into subsystems

Is represented using a form of class diagrams where each subsystem is shown as package

Is a useful static model because it shows how the design may be organized into logical groups of objects

Can also show association between objects

Page 27: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.27

Component and Deployment Diagrams

A component is a module of the system which contains classes.

A component diagram shows how the modules are placed in a system and is denoted by a rectangle having two tabs.

Deployment diagrams show the physical configurations of software and hardware as they will be deployed in the system.

In a deployment diagram, the hardware is represented by cubes which are called nodes. Each component sits within a node.

Page 28: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.28

Deployment Diagram - Example

Page 29: Software Engineering Process - II 4.1 Unit 4: Unified Modeling Language Software Engineering Process - II

Software Engineering Process - II 4.29

Summary

What was your key learning from the unit?