118
Object Oriented Modeling A Concept Tutorial

8 oo approach&uml-23_feb

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: 8 oo approach&uml-23_feb

Object Oriented Modeling

A Concept Tutorial

Page 2: 8 oo approach&uml-23_feb

The need

• Corporations are becoming information based organizations

• Volume of information is expanding faster than the capacity to process it

• Where does the fault lie?– Computers are faster

and more powerful than ever before!

• The Software Crisis!!

Page 3: 8 oo approach&uml-23_feb

Reasons for the Crisis

• Complexity– requirements are demanding and of contradictory nature

• functionality• usability• cost• reliability• performance• longevity

– requirements change during development– problem domains can be complex– Managing the development process is not easy– impedance mismatch between user and developer

Page 4: 8 oo approach&uml-23_feb

Divide and Rule!

• “The technique of mastering complexity is known since ancient times: Divide and Rule”

….Dijkstra

Page 5: 8 oo approach&uml-23_feb

Solutions• Building better Software is a major

challenge!!

• Modular ProgrammingModularization of Procedures and

data

– Modularization of procedures– Subroutines– Structured Programming

- Functional decomposition- componentization

– Computer Aided Software Engineering ( CASE)

Page 6: 8 oo approach&uml-23_feb

…Solutions

- Modularization of data:-each subroutine can contain its own

data-data can be stored in external files-database management systems ( DBMSs)

– Hierarchic model - tree structures

– network model - data interconnected freely, no tree structure necessary

– relational model - data stored in simple tables

Clearly a new approach must beconsidered!

Page 7: 8 oo approach&uml-23_feb

Algorithmic/ Functional Decomposition

• Define the how and what of the goal• Specifying and decomposing the system functionality• Decompose each task into smaller tasks - ( subroutines…

language statements)• Implement the program and the steps that decompose

each function

Risk:

Seems like the most direct way of doing things, but resulting system may be fragile, requirements change may necessitate massive restructuring

Page 8: 8 oo approach&uml-23_feb

Object Oriented Decomposition

• Decomposing a system into objects, the basic components and design

• managing complexity inherent in the real world problem by abstractions ( of knowledge) and encapsulation (of information and behavior) within objects

Page 9: 8 oo approach&uml-23_feb

The Object Oriented Approach

• Three keys to the OO technology:

– Objects

– Messages

– Classes

Page 10: 8 oo approach&uml-23_feb

Objects• Software package that contains a

collection of related Procedures and Data– Procedures : Methods– Data elements : Variables

- Ideal Modules: Objects can be defined and maintained independently

E.g. Vehicle

- Everything an Object” knows” is expressed in its variables and everything it can “ do” is expressed in its methods- Encapsulation

Methods

Variables ( DATA MEMBERS)

Page 11: 8 oo approach&uml-23_feb

Classes

• There may be many objects of a given type - extremely inefficient to redefine the same methods in every single occurrence of that object

• A Class is a Template that defines methods and variables to be included in a particular type of object

• Objects that belong to a Class are Instances of the Class

ClassMethods

Variables(Data members)

Values

Page 12: 8 oo approach&uml-23_feb

Classes VS. ObjectsClass Object

Class is a type/ templatefor similar objects

Object is an instance ofthe class

Class is purely a staticconcept, represented byprogram text

Objects are run time /dynamic entities thatoccupy space in memory

Page 13: 8 oo approach&uml-23_feb

Classes VS. ObjectsExample

class EMPLOYEE // EMPLOYEE is a class

{

char name[30];

void putname(char*n);

void prinname();

}

main()

