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

The Kurdistan Regional Government Of Iraq

Ministry Of Higher Education


Duhok Polytechnic University
Information Technology Management

Report about
Structured Programming Vs Object
Oriented
Dep: Information Technology Management
Subject: Object-oriented programming (OOP)
Stage: 2

Name of Student
Mustafa Kamal Shaban
vajin hussain younis
iman isa omer

Name of the Supervisor


Mr. Zeravan Arif
2021
Table of Contents

INTRODUCTION ......................................................................................................... 1
Structured Programming ............................................................................................... 2
Why we use Structured Programming? ........................................................................ 2
Elements Structured Programming .............................................................................. 2
Advantages .................................................................................................................... 3
Disadvantages................................................................................................................ 3
Object Oriented programming ...................................................................................... 4
The basics of object-oriented programming ................................................................. 4
Advantages of OOP ....................................................................................................... 5
Disadvantages of OOP .................................................................................................. 5
Difference Between Structured and Object Oriented Programming ............................ 6
Summary ....................................................................................................................... 7
Reference ....................................................................................................................... 8
INTRODUCTION
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.

The concepts of structured and object-oriented programming methods are not relatively new but these
approaches are still very much useful and relevant in today’s programming paradigm. we distinguish
the features of structured programs from that of object oriented programs. Structured programming
is a method of organizing and coding programs that can provide easy understanding and modification,
whereas objectoriented programming (OOP) consists of a set of objects, which can vary dynamically,
and which can execute by acting and reacting to each other, in much the same way that a real-world
process proceeds (the interaction of realworld objects). An object-oriented approach makes programs
more intuitive to design, faster to develop, more amenable to modifications, and easier to understand.
With the traditional, procedural-oriented/structured programming, a program describes a series of
steps to be performed (an algorithm). In the object-oriented view of programming, instead of
programs consisting of sets of data loosely coupled to many different procedures, objectoriented
programs consist of software modules called objects that encapsulate both data and processing while
hiding their inner complexities from programmers and hence from other objects.Object Oriented
Programming (OOP) and Structured Programming are two programming paradigms. A programming
paradigm is a fundamental style of computer programming. Programming paradigms differ in how
each element of the programs is represented and how steps are defined for solving problems. As the
name suggests, OOP focuses on representing problems using real-world objects and their behavior,
while Structured Programming deals with organizing the program in a logical structure.

Whereas, the focus of Object Oriented Programming is to break down the programming task in to
objects, which then enclose data and methods. This programming is thought to be more pliable in
comparison to structured programming. This is because OOP distinguishes a program in to a network
of sub programs instead of structuring the system in to a hierarchy. Despite, structuring offering a lot
of clarity, a little change to a very large structured system may cause a continuum of having to change
multiple sub systems, which is not efficient.

|Page1
Structured Programming
In structured programming, we sub-divide the whole program into small modules so that the program
becomes easy to understand. The purpose of structured programming is to linearize control flow
through a computer program so that the execution sequence follows the sequence in which the code
is written. The dynamic structure of the program than resemble the static structure of the program.
This enhances the readability, testability, and modifiability of the program. This linear flow of control
can be managed by restricting the set of allowed applications construct to a single entry, single exit
formats.

Why we use Structured Programming?


We use structured programming because it allows the programmer to understand the program easily.
If a program consists of thousands of instructions and an error occurs then it is complicated to find
that error in the whole program, but in structured programming, we can easily detect the error and
then go to that location and correct it. This saves a lot of time.

Elements Structured Programming


Structured programming involves 4 elements, which are sequence, iteration, selection, and
subroutines. Each of them is explained as follows:

1. Sequence

In structured programming, the code is written in sequential order so the program can follow the
approach of top to bottom. The sequence of the program also increases the readability. This means
that a human reading the code can tell what that program is doing.

2. Selection

The programming paradigm also consists of a Selection block, such as if…else statements. The
execution of the subsequent code depends upon the selection statement.

3. Iteration

In iteration, we can repeatedly execute a block of code again and again with the help of loop
statements. We can specify how many times we want to execute the same block of code.

4. Subroutines

Subroutines are the functions, methods, procedures, or subprograms which perform as a single block
of code.

|Page2
Advantages
▪ Easy to understand.

▪ Consists of statements resembling the English vocabulary.

▪ Needs less time to write code.

▪ Easier to maintain.

▪ Can be debugged easily.

▪ Most of the high-level programming languages support this paradigm.

▪ It is machine-independent. This means such a program written on one computer can run on
any other computer.

Disadvantages
▪ As it is machine-independent, we need a translator to convert it into the machine language.

▪ The program depends upon changeable factors, like data types. Therefore, it needs to be
updated with the need on the go.

