Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

(2019) Chap 1 OOP Vs SP

Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

25-Sep-19

CHAPTER 1:
OBJECT ORIENTED PROGRAMMING

STRUCTURED PROGRAMMING

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

LESSON OUTCOMES

Upon completion of this chapter, students should be able to:


 Understand the concept of structured programming approach
 Describe the limitation of structured programming approach
 Understand the concept of object-oriented programming approach
 Explain the differences of structured programming and object-oriented
programming approach

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

1
25-Sep-19

STRUCTURED PROGRAMMING
Is a top-down approach in programming
 Using function (emphasize on doing things such as withdraw, calculate,
transfer )
 Program is divided into modules to perform a specific task
 Every module has its own data and function which can be called by other
module
 Each structure has a single entry and a single exit point.
Three structures of structured programming approach:
 Sequence – perform an action
 Selection – select an action (if – true/false)
 Iteration – repeat an action (while/for/do-while)

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

EXAMPLE TOP DOWN APPROACH

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

2
25-Sep-19

STRUCTURED PROGRAMMING

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

STRUCTURED PROGRAMMING

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

3
25-Sep-19

STRUCTURED PROGRAMMING

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

STRUCTURED
PROGRAMMING
Advantages of Structured
Programming:
 Easier to read and understand
 User friendly
 Easier to maintain
 Development is easier as it requires
less effort and time
 Easier to debug

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

4
25-Sep-19

STRUCTURED
PROGRAMMING
 Limitations of Structured Programming:
 Repetitive codes cause a longer program than necessary.
 Error control maybe harder to manage.
 Debugging could be difficult because the program will
look and perform correctly in one part of the program but
not in another section.
 The structure of the program needs to be well-planned.
 Changing a single data will require changes at all parts of
the program.
 Lack of reusability of code.
 Can support the software development projects easily up
to a certain level of complexity. Once it goes beyond limit,
it becomes difficult to manage.

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

OBJECT ORIENTED
PROGRAMMING
 Is a programming approach that focuses on using
OBJECTS to design and build applications.
 For example : Bank – customer, money, account
 3 basic concepts (PIE):
 polymorphism
 inheritance
 encapsulation
 Other important concepts
 classes
 objects
 data abstraction

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

5
25-Sep-19

OBJECT ORIENTED PROGRAMMING

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

OBJECT ORIENTED
PROGRAMMING
 Characteristics of OOP:
 It gives importance to data (object) rather than
procedure (process)
 Programs are divided into objects
 Data is hidden
 Objects may communicate with each other
 New data and function can be easily added
 Employ bottom-up approach
 in OOP , you first write a base class, and
constantly derive new child classes from the
existing one (like car class will probably derive
from a class called vehicle)

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

6
25-Sep-19

OBJECT ORIENTED PROGRAMMING

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

OBJECT ORIENTED
PROGRAMMING
Advantages of OPP:
 Avoid redundancy in code and use existing
class (reusability).
 Save time and high productivity
 Secure program codes
 Easy to partition the work based on objects
 Easy to upgrade from smaller to larger
system
 Software complexity can be managed

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

7
25-Sep-19

STRUCTURED vs. OBJECT ORIENTED

STRUCTURED OBJECT ORIENTED


Focuses on process Focuses on data
Using top-down approach Using bottom up approach
Programs are divided into small self- Programs are divided into small entities
contained functions called objects
Less secure as there is no way of data More secure since it has data hiding
hiding features
Can solve moderately complex Can solve any complex programs
programs More reusability, less function
Less reusability, more function dependency
dependency More abstraction, more flexibility
Less abstraction, less flexibility

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

CSC238 OBJECT ORIENTED PROGRAMMING|YUSNITA SOKMAN|SEPT2019-JAN2020

You might also like