37
ObjectOriented Modeling and Design with UML Subject Code :140703

OOAD chapter 1

Embed Size (px)

DESCRIPTION

gtu syllabus

Citation preview

Page 1: OOAD chapter 1

Object‐Oriented Modeling and Design with UML

Subject Code :140703

Page 2: OOAD chapter 1

Contents

IntroductionObject-oriented (OO) conceptOO characteristicsOO developmentOO themesSummary

Page 3: OOAD chapter 1

SOFTWARE ENGINEERING

Page 4: OOAD chapter 1

Introduction

• OO modeling and design is a way of thinking about problems using models organized around real world concepts

Page 5: OOAD chapter 1

Introduction …

• Fundamental construct is the object, which combines both data structure and behavior

• OO modeling and design promotes– Better understanding of requirements

• Analysis Design Implementation

object‐oriented notations & process

Page 6: OOAD chapter 1

Contents

IntroductionObject-oriented (OO) conceptOO characteristicsOO developmentOO themesSummary

Page 7: OOAD chapter 1

OO characteristics (1/4)Identity

– Data is quantized into discrete, distinguishable entities called objects

– Each object has is own inherent identity• Two objects are distinct even if all their attribute values are

identical

– Each object has a unique handle by which it can bereferenced• Handle in various ways such as an address, array index, or

artificial number

Page 8: OOAD chapter 1

OO characteristics (2/4)Classification

• Objects with the same data structure (attributes) andbehaviour (operations) are grouped into a class

• A Class is an abstraction that describes properties importantto an application and ignores the rest•Each class describes an infinite set of individual objects•An Object is an instance of a class

Polygon objects Polygon classabstract Attributes Operations

into vertices draw

border color erase

fill color move

Page 9: OOAD chapter 1

Objects and Classes

Page 10: OOAD chapter 1

Examples for Class & Object

Page 11: OOAD chapter 1

OO characteristics

Classification• Objects with the same data structure (attributes) and

behaviour (operations) are grouped into a class• A Class is an abstraction that describes properties important to an application and ignores the rest•Each class describes an infinite set of individual objects

Polygon objects Polygon classabstract Attributes Operations

into vertices draw

border color erase

fill color move

Page 12: OOAD chapter 1

An Object is an instance of a class

Page 13: OOAD chapter 1

Derive the instances for the class

Attributes Operations/Methods

Class Object

Attributes Values Operations/Methods

? ?

Page 14: OOAD chapter 1

OO characteristics(3/4)Inheritance

Sharing of attributes and

operations (features) among

classes based on a hierarchical

relationship

• Super class has generalinformation that subclassesrefine and elaborate• Each subclass incorporates,or inherits, all the features of itssuper class and adds its ownunique features

Greatly reduce repetition•Ability to factor out commonfeatures of several classes into asuper class

Page 15: OOAD chapter 1

OO characteristics (4/4)Polymorphism

• Same operation behaves differently for different classes• An operation is a procedure or transformation that an

object performs• Method

– An implementation of anoperation by a specific class

– Each object “ knows how”to perform its own operation.

– OO operator is polymorphic

Page 16: OOAD chapter 1

Contents

IntroductionObject-oriented (OO) conceptOO characteristicsOO developmentOO themesSummary

Page 17: OOAD chapter 1

OO development (1/6)• Essence of OO development

– Identification and organization of application concepts rather than theirfinal representation in programming language.

Modeling concepts, not implementation– Focus on analysis and design

– Encourages software developers to work and think

– Should be identified, organized, and understood• Premature focus on implementation restricts design choices• Design flaws during implementation costs more and leads toinferior product

