Vous êtes sur la page 1sur 13

TOPIC 1

OOP vs Structured Programming


CSC238

Content

Structured Programming

Structured Programming Limitation

Object Oriented Programming(OOP)

Structured vs OOP

Structured Programming
Dividing
a
problem
into
smaller
subproblems.
Each subproblem is then analyzed and a
solution for the subproblem is obtained.
The solutions to all the subproblems are
then combined to solve the overall
problem.
This process of implementing a structured
design is called structured programming.

Top Down approach


A Single module will be split into several smaller modules
General to Specific
Bottom Up approach
Lot of small modules will be grouped to form a single large
module
Specific to General
If the requirements are clear at the first instance we
can go for Top down approach
In circumstances where the requirements may keep on
adding, we go for Bottom up approach

Limitation Structured Programming


a. Structured Programming is hard and
takes a long time to master
b. It concentrates on doing things. (Eg.
Algorithms)
c. Large programs are divided into
smaller programs called Functions
d. Most of the Functions share global
data
e. Data is accessible from one function
to another
f. Top down Approach

Object Oriented Programming


OOP is a programming style that is focused on
objects
Important Features of OOP
Abstraction
Encapsulation
Inheritance
Polymorphism

History of C++
Extension of C
Early 1980s: Bjarne Stroustrup (Bell
Laboratories)
Originally named C with Classes.
Provides capabilities for object-oriented
programming
Objects: reusable software components
Model items in real world
Object-oriented programs
Easy to understand, correct and modify
Hybrid language
C-like style
Object-oriented style

Structured Programming
MAIN PROGRAM

FUNCTION
1

FUNCTION 4

FUNCTION 2

GLOBAL DATA

FUNCTION 3

FUNCTION 5

Using function
Function & program is divided into modules
Every module has its own data and function which can
be called by other modules.

OBJECT ORIENTED PROGRAMMING


Object 2

Object 1

Data

Data

Function

Function

Object 3
Data
Function

Objects have both data and methods


Objects of the same class have the same data elements and
methods
Objects send and receive messages to invoke actions

Structured Vs OOP

Structured

OOP

Focuses on Process

Focuses on Object

Follows Top-down, Bottomup, stepwise refinement


and modular programming
Approach

Follows Object oriented


design

Structured VS OOP

Structured VS OOP
Structured
programming
is
task-centric,
oriented programming is data-centric.

object

Structured programming is based around data


structures and subroutines. The subroutines are where
stuff actually "happens", and the data structures are
simply containers for the information needed by those
subroutines.
Object oriented programming, on the other hand,
shifts your primary focus to the data itself. Instead of
asking "what do I want to do and what will I need to
know to do it", you ask "what kind of things do I want
to have and what can those things do for me". Instead
of designing your functions first and then coming up
with data structures to support them, you design types
first and then come up with the operations needed to
work with them.

Vous aimerez peut-être aussi