0% found this document useful (0 votes)
60 views

Lecture I

The document discusses object-oriented analysis and design (OOAD) and structured programming. It provides a case study of a car inspection system to illustrate the differences between structured and object-oriented approaches. Specifically: 1) Structured programming breaks the system into functions and data but results in complex, difficult to maintain code. Object-oriented programming combines data and functions into objects to better model real-world entities. 2) The case study shows how an object-oriented model with classes like Vehicle, Owner, and InspectionSticker is more extensible than a structured function-based approach. 3) Benefits of the object-oriented paradigm include easier understanding of systems by modeling real objects, localization of changes

Uploaded by

neooo111
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views

Lecture I

The document discusses object-oriented analysis and design (OOAD) and structured programming. It provides a case study of a car inspection system to illustrate the differences between structured and object-oriented approaches. Specifically: 1) Structured programming breaks the system into functions and data but results in complex, difficult to maintain code. Object-oriented programming combines data and functions into objects to better model real-world entities. 2) The case study shows how an object-oriented model with classes like Vehicle, Owner, and InspectionSticker is more extensible than a structured function-based approach. 3) Benefits of the object-oriented paradigm include easier understanding of systems by modeling real objects, localization of changes

Uploaded by

neooo111
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

OOAD

Prabhu Sunderaraman
[email protected]
Structured Programming
 Look at the problem
 Design a collection of functions
 Break down the functions into smaller pieces;
Functional Decomposition
 Identify the characteristics or data
 Define them globally
 Map the functions with the required data
A simple case study
 Transportation department wants a software to
inspect Cars and issue an Inspection sticker to
the Car owners.
 The car should be inspected for
 Lights, Brakes
 Honks, Wiper
 Emission Control (CO < 0.5%)
 Insurance Papers
 Owner Information (License, Registration etc)
Functions
getOwnerDetails() {…..}
checkForInsurancePapers() {…..}
checkForLights() {…..}
checkForHonk() {…..}
checkForWiper() {…..}
checkForEmissionControl()
{
if (CO < 0.5%) {…..}
}
checkForBrakes() {…..}
printCarInspectionSticker() {…..}
Data
 Data model required to support the functions
 Hold information about Car, Owner, Car
Inspection Sticker, Insurance Papers
 Data can be in a structure or module or DB
tables struct Car
{ … }
struct Owner
{ … }

struct InsurancePapers
{ … }
Functions, data & the dependencies
getOwnerDetails() {…..}
checkForInsurancePapers() {…..} Car
checkForLights() {…..}
checkForHonk() {…..}
checkForWiper() {…..} Owner

checkForEmissionControl()
{
if (CO < 0.5%) {…..} Insurance
Sticker
} Papers

checkForBrakes() {…..}
printCarInspectionSticker() {…..}
What’s the point?

Inspect not just Cars - inspect Trucks & Buses


Ripple effect
switch (vehicleType) // Algorithmic approach
{
case CAR:
getCarDetails, checkEmissionControl < 0.5%
break;

case TRUCK:
getTruckDetails, checkEmissionControl < 0.2%
break;

case BUS:
getBusDetails, checkEmissionControl < 0.1%
break;
}

CODE JUST BREAKS!!


Structured Programming: Issues
 System becomes too complex
 Data and functions are scattered throughout

 Accommodate change in requirements is a pain


 Maintenance and debugging is an issue
Object Oriented Programming
 Lessens the impact of the problem
 Combines data and functions into the same
module
 Modules can talk to each other directly
 Small gap between reality and model
 Modifications are localized
 Confined to a module
 Module is the Object
OO Approach
Vehicle
Owner
yearOfMake
color
getOwnerInfo

checkForHonk
checkForEmission
InsurancePapers
checkForLights
printSticker

InspectionSticker
Car Truck
….. …..
checkForEmission checkForEmission
checkForLights checkForLights
Benefits of OO Paradigm
 Models System using Objects
 Understanding the system is easier
 No change to your existing code (almost)
 If designed properly, of course!
 Extensibility
OO Paradigm
 Collection of discrete objects
 Characteristics & Behavior
 Data & Functions
 Attributes & Methods

 OO principles
 Abstraction
 Encapsulation
 Hierarchy
 Polymorphism
Abstraction

“A simplified description ...


of a system that emphasizes some of the system’s
details ... while suppressing others”

“An abstraction denotes the essential characteristics of an


object that distinguish it from all other kind of objects
and thus provide crisply defined conceptual
boundaries, relative to the perspective of the viewer”
Encapsulation
 Information hiding
 Interface - Implementation

 Behavior & Data

