Chapter 1.1.ppt
java
java
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
DFT4024
1
OBJECT ORIENTED PROGRAMMING
CHAPTER 1
Introduction to Object-Oriented Programming
(OOP)
JTMK
FNBD
Learning Outcomes
Upon completion of this topic, students should be able to:
1.1 Understand the programming techniques
1.1.1 Discuss various programming techniques that exists
1.1.2 Describe object oriented approach
1.1.3 Identify the benefits of using OOP approach
1.1.4 Describe the terms used in object oriented analysis and
design
1.1.1
Discuss various programming techniques
that exist:
a. Unstructured Programming
b. Procedural Programming
c. Object Oriented Programming
Unstructured programming
4
Unstructured Programming is historically the earliest
type of programming that was capable of creating
Turing-complete algorithms.
Written as a single continuous/nonstop or unbroken
block
Allows only basic data types (numbers, strings and
arrays)
Provides freedom to programmers to program as
they want
Often produce spaghetti code.
Procedural Programming
5
Consists of a set of procedure calls and set of codes
for each procedure
Emphasizes on separating a program’s data from its
functionality
Program executes statement by statement.
Statements are organized into procedures known as
subroutines or functions.
Compared to unstructured programming, procedural
programmingsare compact and bounded by scope.
Written in step by step manner.
Procedural Programming
6
Based on top down methodology.
System further divided into sub system.
Designed with the aids of loops, sequences and
decisions.
Object Oriented Programming
7
Emphasis on data rather than functions
A program consists of a set of objects
Pieces of code being able to go back and reuse
them.
An object’s data is hidden from external functions
Functions that operate on objects are tied to each
data
Object Oriented Programming
8
The objects communicate with one another through
functions
New data and functions can be added easily
whenever necessary.
Follows bottom-up approach
Unstructured programming vs Procedural Programming
vs Object Oriented programming
9
Unstructured
• Statements are executed in sequence
• Often difficult to understand the logic
Procedural
• Executes a set of commands in order. Practice top down approach.
• Based on procedure calls. Statements organized into procedures
known as functions.
Object-
Oriented
• Based on ‘objects’. Gives more preference to data rather than
logic
• Bottom up approach
Unstructured programming vs Procedural Programming
vs Object Oriented programming
10
Source: http://www.differencebetween.info/difference-between-procedural-structural-and-object-orientedprogramming-languages
1.1.2-
1.1.4
OOA & OOAD
1.1.2 Describe object oriented approach
1.1.3 Identify the benefits of using OOP approach
1.1.4 Describe the terms used in object oriented analysis and
design (OOAD):
a. Object oriented analysis
b. Object oriented design
c. Object oriented programming
Object Oriented approach
12
Key ideas of Object-Oriented Approach:
Objects Encapsulation Class
Inheritance Polymorphism Abstraction
Benefits of Object Oriented approach
13
Inheritance -
Code reuse
Encapsulation
Less flaws
design
Easy
maintenance
Polymorphism
-Flexibility
14
Object Oriented Analysis and Design
(OOAD)
OOAD is a software engineering approach that
modelsasystem asagroupof interactingobjects.
Each object represents some entity of interest in
the system being modeled, and is characterized
by its class, its state (data elements), and its
behavior.
Consists of two parts:
Object Oriented Analysis (OOA)
Object Oriented Design (OOD)
15
Object Oriented Analysis and Design
(OOAD)
Object Oriented Analysis
a discovery process
clarifies and documents the requirements of a system.
focuses on understanding the problem domain
discovers and documents the key problem domain
classes.
concerned with developing an object-oriented model of
the problem domain.
identified objects reflect the entities that are associated
with the problem to be solved.
16
Object Oriented Analysis and Design
(OOAD)
Object Oriented Analysis
Definition
Object Oriented Analysis (OOA) is
concerned with developing requirements and
specifications expressed as an object model
(population of interacting objects) of a
system, as opposed to the traditional data or
functional views.
17
Object Oriented Analysis and Design
(OOAD)
Object Oriented Analysis
Benefit
maintainability:simplifiedmappingto the real world
a)less analysis effort
b)less complexityin system design
c) easier verification bythe user
reusability: reuse of the artifacts that are independent
of the analysis method or programminglanguage
productivity: direct mapping to the features
implemented in Object Oriented Programming
Languages
18
Object Oriented Analysis and Design
(OOAD)
Object Oriented Analysis
OOA Phase
i. Analyze the domain problem
ii. Describe the process systems
iii. Identify the objects
iv. Specify attributes
v. Defining operations
19
Object Oriented Analysis and Design
(OOAD)
ObjectOrientedDesign
processof inventionandadaptation
creates abstractions and mechanisms
necessary to meet behavioral requirements
determinedduringanalysis
language-independent
provides an object-oriented model of a
software system to implement the identified
requirements
20
Object Oriented Analysis and Design
(OOAD)
Object Oriented Design
Definition
Object Oriented Design (OOD) is
concerned with developing object-oriented
models of a software/system to implement
the requirements identified during OOA.
21
Object Oriented Analysis and Design
(OOAD)
Object Oriented Design
OOD Phase
i. define the context and modes of use of
the system
ii. design the system architecture
iii. identify the principal objects in the system
iv. develop design models
v. specify object interfaces
Object Oriented Analysis and Design
22
(OOAD)
Object Oriented Programming
An alternative o procedural programming. The design
techniques associated with object-oriented
programming is object-oriented design.
OOP’s central modules are classesrather than
procedures.
OOP, class is a collection of objects:
Example: Class Human, the collection of objects are: you,
me, Henry, Harry, Mary
23
Object Oriented Analysis and Design
(OOAD)
Example of Object Oriented Languages
Java, C++, C#, Python, PHP, Object Pascal, Perl and
etc..
24