23
Object-Oriented Programming An Overview OOP-1

Oop Overview

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Oop Overview

'

&

$

%

Object-Oriented Programming

An Overview

OOP-1

Page 2: Oop Overview

'

&

$

%

Contents

• OOP and software productivity

• Features and characteristics of OOP

• Major concepts of OOP

• OOP languages

• OOP and traditional design

• Advantages and disadvantages

OOP-2

Page 3: Oop Overview

'

&

$

%

What is Object-Oriented Programming

• A well-regarded and widely accepted programming technology

• Potential for much improved productivity

• Uses interacting program objects

• Objects are independent entities

• Objects respond to messages

OOP-3

Page 4: Oop Overview

'

&

$

%

Software Productivity Factors

• Modularity (separation of duties)

• Extensibility (responsive to future requirements)

• Modifiability (easy to make small changes)

• Flexibility (not cast in concrete)

• Maintainability (big savings)

• Reusability (don’t reinvent the wheel)

OOP-4

Page 5: Oop Overview

'

&

$

%

Software Engineering Techniques

• Data abstraction (hidden data representation)

• Program encapsulation (operations married to data)

• Software libraries (fixed reusable)

• Reusable Objects (flexible, reusable)

• Polymorphism (type-related generic operations)

• Maintenance automation

OOP-5

Page 6: Oop Overview

'

&

$

%

OOP Central Concepts

• Data abstraction

• Encapsulation

• Classification

• Inheritance

• Polymorphism

OOP-6

Page 7: Oop Overview

'

&

$

%

OOP Characteristics

• Class definitions

• Inheritance and class hierarchy

• Operator and Function overloading

• Generic classes

• Class libraries

OOP-7

Page 8: Oop Overview

'

&

$

%

OOP Languages

• Simula

• Modula

• Smalltalk

• Ada

• Objective-C

• CLOS (Common Lisp Object Standard)

• Standard C++

• Java

• Scripting languages: Perl, Javascript, Python

OOP-8

Page 9: Oop Overview

'

&

$

%

Traditional vs. OOP

• Procedural Programming :

data structures + algorithms = Program

• OOP :

objects + messages = Program

OOP-9

Page 10: Oop Overview

'

&

$

%

Class Definition

• Blueprint for building Objects

• Members: methods and fields

• private and public

• API—application programming interface

• relation with other classes

OOP-10

Page 11: Oop Overview

'

&

$

%

An Object

Internalworking

interface

Public

Methodcall

OOP-11

Page 12: Oop Overview

'

&

$

%

Inheritance Example

Engine

Steering

Breaks

Doors

Wheels

Tires

Auto Sedan

2−4 Doors

4 Wheels

Radio

Trunk

Inherits

OOP-12

Page 13: Oop Overview

'

&

$

%

Inheritance Example

Sedan

2−4 Doors

4 Wheels

Radio

Trunk

Inherits

4 Doors

Family Sedan

AC

Automatic

Big Trunk

Fuel Economy

OOP-13

Page 14: Oop Overview

'

&

$

%

Inheritance Example

Sedan

2−4 Doors

4 Wheels

Radio

Trunk

Inherits

2 Doors

AC

Manual

Tiny Trunk

Horse power

Sports Sedan

High Price

OOP-14

Page 15: Oop Overview

'

&

$

%

Inheritance Concepts

• Deriving new classes from old ones

• Single inheritance

• Partial inheritance

• Multiple inheritance

• Inheritance chain

OOP-15

Page 16: Oop Overview

'

&

$

%

Generic Classes

• Class definition for unspecified data

• Container class

• Flexible and reusable

OOP-16

Page 17: Oop Overview

'

&

$

%

Reusability Considerations

• Pipes / filter (ala UNIX): slow, restrictive

• Subroutine libraries: fast, inflexible

• Object libraries: flexible, and efficient

OOP-17

Page 18: Oop Overview

'

&

$

%

Design Approaches

• Ways to Break The Problem Down

• Procedural decomposition

• Data decomposition

• Object-oriented decomposition

OOP-18

Page 19: Oop Overview

'

&

$

%

Procedural Decomposition

• Also known as functional or traditional design

• Decompose the solution into major steps

• Decompose each major step further

• Decomposition procedural-oriented

OOP-19

Page 20: Oop Overview

'

&

$

%

Traditional Design Disadvantages

• Data and operations are separated

• No data abstraction or info hiding

• Not responsive to changes in problem space

• Inadequate for concurrent problems

OOP-20

Page 21: Oop Overview

'

&

$

%

Object-oriented Design Principle

• Identify interacting objects

• Characterize each object, establish attributes

• Identify the data and operations within each object

• Identify requests answered by each object

• Identity services required of other objects

• Establish relationships to other objects

• Group similar objects together

• Implement common super classes

• Implement different objects as classes

OOP-21

Page 22: Oop Overview

'

&

$

%

Advantages

• Responsive to changes

• Encapsulation

• Simplify Testing, debugging

• Easy to understand

• Avoid reinventing the wheel

• Easier to manage, to maintain

• Off-the-shelf software

OOP-22

Page 23: Oop Overview

'

&

$

%

Potential Disadvantages

• Over generalization

• Artificial class relations

• Unnecessary complications

OOP-23