Ooad

37
www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 1 OBJECT ORIENTED ANALYSIS AND DESIGN August 04, 2010

Transcript of Ooad

Page 1: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 1

OBJECT ORIENTED ANALYSIS AND DESIGN

August 04, 2010

Page 2: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 2

Agenda

• Introduction to Object Orientation • Introduction to OOAD?• Various OOA techniques• Various OOD techniques• Flow of OOA to OOD• Introduction to UML• Various Diagrams in UML

Page 3: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 3

Introduction to Object Orientation

• Basic Principles of Object Orientation

• Basic Concepts of Object Orientation

• Strengths of Object Orientation

Page 4: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 4

Object Orientation

Enca

psul

atio

n

Abs

trac

tion

Hie

rarc

hy

Mod

ular

ity

Basic Principles of Object Orientation

Page 5: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 5

Salesperson

Not saying Which salesperson – just a salesperson in general!!!

CustomerProduct

Manages Complexity

What is Abstraction?

Page 6: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 6

Improves Resiliency

What is Encapsulation?

• Hide implementation from clients– Clients depend on interface

How does an object encapsulate?What does it encapsulate?

Page 7: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 7

Order Processing System

Billing

OrderEntry

OrderFulfillment

Manages Complexity

What is Modularity?

• The breaking up of something complex into manageable pieces

Page 8: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 8

Decreasing abstraction

Increasing abstraction

Asset

RealEstate

Savings

BankAccount

Checking Stock

Security

Bond

Elements at the same level of the hierarchy should be at the same level of abstraction

What is Hierarchy?

• Levels of abstraction

Page 9: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 10

Basic Concepts of Object Orientation

• Object• Class• Attribute• Operation• Interface (Polymorphism)• Component• Package• Subsystem• Relationships

Page 10: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 11

What is OOAD?• Object-oriented analysis and design (OOAD) is a

software engineering approach that models a system as a group of interacting objects .

• Analysis — understanding, finding and describing concepts in the problem domain.

• Design — understanding and defining software solution/objects that represent the analysis concepts and will eventually be implemented in code.

• OOAD — Analysis is object-oriented and design is object-oriented. A software development approach that emphasizes a logical solution based on objects.

Page 11: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 12

Definitions of OOA and OOD

What is Object Oriented Analysis?• Object-oriented analysis (OOA) applies object-modeling

techniques to analyze the functional requirements for a system.

What is Object Oriented Design?• Object-oriented design (OOD) elaborates the analysis

models to produce implementation specifications.

• OOA focuses on what the system does, OOD on how the system does it.

Page 12: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 13

Object Oriented Analysis

• Object-oriented analysis (OOA) looks at the problem domain, with the aim of producing a conceptual model of the information that exists in the area being analyzed.

• Analysis models do not consider any implementation constraints that might exist, such as concurrency, distribution, persistence, or how the system is to be built

• The sources for the analysis can be a written requirements statement, a formal vision document, interviews with stakeholders or other interested parties.

Page 13: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 14

Analysis Techniques

• Ad-hoc• Noun lists• Use cases

Page 14: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 15

Adhoc Analysis

• when the problem is too difficult for the "analyst"• Hard to do in collaboration Analysis on-the-fly while

implementing– Simple problems– Objects, methods and behaviour obvious

• Probably the only analysis method in HEP?• Works well with a good "analyst/designer“ Works miserably

Page 15: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 16

Noun List Analysis

• Identify nouns, adjectives, verbs from e.g. requirements documents– nouns → objects?– verbs → methods?– adjectives → object variations? → abstractions?

• Fight blank page syndrome• Depends on quality of existing documentation• Too concrete, difficult in large projects

Page 16: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 17

Use Case Analysis

• Start from requirements• Describe response of system to events

– Normal flow of action– Error and exception handling

• Can implement tests to check use cases• Can be quite formal

– UML diagrams– Nested use cases

Page 17: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 18

The Booch Micro Cycle

Identify classesand objects

Identify classesand objects semantics

Identify classes andobjects relationships

Specify classes andobjects interfaces

and implementation

•Static model•Method names•Associations

•Dynamic model•Message flow

•Refine relationships•Find abstractions

•Create headers•Write code•Test

Page 18: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 19

Object Oriented Design

• OOD transforms the analysis model created using OOA into a design model that serves as a blueprint for software construction.

• OOD results in a design that achieves a number of different levels of modularity.

• Subsystems: Major system components.• Objects: Data and the operations.• Four important software design concepts:

– Abstraction– Information Hiding– Functional Independence– Modularity