“Encapsulation is the process of


compartmentalizing the elements of an
abstraction that constitute its structure and
behavior; encapsulation serves to separate the
contractual interface of an abstraction and its
implementation”
Hierarchy

“Hierarchy is a ranking of abstractions”

Inheritance :
expresses “is-a” or “Kind-of” relationship
 Extensibility & Reusability
Part-of:
expresses that object is an aggregate of another
Polymorphism

Hiding alternative procedures


behind a Common Interface

Send a Message to an object - Polymorphism


guarantees that the correct/proper implementation
is invoked.

Sender does not know specific class of receiver


Objects
 “Concept, abstraction, or thing
with crisp boundary & meaning for a problem”
 An Object has state and behavior
 Objects receive stimuli/messages & respond
 Receiving a stimulus, Object may change state
Class

 Group of Objects with similar


 properties (attributes)
 behavior

 relationships to other objects


 semantics
 Blueprints of Objects
Objects and Classes
 Decomposing problem into objects
 depends on judgement & nature of problem

 No one correct representation

 Objects have identity

 Often appear as nouns in problem descriptions

 Each class may have zero, one or more objects

 Each object knows it class


Analysis and Design
 Analysis
 Investigation of the problem and requirements
 Requirement Analysis, object analysis

 Design
 Conceptual solution that fulfills the requirements,
rather than its implementation
OOAD
 OO Analysis
 Identifying the objects in the problem domain

 OO Design
 Implementing the relationships between objects,
identifying the attributes, functionalities

 Where does this fit in software development?


Activities in System Development
Requirements

Analysis

Design

Implementation

Testing System
Development Methods

 Waterfall method

 Iterative and Incremental Development


Waterfall Method
Requirements

Analysis

Design

Implementation &Testing

Integration

Maintenance
Problems with Waterfall
 Difficult to complete one phase of a software product's
lifecycle

 Clients may not be aware of exactly what requirements


they want before they see a working prototype

 Designers may not be aware of future implementation


difficulties when writing a design

 Things become clear in the implementation phase


Iterative and Incremental
 Neither top-down nor bottom-up

 Successive Refinement of the OO Architecture


 Apply Experience & Results to next iteration
Iterative and Incremental

Analysis

Design Requirements
Specification

Implementation
& Unit Testing

Integration

Booch’s Approach:
Micro Development Process (Spiral)
Versions of a Project
 Full requirements are not given at start
 Full requirements are not known
 Full development may take several years

Start Version 1 Version 2 Version 3 ...

Requirements Analysis Design Implementation

System
Testing
Incremental Development
Reasons:
 Requirements are not very clear
 Requirement changes in the mean time
 Feedback will help “steer” the project
 Feedback helps new requirements
Each stage adds new functionality

Stage 1 Stage 2 Stage 3 . . . Stage n ... Release Time


Iterative and Incremental
development

Waterfall inside each slice


Process
Requirements

Software Development process

Software system

 Unified Process
 unified, cohesive and comprehensive methodology
 Inception to Deployment
 A Framework from Rational Corporation
Unified Process

Use-case driven
Architecture-centric

Iterative-incremental

The goal of this process is the production of software.


Software that works, software that is on time, software that is
within budget, software that can be maintained, software that
can be reused.
Use-Case Driven
 Remember the User?!
 What does the user want and need from the system
 Use-case
 interaction by the user and the system’s response
 captures functional requirements

 Use-case Model
 All use-cases make up complete functional model
 What does the system do for each user?

 What do you do with it?


Architecture Centric
 Sits at the heart of the project team's efforts to
shape the system

 No single model is sufficient to cover all aspects


of a system

 Unified Process supports multiple architectural


models and views
UP phases
 Life cycle of a process organized into 4 phases
 Inception
 Elaboration
 Construction
 Transition
Iterations

Inception Eloboration Construction Transition


Inception
 Scope the system

 Validating initial costing and budgets

 Few days time not more than that


Elaboration
 Get started with the project

 Requirement Analysis
 Use cases
 Calculate the risks
 Requirements, Technological, Skills, Political
 Building prototypes, Training etc

 Determine what exactly are you going to build


Construction
 Iterative development starts here
 Start implementing the high risk , high priority
requirements
 Timespan of iterations depends on the project
 Smaller the better
 Each iteration will involve rewriting some code
 Techniques like Refactoring are used here
Transition
 Testing the software

 Optimization

 Performance Tuning

 Get ready for deployment

You might also like