Object-Oriented Programming An Overview - Java with Object
Transcript of Object-Oriented Programming An Overview - Java with Object
![Page 1: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/1.jpg)
'
&
$
%
Object-Oriented Programming
An Overview
OOP-1
![Page 2: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/2.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/3.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/4.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/5.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/6.jpg)
'
&
$
%
OOP Central Concepts
• Data abstraction
• Encapsulation
• Classification
• Inheritance
• Polymorphism
OOP-6
![Page 7: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/7.jpg)
'
&
$
%
OOP Characteristics
• Class definitions
• Inheritance and class hierarchy
• Operator and Function overloading
• Generic classes
• Class libraries
OOP-7
![Page 8: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/8.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/9.jpg)
'
&
$
%
Traditional vs. OOP
• Procedural Programming :
data structures + algorithms = Program
• OOP :
objects + messages = Program
OOP-9
![Page 10: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/10.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/11.jpg)
'
&
$
%
An Object
Internalworking
interface
Public
Methodcall
OOP-11
![Page 12: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/12.jpg)
'
&
$
%
Inheritance Example
Engine
Steering
Breaks
Doors
Wheels
Tires
Auto Sedan
2−4 Doors
4 Wheels
Radio
Trunk
Inherits
OOP-12
![Page 13: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/13.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/14.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/15.jpg)
'
&
$
%
Inheritance Concepts
• Deriving new classes from old ones
• Single inheritance
• Partial inheritance
• Multiple inheritance
• Inheritance chain
OOP-15
![Page 16: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/16.jpg)
'
&
$
%
Generic Classes
• Class definition for unspecified data
• Container class
• Flexible and reusable
OOP-16
![Page 17: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/17.jpg)
'
&
$
%
Reusability Considerations
• Pipes / filter (ala UNIX): slow, restrictive
• Subroutine libraries: fast, inflexible
• Object libraries: flexible, and efficient
OOP-17
![Page 18: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/18.jpg)
'
&
$
%
Design Approaches
• Ways to Break The Problem Down
• Procedural decomposition
• Data decomposition
• Object-oriented decomposition
OOP-18
![Page 19: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/19.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/20.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/21.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/22.jpg)
'
&
$
%
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: Object-Oriented Programming An Overview - Java with Object](https://reader030.fdocuments.net/reader030/viewer/2022021007/620391bfda24ad121e4af04e/html5/thumbnails/23.jpg)
'
&
$
%
Potential Disadvantages
• Over generalization
• Artificial class relations
• Unnecessary complications
OOP-23