Page 19: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 20

OOD

• The subsystem layer: Representation of each of the subsystems that enable the software to achieve its customer defined requirements.

• The class and object layer: The class hierarchies, (generalization) and representation of objects.

• The message layer: The design details of communication of each object with its collaborators. (external and internal interfaces)

• The responsibilities layer: Data Structure and algorithmic design for all attributes and operations.

responsibilitiesdesign

messagedesign

class and objectdesign

subsystemdesign

Page 20: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 21

OOA to OOD

Object-relationship

model

Object-BehaviorModel

CRCIndex Cards

Attributes, operations,collaborators

THE ANALYSIS MODEL

responsibilitiesdesign

messagedesign

Class and objectdesign

subsystemdesign

THE DESIGN MODEL

Use cases

Page 21: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 22

OOA to OOD

classesclassesattributesattributesmethodsmethodsrelationshipsrelationshipsbehaviorbehavior

Analysis ModelAnalysis Model

objectsobjectsdata structuresdata structuresalgorithmsalgorithmsmessagingmessagingcontrolcontrol

Design ModelDesign Model

Page 22: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 23

Design Issues

• decomposability—the facility with which a design method helps the designer to decompose a large problem into subproblems that are easier to solve;

• composability—the degree to which a design method ensures that program components (modules), once designed and built, can be reused to create other systems;

• understandability—the ease with which a program component can be understood without reference to other information or other modules;

• continuity—the ability to make small changes in a program and have these changes manifest themselves with corresponding changes in just one or a very few modules;

• protection—a architectural characteristic that will reduce the propagation of side affects if an error does occur in a given module.

Page 23: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 24

Process Flow for OOD

Page 24: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 25

Unified Modeling Language

Page 25: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 26

UML Diagram – What is UML?

The Unified Modeling Language (UML) is a standard language for

Specifying Visualizing Constructing Documenting

Business Modeling Communications

Page 26: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 27

Different Views

Users Designers Analyzers

Page 27: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 28

UML- Eight Diagrams and One Language

• Use Case Diagram• Class Diagram/Object Diagram• State Diagram• Sequence Diagram• Collaboration Diagram• Activity Diagram• Component Diagram• Deployment Diagram

Page 28: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 29

Use case diagram

Online C2C shopping

• overview the usage requirements• presentations project stakeholders• "the meat" of the actual requirements

Actor

Actor:

An actor is a person, organization, or external system that plays a role in one or more interactions with your system

Use case

Use case:

A use case describes a sequence of actions that provide something of measurable value to an actor and is drawn as a horizontal ellipse

System boundary

System boundary:

indicates the scope of your system.  Anything within the box represents functionality that is in scope and anything outside the box is not

Page 29: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 30

Class Diagram

Class diagrams show the classes of the system, their interrelationships (including inheritance, aggregation, and association), and the operations and attributes of the classes.

Name

Attributes

Operations

Relations

• Associations• Aggregation

• Generalization

Page 30: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 31

Relationships between Class Diagrams

• Association -- a relationship between instances of the two classes. There is an association between two classes if an instance of one class must know about the other in order to perform its work. In a diagram, an association is a link connecting two classes.

• Aggregation -- an association in which one class belongs to a collection. An aggregation has a diamond end pointing to the part containing the whole.

• Generalization -- an inheritance link indicating one class is a superclass of the other. A generalization has a triangle pointing to the superclass.

Page 31: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 32

Activity Diagram

Activity diagrams describe the workflow behaviour of a system

Start

Fork

Branch

MergeJoint

End

Page 32: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 33

State Machine Diagram

A State Machine diagramshows the possible states ofthe object and the transitionsthat cause a change in state.

? What is different between activities and Statemachine diagram

Page 33: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 34

Sequence Diagram

• A Sequence diagram depicts the sequence of actions that occur in a system. The invocation of methods in each object, and the order in which the invocation occurs is captured in a Sequence diagram.

Page 34: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 35

Collaboration Diagram

• The collaboration diagram illustrates messages being sent between classes and objects (instances).

Page 35: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 36

Component Diagram

• A component diagram in the Unified Modeling Language, depicts how components are wired together to form larger components and or software systems.

Page 36: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 37

Deployment Diagram

• deployment diagram specifies a set of constructs that can be used to define the execution architecture of systems that represent the assignment of software artifacts to nodes.

Page 37: Ooad

www.intelligroup.com | Copyright © 2009 Intelligroup, Inc. | | PRIVATE AND CONFIDENTIAL | INTELLIGROUP proprietary. 38

QUESTIONS