– Conceptual process independent of a programming language (OO is fundamentally a way of thinking and not programming techniques.

Page 18: OOAD chapter 1

OO development (2/6)

• OO Methodology– Process for OO development with graphical notation (OO

Concepts)– Methodology = building a model + adding details during

design– Same notation is used from

• analysis design implementation.• Information added in one stage is not lost and

transformed to next stage

Page 19: OOAD chapter 1

Methodology Stages

• System Conception

• Analysis

• System Design

• Class Design

• Implementation

Page 20: OOAD chapter 1

Methodology StagesSystem conception (1/5)s/w development begins with business analyst and formulate tentativerequirements

Analysis(2/5)• Restates the requirements from system conception by constructing

models

• Analyst must work with the requestor to understand the problemstatements

• Analysis model (abstract) describes what to system must do,

and not how it will do.( no implementation decisions)

Domain model‐ description of all the module related to given problem

Application model‐ description about a specific task(visible to the user)

• Application experts who are not aprogrammer can understand &criticize good model

Presenter
Presentation Notes
Conception – beginning, initial stage.
Page 21: OOAD chapter 1

System Design(3/5)

• System architecture – solving the application problems

• System designer decides 

– what performance characteristics to optimize

– Choose a strategy of attacking the problems.

– Make tentative resource allocation.

Presenter
Presentation Notes
Strategy- A method or plan chosen to bring about a desired future Optimize- best result
Page 22: OOAD chapter 1

Methodology Stages Class Design(4/5)

• Add details to the analysis model (based 

on system design strategy)

• Class designer elaborates both domain and application objects using the same OO concepts& notation.

• Focus is to implement the data structure and algorithm.

Page 23: OOAD chapter 1

Methodology Stages Implementation(5/5)

• Implementer translate class and relationship

Programming language, DB, H/W

• Programming should be straight forward (hard decision are already made)

• Follow good software engineering practice (S/M remains flexible & extensible)

Page 24: OOAD chapter 1

OO development (3/6)Modeling

A model is a simplification of reality

Abstraction for the purpose of understanding beforebuilding it

Purpose

• Testing a physical entity before building it• Communication with customers• Visualization• Reduction of complexity

Isolate those aspects which are important and suppressthe rest(unimportant)

Page 25: OOAD chapter 1

Class 

State

Interaction

Design a System

For the objects in the system and their relationship

For the life history of the object

For the interaction among the objects

Page 26: OOAD chapter 1

OO development (4/6)Three models

Class model

• Function• Describes the static structure of the object in the system –

identity, relationship to other object, attributes, operations

•“data” aspects of the system

• Provides context for state and interaction model• Goal

• Capture important concepts of an application from the realworld

• Representation• Class diagrams

• Generalization, aggregation

Nodes: ClassArc: relationship B/W Classes

Graph

Presenter
Presentation Notes
Context-idea Generalization – relationship between classes (super class, subclass)
Page 27: OOAD chapter 1

OO development (5/6)Three models (Cont’d)

State model• Function

• Describes objects’ time and sequencing of operation

• Goal

• Capture “control” aspect of system that describes thesequences of operations that occur

• Representation

• State diagrams

Graph : nodes-states ; arcs- transaction between states

Page 28: OOAD chapter 1

OO development (6/6)Three models (Cont’d)

Interaction model• Function

• Describes interactions between objects• Individual objects collaborate to achieve the behavior of thewhole system

• Goal• Exchanges between objects and provides a holistic overviewof the operation of a system

• Representation• Use cases, sequence diagrams, activity diagrams

Functionality of the system Interaction of the object and their time sequence

Elaborates important processing

Page 29: OOAD chapter 1

Contents

IntroductionObject-oriented (OO) conceptOO characteristicsOO developmentOO themesSummary

Page 30: OOAD chapter 1

OO themes (1/6)Abstraction

•Focus on essential aspects of an application while ignoringthe details

•What an object is and does, before deciding how toimplement

• Preserves the freedom to make decision as long aspossible by Avoiding premature commitments to details

Just like a skeleton.You can fit anything onit you like.

Page 31: OOAD chapter 1

Example

• A class called Animal. 

• It has properties like ears,colour, eyes but they are not defined.

• It has methods like Running(), Eating(), etc. but the method does not have any body

• all animals will have the above properties and methods but you decide how to do them. 

• sub class of the class Animal called Tiger. 

Color is yellow

running is very fast

color is black

running is very slow

Page 32: OOAD chapter 1

OO themes (2/6)Encapsulation

Separates the external aspects of an object from internalimplementation

Data structure and behaviour is encapsulated in a singleentity

Ensuring reliability and maintainability

• Information exchange is done by public interface amongobjects

• Change internal data structure does not affect otherobjects

Page 33: OOAD chapter 1

Example

• capsule that the doctor gives us

• We just have to take the capsule to get better

• don't have to worry about– what medicine is inside the capsule or

– how it will work on our body.

• user does not have to worry how this methods and properties work.

Page 34: OOAD chapter 1

OO themes (3/6)Combining data and behavior

Data structure hierarchy matches the operationinheritance hierarchy

Isdata structure hierarchy

procedure hierarchy

Old approach

replacedby

class hierarchy

OO approach

Page 35: OOAD chapter 1

OO themesSharing (4/6)

No redundancy (Inheritance)Reusability (tools- abstraction, inheritance, encapsulation)

Emphasis on the essence of an object (5/6)Focus on what an object is

• Rather than how it is used

Synergy (6/6)Identity, classification, polymorphism, inheritance

• Be clearer, more general and robust

Presenter
Presentation Notes
Synergy- working together Robust- strong and healthy
Page 36: OOAD chapter 1

Contents

IntroductionObject-oriented (OO) conceptOO characteristicsOO developmentOO themesSummary

Page 37: OOAD chapter 1

SummaryObject-oriented development

Low cost in system maintenanceAdequate delivery on user’s requests

• Flexible and elastic in frequent system change

ReusabilityReliabilityMake easier team working and communication