(2019) Chap 1 OOP Vs SP
(2019) Chap 1 OOP Vs SP
(2019) Chap 1 OOP Vs SP
CHAPTER 1:
OBJECT ORIENTED PROGRAMMING
STRUCTURED PROGRAMMING
LESSON OUTCOMES
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)
2
25-Sep-19
STRUCTURED PROGRAMMING
STRUCTURED PROGRAMMING
3
25-Sep-19
STRUCTURED PROGRAMMING
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
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.
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
5
25-Sep-19
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)
6
25-Sep-19
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
7
25-Sep-19