{

EMPLOYEE emp; // emp is an object

emp.putname(“myname”;

emp.printname();

}

Page 14: 8 oo approach&uml-23_feb

An Analogy

• Cells are ( organic) “packages” , like Objects, that combine information (data) and behavior

-Encapsulation!!• Cells, like Objects

communicate through Messages( chemical).

• Cells are (natural) building blocks- organized in a Hierarchy of specialized types and subtypes

Nucleus

Membrane

Mitochondria( Energy Converters)

Endoplasmic Reticulum(Protein Factory)

Page 15: 8 oo approach&uml-23_feb

Objects as Abstract Data Types

• OO technology supports data abstraction.

• An abstract data type consists of a new class assembled from built in data types, such as numbers and characters

Abstract Data Type

Built in Data Types

Page 16: 8 oo approach&uml-23_feb

OO Themes

Major themes Abstraction Encapsulation Hierarchy/ Inheritance Polymorphism Modularity

Minor themes Typing Persistence

OO modeling involves consideration of these themes.

Page 17: 8 oo approach&uml-23_feb

Abstraction

An abstraction denotes the essential characteristics of an object

that distinguishes it from other kinds of objects.

• Note essential details• ignore irrelevant details to manage complexity

Page 18: 8 oo approach&uml-23_feb

..Abstraction

• EMPLOYEE

Human ResourcesSystem

Payroll System

NameDesignationQualificationSkills...

NameSalaryHRAConveyance...

Page 19: 8 oo approach&uml-23_feb

Encapsulation

• Promotes hiding of information - Objects do not “touch” each other’s

data• Facilitates Changes- Effects of change are limited to a few

classes

CAPACITY

LOAD

LIFT

LOAD

CONTENTS

MoveTo

UN

LOA

D

Page 20: 8 oo approach&uml-23_feb

Encapsulation

• Act of grouping into a single object - both data and operations that affect the data

• Apportions complexity of the system to individual , pertinent objects

• Knowledge encapsulated within an object is “hidden” from an external view

• An object has a public interface and a private representation

Page 21: 8 oo approach&uml-23_feb

Accessing Objects-Messages

• Interactions between Objects - Message from a sender

object asks the receiver

object to execute its method.

Authors of Simula offered this solution

• Typical Structure:– Object Name - Method-

Parameter• Example ; “Receiver-MoveTo-

Destination”RECEIVER

MoveTo

LOAD

LIFT

SIZE

SPEED

CAPACITY

CONTENTS

SENDER

“Receiver MoveTo Destination”

Page 22: 8 oo approach&uml-23_feb

STEP 1:• Sender ( e.g. client) requests a service by sending

“message”• Message does not specify how the operation is to be

performed

STEP 2:• Receiver ( e.g. server) responds by executing a

“method”• Optionally sends some information back to the sender

Accessing Objects-Messages

Page 23: 8 oo approach&uml-23_feb

Messages

• Objects interact through messages

• A message has three parts;

{Receiver} { Method} {Parameter}

The response to a message is called a Return value

TOTAL

SENDER

RECEIVER

Purchase order100

Rs. 1 crore

“Rs. 1 crore”

“ Purchase order_ 100 TOTAL”

Page 24: 8 oo approach&uml-23_feb

Types of interfaces

• Private:A declaration that forms a part of the interface of a class

and is not visible to other classes

• Public:A declaration that forms a part of the interface of a class

and is visible to clients

Page 25: 8 oo approach&uml-23_feb

Inheritance

• A mechanism by which one class of objects can be defined as a special case of a more general class– Superclass - subclasses

• A subclass inherits all the methods and variables of its superclass

Subclass- Motor

Superclass- Auto Part

Subclass- Chassis

Page 26: 8 oo approach&uml-23_feb

Hierarchy

• Classes can be nested to any degree, inheritance will automatically accumulate down through all the levels

of the tree structureConnector

….

Auto Part

Motor Chassis

Stepping motor Drive motor

Variable speed Drive motor

Fixed speed Drive motor

….

.

.

.

.

.

.

Page 27: 8 oo approach&uml-23_feb

..Inheritance

• When a class Y inherits from class X:

– X is the base or Super class– Y is the derived or Sub class

• Y contains – The part derived from X– new code specific to Y

Page 28: 8 oo approach&uml-23_feb

Classes• Classes allow a programmer

to organize complex systems in a rational, orderly way.

• When an instance ( object) receives a message, it refers to its Class for its methods and variable types and then applies these to its own unique set of values

Look up method and variable definition in the Class

DRAW

DRAW

DRAWTOOL

DRAWTOO104L

TRIANGLE

“DRAWTOOL104 DRAW:TRIANGLE”

Use values contained in the instance

Page 29: 8 oo approach&uml-23_feb

Class Hierarchies

• An object will search its Superclass for methods

and variables• This leads to efficient

packaging of information.

“A PRINT” INSTANCE”

Not here

Not here

Found it!!

Page 30: 8 oo approach&uml-23_feb

..Inheritance

Example:

Define a class describing polygons:• Attributes - vertices• Operation - translation, rotation, display, computation of

perimeter

Page 31: 8 oo approach&uml-23_feb

..Inheritance

• If we need a new class representing Rectangle, we can derive it from the class representing Polygon

Common features Special features

Translation, rotation,display

Number of vertices, anglebetween sides, specialformula to computeperimeter

Page 32: 8 oo approach&uml-23_feb

..Inheritance

Pseudo- code for rectangle:

class Rectangle inherits Polygon

{

redefines perimeter() from Polygon

and

has features specific to Rectangle

}

Page 33: 8 oo approach&uml-23_feb

Polymorphism

• Hiding Alternative procedures behind a common interface is called Polymorphism

• e.g. The name “DRAW” can be used for all the variations of the method-such as “DRAW CIRCLE” and “DRAW RECTANGLE”.

DRAW DRAW DRAW

“SHAPE DRAW”

A DRAW method in multiple objects:

Page 34: 8 oo approach&uml-23_feb

.. Polymorphism

• The function “ DRAW” is declared in the base class Polygon

• The function can be redefined in derived classes to describe specific action/ operation to be performed

• Same function name DRAW is used in all the derived classes

• The version of DRAW function to be used is decided during runtime by the object

Page 35: 8 oo approach&uml-23_feb

Goals that guide Class Hierarchies

• Build general purpose classes for reuse

• make change easier

• correctly reflect the real world system

• TO BUILD SOLID WORKING MODELS

Page 36: 8 oo approach&uml-23_feb

Modularity

A modular system is a system decomposed into a set of cohesive and loosely decoupled modules

Example: Insurance Policy, claim processing,

accounts, scheme builder

Page 37: 8 oo approach&uml-23_feb

Typing

• Typing is enforcement such that objects of different types may not be interchanged, or, at most may be interchanged only in very restricted ways

• Strongly typed languages require type checking of all arguments

• Static type checking occurs at compile time• Dynamic type checking occurs at execution time• Strong typing avoids run time errors• Type declarations serve as program

documentation

Page 38: 8 oo approach&uml-23_feb

Persistence

• This is a property by virtue of which– object continues to exist after its

creator ceases to exist

Page 39: 8 oo approach&uml-23_feb

Promise of the OO Approach

• Conventional software – solves a specific problem– is built from scratch

• Object Oriented software– models a system – is built by assembly.

• modeling has many advantages.– understandability– flexibility– Longevity

Page 40: 8 oo approach&uml-23_feb

Industrialization of Software

• A striking parallel exists between the OO approach and the Industrial revolution-– Handcrafting ---> Mass

Production - Paradigm shift!!

• The goal is Industrial revolution for Software

• The success depend on development of reusable, standard objects.

• The Challenge lies in getting the Classes right.

A Class manufacturing instances

Page 41: 8 oo approach&uml-23_feb

Unified Development Process (UDP)

• UDP is a method of managing OO Software Development

• It can be viewed as a Software Development Framework which is extensible and have features to do the following:– Iterative Development– Requirements Management– Component-Based Architectural Vision– Visual Modeling of Systems– Quality Management– Change Control Management

Page 42: 8 oo approach&uml-23_feb

UDP Features

• Templates for all major artifacts, including:– RequisitePro templates (requirements

tracking)– Word Templates for Use Cases– Project Templates for Project Management

• Process Manuals describing key processes• Online Repository of Process Information and

Description

Page 43: 8 oo approach&uml-23_feb

Phases of UP

Page 44: 8 oo approach&uml-23_feb

An Iterative Development Process...

• Recognizes the reality of changing requirements– Caspers Jones’s research on 8000 projects

• 40% of final requirements arrived after the analysis phase, after development had already begun

• Promotes early risk mitigation, by breaking down the system into mini-projects and focusing on the riskier elements first

• Allows you to “plan a little, design a little, and code a little”• Encourages all participants, including testers, integrators, and

technical writers to be involved earlier on• Allows the process itself to modulate with each iteration,

allowing you to correct errors sooner and put into practice lessons learned in the prior iteration

• Focuses on component architectures, not final big bang deployments

Page 45: 8 oo approach&uml-23_feb

An Incremental Development Process...

• Allows for software to evolve, not be produced in one huge effort

• Allows software to improve, by giving enough time to the evolutionary process itself

• Forces attention on stability, for only a stable foundation can support multiple additions

• Allows the system (a small subset of it) to actually run much sooner than with other processes

• Allows interim progress to continue through the stubbing of functionality

• Allows for the management of risk, by exposing problems earlier on in the development process

Page 46: 8 oo approach&uml-23_feb

Goals and Features of Each Iteration

• The primary goal of each iteration is to slowly chip away at the risk facing the project, namely:

– performance risks– integration risks (different vendors, tools, etc.)– conceptual risks (ferret out analysis and design flaws)

• Perform a “miniwaterfall” project that ends with a delivery of something tangible in code, available for scrutiny by the interested parties, which produces validation or correctives

• Each iteration is risk-driven• The result of a single iteration is an increment--an incremental

improvement of the system, yielding an evolutionary approach

Page 47: 8 oo approach&uml-23_feb

The Development Phases

• Inception Phase• Elaboration Phase• Construction Phase• Transition Phase

Page 48: 8 oo approach&uml-23_feb

Inception Phase• Overriding goal is obtaining buy-in from all interested parties• Initial requirements capture• Cost Benefit Analysis• Initial Risk Analysis• Project scope definition• Defining a candidate architecture• Development of a disposable prototype• Initial Use Case Model (10% - 20% complete)• First pass at a Domain Model

Page 49: 8 oo approach&uml-23_feb

Elaboration Phase• Requirements Analysis and Capture

– Use Case Analysis• Use Case (80% written and reviewed by end of phase)• Use Case Model (80% done)• Scenarios

– Sequence and Collaboration Diagrams– Class, Activity, Component, State Diagrams

– Glossary (so users and developers can speak common vocabulary)

– Domain Model • to understand the problem: the system’s requirements as they

exist within the context of the problem domain

– Risk Assessment Plan revised– Architecture Document

Page 50: 8 oo approach&uml-23_feb

Construction Phase

• Focus is on implementation of the design:– cumulative increase in functionality– greater depth of implementation (stubs fleshed out)– greater stability begins to appear– implement all details, not only those of central

architectural value– analysis continues, but design and coding predominate

Page 51: 8 oo approach&uml-23_feb

Transition Phase

• The transition phase consists of the transfer of the system to the user community

• It includes manufacturing, shipping, installation, training, technical support and maintenance

• Development team begins to shrink• Control is moved to maintenance team• Alpha, Beta, and final releases• Software updates• Integration with existing systems (legacy, existing versions,

etc.)

Page 52: 8 oo approach&uml-23_feb

Elaboration Phase in Detail

• Use Case Analysis– Find and understand 80% of architecturally significant use

cases and actors– Prototype User Interfaces– Prioritize Use Cases within the Use Case Model– Detail the architecturally significant Use Cases (write and

review them)

• Prepare Domain Model of architecturally significant classes, and identify their responsibilities and central interfaces (View of Participating Classes)

Page 53: 8 oo approach&uml-23_feb

Modeling with UML

Page 54: 8 oo approach&uml-23_feb

What is UML?

Modeling involves • understanding ( semantics) a subject (system) and • capturing and communicating this knowledge

The Unified Modeling Language ( UML) is:• A complete language for capturing knowledge (semantics)

about a subject (system) and communicating the knowledge (syntax)

– the result of unifying the IT industry’s best engineering practices

– proposed by Booch, Rumbaugh and Jacobson-the Three Amigos

Page 55: 8 oo approach&uml-23_feb

..What is UML?

• UML is the standard language for visualizing, specifying, constructing, and documenting the artifacts of a software intensive system

• It can be used with all processes, throughout the development life cycle, and across different implementation technologies

• Applicable to not only Software Systems but to any other type of systems

Page 56: 8 oo approach&uml-23_feb

Evolution of the UML

• Unification– Jim Rumbaugh, Grady Booch and Ivar Jacobson joined

Rational Software Corporation to unify their methods.• Rumbaugh - Analysis oriented (OMT)• Booch - Design and Construction oriented• Jacobson - Use case oriented (OOSE)

– Since the independent methods were evolving towards one another, continue evolution by unification.

– Identify and incorporate fundamental concepts, building a meta model and a notation to describe them.

Page 57: 8 oo approach&uml-23_feb

Standardization

• More companies joined the UML partner’s consortium to contribute their ideas and produce version 1.1 of the UML with– Increased formalism– Improved structural packaging– Improved mapping of notation to semantics

• UML 1.1 is accepted by OMG as a standard in fall 1997.

• Current version UML 2.0

Page 58: 8 oo approach&uml-23_feb

History of the UML

Nov ‘97 UML approved by the OMG

Page 59: 8 oo approach&uml-23_feb

Scope of UML

• Fusing concepts of Booch, OMT and OOSE.• Focusing on a standard modeling language (common

notation and semantics)• Incorporating the object-oriented community’s

consensus on core modeling concepts.• Providing sufficient notation to address contemporary

modeling issues directly and economically.• Providing extensibility mechanisms to extend UML for

individual projects.

Page 60: 8 oo approach&uml-23_feb

– The UML enables and promotes a use-case-driven, architecture-centric, iterative, and incremental process that is object oriented and component based.

Page 61: 8 oo approach&uml-23_feb

The UML Definition

• Defined by a set of documents– UML Semantics– UML Notation Guide

Page 62: 8 oo approach&uml-23_feb

The UML Semantics Document

• Constitutes the single, common, formal and comprehensive specification of the UML (inside view).

• Primarily used by tool vendors.• Specifies the UML’s layered architecture, organization

and defines modeling elements.• Enables consistent usage of the UML.

Page 63: 8 oo approach&uml-23_feb

The UML Notation Guide

• Constitutes the notational or visual representation of the UML and provides examples (outside view)

• Primarily used by practitioners applying the UML• Specifies UML diagrams and their modeling elements

Page 64: 8 oo approach&uml-23_feb

Model Views and UML Diagrams

•Use Case

User View

Behavioral View

•Sequence•Collaboration•State Chart•Activity

Structural View

•Class •Object

Implementation View •Component

Environment View

•Deployment

User view* Use case

Page 65: 8 oo approach&uml-23_feb

UML Diagrams

• Class diagram For a view of the static structure of the system• UseCase diagram

For High level business scenarios• Sequence diagram or Collaboration diagram

For detailed activities within a scenario• State chart diagram or Activity Diagram For classes with a dynamic behavior• Component diagrams For describing organization and dependencies among software

components• Deployment diagrams For describing the configuration of resource elements and mapping

of software implementation components on to them• Package diagram

For Modules

Page 66: 8 oo approach&uml-23_feb

Library Management System- A Case Study

The Library has:• three categories of members• a librarian and assisting staff• an accounts sectionThe Library Management System should provide the

following functionality:• borrowing and returning of books• querying, reserving and recommending books• acquiring books• issuing overdue notices to members

Page 67: 8 oo approach&uml-23_feb

..Class Diagram• Shows the static structure of the system - classes and

their relationships • Classes

– structure (attributes)– behavior (operations)

• Relationships– Association, aggregation, dependency, and

inheritance– Multiplicity and navigation indicators– names

Page 68: 8 oo approach&uml-23_feb

4

5

Class Diagram Notation

Class

Class with a compartment

Realizes Interface

Interface

Constraint

N-ary Association

Binary Association

1

2

3

4

5

6

7

Page 69: 8 oo approach&uml-23_feb

Library

Bookno

VisibilityAttribute TypeScopeInitValTitle aAuthor aPublisher aSubject aKeywords aedition aPrice a

CopyInLib

VisibilityAttribute TypeScopeInitValisReference aaccessionNo aisIssued acopyNo a

Librarian

LibraryMember

VisibilityAttribute TypeScopeInitValname amemberId a

Accountant

OrderInfo

VisibilityAttribute TypeScopeInitValsupplierId aNoOfCopies a

hasBooks1 *

hasCopies

1

*

hasLibrarian

1

1

borrows1

0..5

hasMembers

1

0..200

orders

1

*

Class Diagram

Page 70: 8 oo approach&uml-23_feb

Relationships• An association is a bi-directional connection between classes

– An association is shown as a line connecting the related classes• An aggregation is a stronger form of relationship where the relationship is

between a whole and its parts– An aggregation is shown as a line connecting the related classes with a

diamond next to the class representing the whole• A dependency relationship is a weaker form of relationship showing a relationship

between a client and a supplier where the client does not have semantic knowledge of the supplier

• A dependency is shown as a dashed line pointing from the client to the supplier

Page 71: 8 oo approach&uml-23_feb

Relationships - contd..• An association class is an association that also has class

properties(or a class has association properties)• A constraint is a semantic relationship among model elements

that specifies conditions and propositions that must be maintained as true: otherwise, the system described by the model is invalid

• An interface is a specifier for the externally visible operations of a class without specification of internal structure. An interface is formally equivalent to abstract class with no attributes and methods, only abstract operations.

• A qualifier is an attribute or set of attributes whose values serve to partition the set of instances associated with an instance across an association.

Page 72: 8 oo approach&uml-23_feb

Association

Teacher

Navigation

Aggregation

StudentGuide RS

1 Guides *Teacher

DepartmentInstitute1 *

Page 73: 8 oo approach&uml-23_feb

Composition

Page Frame1 *

Page Frame1 *

Page Frame1 *

Window

Header SliderMenu

Page 74: 8 oo approach&uml-23_feb

Dependency

Window Buttonuses

SalaryEmployeeaccess

Page 75: 8 oo approach&uml-23_feb

Association Classes

CourseTeacher

OfferingNo of students

VenueSlot number

1 Teaches *

Company Employee

JobDesignation

Salary

1 employs *

Page 76: 8 oo approach&uml-23_feb

Constraint

CommitteeFaculty

* Member of *

1 Head of *

{ subset }

Realization

AccountImpl

<interface>Iaccount

Deposit()withdraw()

Page 77: 8 oo approach&uml-23_feb

Qualifier

Bank

Customer

Account #*

*

Factory

Itemproduced

Item #

*

1

Page 78: 8 oo approach&uml-23_feb

…Use Case Diagram

• Represent the interaction between users and the system

• Identifies users (roles) and external systems

• Determines the functional scope of the package (module)

Page 79: 8 oo approach&uml-23_feb

Use Case Diagram Notation

Actor

Association

Use Case

Use case with Extension points

<<Uses>>

<<Extends>>

Page 80: 8 oo approach&uml-23_feb

Use Case Diagram

Page 81: 8 oo approach&uml-23_feb

..State Chart DiagramA state chart (transition) diagram is used to show

– The life history of a given class, UseCase, operation– The events that cause a transition from one state to

another– The actions that result from a state change

State transition diagrams are created for objects with significant dynamic behavior

Page 82: 8 oo approach&uml-23_feb

State Chart Diagram Notation

Page 83: 8 oo approach&uml-23_feb

Interaction Diagram

• Interaction diagrams describe how use cases are realized as interactions among objects

• Show classes, objects, actors and messages between them to achieve the functionality of a

UseCase• Two types of interaction diagrams

– Sequence diagrams– Collaboration diagrams

Page 84: 8 oo approach&uml-23_feb

..Sequence Diagram

• Is used to elaborate a use case• Describes a scenario - it is normal that a use case has

multiple scenarios • Helps to describe the expected system behavior to a

user• Follows an event from inception to completion of

processing by the system

Page 85: 8 oo approach&uml-23_feb

Sequence Diagram NotationActor

Class

Synchronous messageAsynchronous message

Return message

Focus of Control

lifeline

Termination

Page 86: 8 oo approach&uml-23_feb

Sequence DiagramLibrary member UI Member Boo

kCopy

Page 87: 8 oo approach&uml-23_feb

..Collaboration Diagram

• describes interactions among Classes ( objects)• can be drawn instead of a sequence diagram• Message sequencing is shown using sequence numbers

Page 88: 8 oo approach&uml-23_feb

Collaboration Diagram Notation

Class

Messages with sequence numbers( “Collaborates with Class”)

Actor

Page 89: 8 oo approach&uml-23_feb

Collaboration Diagram

Page 90: 8 oo approach&uml-23_feb

State Chart Diagram

Page 91: 8 oo approach&uml-23_feb

..Activity Diagram

Activity diagrams are similar to State Chart diagrams.However they describe the behavior of a Class in response to internal processing.

• Transitions are triggered by completion of activity• For describing behavior of Use Cases or operations

Page 92: 8 oo approach&uml-23_feb

Activity Diagram Notation

Page 93: 8 oo approach&uml-23_feb

Activity Diagram

Page 94: 8 oo approach&uml-23_feb

..Component Diagram

• Describe organization and dependency between the software implementation components

• Components are distributable physical units -e.g. source code, object code.

Page 95: 8 oo approach&uml-23_feb

Component

Dependency

Component Diagram Notation

Page 96: 8 oo approach&uml-23_feb

Component Diagram

Page 97: 8 oo approach&uml-23_feb

..Deployment Diagram

• Describe the configuration of processing resource elements and the mapping of software implementation components onto them

• contain components - e.g. object code, source code, and nodes - e.g. printer, database, client machine

Page 98: 8 oo approach&uml-23_feb

Deployment Diagram Notation

Component

Interface

Dependency

Node

Connector

Page 99: 8 oo approach&uml-23_feb

Deployment Diagram

LibClient2

ClientLibrarian

LibClient1

LibServer

LibMgmtSys

ClientMember

tcp-ip tcp-ip

Page 100: 8 oo approach&uml-23_feb

…Package Diagram

A Package is :

• an application view

• exploded into a set of modules

• linked to the diagrams that model that application view

Page 101: 8 oo approach&uml-23_feb

Package Diagram Notation

Container package

Package

Dependency

Generalization

Page 102: 8 oo approach&uml-23_feb

Package Diagram

Page 103: 8 oo approach&uml-23_feb

How to perform Modeling Process?

• Break up the system into packages. Draw a high level Package Diagram for the system.

• Draw Use Case diagrams for each package• Analyze each use case in detail - identifying variations,

common use cases, scenarios of interest• Draw a Sequence /Collaboration diagram for each

scenario

Page 104: 8 oo approach&uml-23_feb

.. Modeling Process• Draw a Class Diagram for each package

– classes will be shared across the entire application model

– a class will be owned by a “package” - others will use it

• Refine the inheritance hierarchy (this will be across the application)

• Identify attributes and keys for the classes

Page 105: 8 oo approach&uml-23_feb

..Modeling Process

Draw • State Chart Diagrams or Activity Diagrams for classes that

exhibit a significantly dynamic behavior• Component Diagrams to elucidate the intercomponent

dependencies• Deployment Diagrams to describe the configuration of

resource elements and mapping of the software implementation components onto them

Page 106: 8 oo approach&uml-23_feb

Overview of Modeling Process

Application Package Diagram

Component Diagram

Deployment Diagram

Use Case Diagram

Sequence Diagram

Collaboration Diagram

Activity Diagram

Class Diagram

State Chart Diagram

Page 107: 8 oo approach&uml-23_feb

Use Case Template• Overview• Actors• Stimulus• Pre and Post Conditions• Normal Flow• Logic• Alternate flow(s)• Exception(s)• Extends• Uses• Unresolved Issues• Non functional requirements• Future requirements

Page 108: 8 oo approach&uml-23_feb

Use Case Analysis

• What is a Use Case?

– A sequence of actions a system performs that yields a valuable result for a particular actor.

• What is an Actor?

– A user or outside system that interacts with the system being designed in order to obtain some value from that interaction

• Use Cases describe scenarios that describe the interaction between users of the system and the system itself.

• Use Cases describe WHAT the system will do, but never HOW it will be done.

Page 109: 8 oo approach&uml-23_feb

What’s in a Use Case?• Define the start state and any preconditions that accompany it• Define when the Use Case starts• Define the order of activity in the Main Flow of Events• Define any Alternative Flows of Events• Define any Exceptional Flows of Events• Define any Post Conditions and the end state• Mention any design issues as an appendix• Accompanying diagrams: State, Activity, Sequence Diagrams• View of Participating Objects (relevant Analysis Model Classes)• Logical View: A View of the Actors involved with this Use Case, and any Use

Cases used or extended by this Use Case

Page 110: 8 oo approach&uml-23_feb

Use Cases Describe Function not Form

• Use Cases describe WHAT the system should do, but never HOW it will be done

• Use cases are Analysis products, not design products

Page 111: 8 oo approach&uml-23_feb

Benefits of Use Cases• Use cases are the primary vehicle for requirements capture in UP• Use cases are described using the language of the customer (language

of the domain which is defined in the glossary)• Use cases provide a contractual delivery process (UP is Use Case

Driven)• Use cases provide an easily-understood communication mechanism• When requirements are traced, they make it difficult for requirements

to fall through the cracks• Use cases provide a concise summary of what the system should do at

an abstract (low modification cost) level.

Page 112: 8 oo approach&uml-23_feb

Difficulties with Use Cases• As functional decompositions, it is often difficult to make the transition

from functional description to object description to class design• Reuse at the class level can be hindered by each developer “taking a

Use Case and running with it”. Since UCs do not talk about classes, developers often wind up in a vacuum during object analysis, and can often wind up doing things their own way, making reuse difficult

• Use Cases make stating non-functional requirements difficult (where do you say that X must execute at Y/sec?)

• Testing functionality is straightforward, but unit testing the particular implementations and non-functional requirements is not obvious

Page 113: 8 oo approach&uml-23_feb

Use Case Model Survey

• The Use Case Model Survey is to illustrate, in graphical form, the universe of Use Cases that the system is contracted to deliver.

• Each Use Case in the system appears in the Survey with a short description of its main function.– Participants:

• Domain Expert• Architect• Analyst/Designer (Use Case author)• Testing Engineer

Page 114: 8 oo approach&uml-23_feb

Sample Use Case Model Survey

Page 115: 8 oo approach&uml-23_feb

Analysis Model• In Analysis, we analyze and refine the requirements described in the Use Cases

in order to achieve a more precise view of the requirements, without being overwhelmed with the details

• Again, the Analysis Model is still focusing on WHAT we’re going to do, not HOW we’re going to do it (Design Model). But what we’re going to do is drawn from the point of view of the developer, not from the point of view of the customer

• Whereas Use Cases are described in the language of the customer, the Analysis Model is described in the language of the developer:

– Boundary Classes– Entity Classes– Control Classes

Page 116: 8 oo approach&uml-23_feb

Why spend time on the Analysis Model, why not just “face the cliff”?

• By performing analysis, designers can inexpensively come to a better understanding of the requirements of the system

• By providing such an abstract overview, newcomers can understand the overall architecture of the system efficiently, from a ‘bird’s eye view’, without having to get bogged down with implementation details.

• The Analysis Model is a simple abstraction of what the system is going to do from the point of view of the developers. By “speaking the developer’s language”, comprehension is improved and by abstracting, simplicity is achieved

Page 117: 8 oo approach&uml-23_feb

Boundary Classes• Boundary classes are used in the Analysis Model to model interactions

between the system and its actors (users or external systems)

• Boundary classes are often implemented in some GUI format (dialogs, widgets, beans, etc.)

• Boundary classes can often be abstractions of external APIs (in the case of an external system actor)

• Every boundary class must be associated with at least one actor:

Page 118: 8 oo approach&uml-23_feb

Entity Classes• Entity classes are used within the Analysis Model to

model persistent information• Often, entity classes are created from objects within the

business object model or domain model