▪ The translated machine code is not the same as the assembly language.
▪ The program depends on variable factors such as data types. It should therefore
update with the need for travel.
▪ Usually, the development of this approach takes more time as it depends on the
language. In terms of assembly language, development takes less time as it has
fitted to the machine.

|Page3
Object Oriented programming
Object Oriented programming (OOP) is a programming paradigm that relies on the concept of classes
and objects. It is used to structure a software program into simple, reusable pieces of code blueprints
(usually called classes), which are used to create individual instances of objects. There are many
object-oriented programming languages including JavaScript,C#, C++, Java, and Python.

The basics of object-oriented programming


• Objects: are instances of a class created with specifically defined data. Objects can
correspond to real-world objects or an abstract entity. When class is defined initially, the
description is the only object that is defined.
• Classes: are user-defined data types that act as the blueprint for individual objects, attributes
and methods.
• Data Abstraction: Abstraction refers to the act of representing essential features without
including the background details. To understand this concept more clearly, take an example
of ‘switch board’. You only press particular switches as per your requirement. You need not
know the internal working of these switches. What is happening inside is hidden from you.
This is abstraction, where you only know the essential things to operate on switch board
without knowing the background details of switch board.
• Data Encapsulation: Wrapping up of data and functions into a single unit is called as data
encapsulation. Encapsulation is the most basic concept of OOP. It is the way of combining
both data and the functions that operate on that data under a single unit. The only way to
access the data is provided by the functions (that are combined along with the data).
• Inheritance: Classes can reuse code from other classes. Relationships and subclasses between
objects can be assigned, enabling developers to reuse common logic while still maintaining a
unique hierarchy. This property of OOP forces a more thorough data analysis, reduces
development time and ensures a higher level of accuracy.
• Polymorphism: Objects are designed to share behaviors and they can take on more than one
form. The program will determine which meaning or usage is necessary for each execution of
that object from a parent class, reducing the need to duplicate code. A child class is then
created, which extends the functionality of the parent class. Polymorphism allows different
types of objects to pass through the same interface.

|Page4
Advantages of OOP
OOP is a popular programming method for various reasons, but we will highlight the most important
characteristics here.

1. Highly productive software development : OOP is a modular type of programming, which means
that it distinguishes between different duties and allows objects to be extended. In other words, objects
can be given fresh attributes and become reusable.

2. Easier software maintenance: Other programming systems require major structural changes in
case of updates or new features. On the other side, OOP makes it possible to focus on individual
modules only and simplify software maintenance.

3. Speedy development :Entire libraries of OOP objects are already available for wider usage, so it’s
easy to create and develop codes just by using the existing solution.

4. Low-cost development: Speed is not the only benefit of object reuse. Namely, developer units can
save time and money by reusing and enhancing the existing objects.

5. Improve quality through detailed testing: Programmers who save time with reused objects can
dedicate more time to testing and quality assurance.

Disadvantages of OOP
As we already mention, there are no perfect programming languages or methods. OOP also comes
with a few downsides, so let’s check them out here.

1. Programming complexity: A lot of programmers avoid OOP simply because it’s so convoluted.
Experienced developers take it for granted, but the fact remains that beginner-level programmers
don’t think OOP is userfriendly and easy to handle.

2. Large programs: A typical OOP-based system contains a lot more lines of code than software
built with other programming methodologies.

3. Slow-running programs: Compared to procedural programs, OOP systems are much slower.
That’s because more often than not OOP systems demand a whole range of instructions to be launched
and executed.

4. It’s not an all-around solution: OOP is not suitable for some sorts of programs. This downside
of OOP actually applies to all programming styles because there is no solution that suits all types of
problems.

|Page5
Difference Between Structured and Object Oriented Programming
Definition

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.

Main Focus

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.

Modification

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

Communication

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.

Access Specifiers

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.

Security

Besides, data is not secure in structured programming, but it is secure in object oriented programming.

Code Reusability

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

|Page6
Summary
Overall, structured and object oriented programming are two major programming paradigms. The
main difference between structured and object oriented programming is that structured programming
helps to develop a program using a set of modules or functions while object oriented programming
helps to construct a program using a set of objects and their interactions.

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.

|Page7
Reference

1. Lithmee,( 11June, 2019 ), Retrieved(november 16,2021), https://pediaa.com/what-is-the-


difference-between-structured-and-object-oriented-programming.
2. Alexander S. Gillis& Sarah Lewis, searchapparchitecture.techtarget, objectoriented
programming (OOP).
3. Simon Kendal, Object Oriented Programming using C#, Ventus Publishing ApS,2011.
4. javatpoint site ,Retrieved,november 16,2021, https://www.javatpoint.com/software-
engineering-structured-programming

|Page8

You might also like