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

Physically Detached Yet Academically Attached

Week 15 Overview of Programming Language


Lesson Title Software Security Practices
Contrast the differences between the structured and object-
Learning Outcome(s)
oriented programming paradigms

At SJPIICD, I Matter!
LEARNING INTENT!
Terms to Ponder

Structured programming allows developing a program using a set


of modules or functions.

Object oriented programming allows constructing a program


using a set of objects and their interactions.

Computer program is a set of instructions that instruct the CPU to


perform a defined task

Object-oriented design Patterns that imply mutable state may be


unsuited for functional programming languages.

Essential Content

Difference Between Structured and Object Oriented


Programming

The main difference between structured and object oriented


programming is that structured programming allows developing a
program using a set of modules or functions, while object oriented
programming allows constructing a program using a set of objects
and their interactions.

A computer program is a set of instructions that instruct the


CPU to perform a defined task. We can write computer programs
using various programming languages. Furthermore, a
programming paradigm is a way of categorizing a programming
language depending on its features. Two such paradigms are
structured and object oriented programming.
Physically Detached Yet Academically Attached
Physically Detached Yet Academically Attached

Image source = https://pediaa.com/wp-content/uploads/2019/06/Difference-Between-Structured-and-Object-Oriented-


Programming-Comparison-Summary-579x1024.jpg

What is Structured Programming

Structured Programming divides a program into a set of


functions or modules.

Modular programming is another name for this

These functions have statements embraced inside curly


braces. Each of these functions performs a subtask. Usually, as
each function represents a specific functionality, it is easier for the
programmer to test and debug the code, but this can differ
depending on the program. C language and Pascal are two common
structured programming languages.

In the structured programming C, the user can create his own


user-defined functions. The main function calls the other functions.
It indicates the execution of the program. When there is a function
call, the control is passed to that function. After completing the
function, the control passes back to the main program. Moreover, a
Physically Detached Yet Academically Attached

variable inside a function is a local variable, and global variables


are accessible by all the functions.

What is Object Oriented Programming?

Object oriented programming allows the programmer to


represent real-world scenarios using objects. An object is any entity
that has states and behaviours. States represent the attributes or
data of an object, whereas the methods represent the behaviours of
objects. Student, Employee, Book etc. are objects. These objects
interact with other objects by passing messages. Furthermore, a
class is a blueprint for creating an object. It is necessary to have a
class to create objects. For example, to create an Employee object,
there should be an Employee class.

In addition to classes and objects, there are four major pillars


in OOP. They are as follows.

x Encapsulation – Binds or combines properties and methods into


a single unit
x Inheritance – Allows a class to use properties and methods of an
already existing class
x Polymorphism – Allows an object to perform in multiple ways –
Overloading and overriding are two ways of achieving
polymorphism.
x Abstraction – Hides the internal details and displays only the
functionalities to the user – Moreover, abstract classes and
interfaces help to achieve abstraction.
Physically Detached Yet Academically Attached

Overall, object oriented programming makes it easier to develop


the program. Furthermore, it provides data security,
maintainability and code reusability.

Difference Between Structured and Object Oriented


Programming

Structured programming is a programming paradigm which


divides the code into modules or function, while OOP is a
programming paradigm based on the concept of objects, which
contain data in the form of fields known as attributes, and code in
the form of procedures known as methods. Thus, this explains the
main difference between structured and object oriented
programming.

x Main Focus
o Furthermore, structured programming focuses on dividing
the program into a set of functions in which each function
works as a subprogram while object oriented programming
focuses on representing a program using a set of objects
which encapsulates data and object.

x Modification
o Moreover, it is difficult to modify the structured programs
while it is easier to modify the Object Oriented programs.

x Communication
o In structured programming, the main method communicates
with the functions by calling those functions in the main
program whereas, in object oriented programming, the
objects communicate with each other by passing messages.
Hence, this is an important difference between structured
and object oriented programming.

x Access Specifiers
o There are no access specifiers in structured programming
while there are access specifiers such as private, public and
protected in Object Oriented Programming. Thus, this is also
an important difference between structured and object-
oriented programming.

x Security
o Besides, data is not secure in structured programming, but it
is secure in object oriented programming.
Physically Detached Yet Academically Attached

x Code Reusability
o Also, it is difficult to reuse code in structured programming,
whereas it is easier to reuse code in object oriented
programming.

SELF-SUPPORT: You can click the URL Search Indicator below to help you further understand the lessons.
Search Indicator
https://en.wikipedia.org/wiki/Structured_programming
https://en.wikipedia.org/wiki/Object-oriented_programming

You might also like