Docsity

Understanding Algorithms & Programming Paradigms: Procedural, OOP & Event-Driven., High school final essays of Computer science

Toggle sidebar
bg1
ALGORITHMS AND PROGRAMMING
PARADIGMS
Algorithm:
An algorithm is defined as the step by step process to solve a programming problem. An algorithm is used
to solve a problem through different methods. Before writing a code, writing an algorithm for the code at
hand is advised as it is a good practice. A programming algorithm is definedas a recipe that describes the
exact steps needed for the computer to solve a problem or reach a goal. We have all seen food recipes -
they list the ingredients needed and a set of steps for how to make the described meal. Well, an algorithm
is just like that. In computer lingo, the word for a recipe is procedure, and the ingredients are called
inputs. For instance rules to drive a vehicle on the road, brushing your teeth.
Characteristics:
An algorithm must not contain infinite steps and the steps must end in finite steps.
An algorithm may have many inputs and no inputs at all.
An algorithm should ends up in a result.
The steps in an algorithm must be clear, accurate and well defined.
An algorithm must be independent.
Advantages of an algorithm:
As an algorithm is a step by step solution of a given problem it makes it easy for the user to solve it.
Algorithm is not dependent on any of the programming language so it is quite easy for a user to
understand it.
Algorithm breaks down the problem in simple steps which helps the programmer to convert it into an
actual program.
Disadvantages of an algorithm:
An algorithm consumes time of a programmer.
It is quite difficult to show loops in an algorithm.
It is difficult to make an algorithm of big tasks.
Examples:
Some of the examples of an algorithm are given bellow:
1. Binary search:
pf3
pf4
pf5

Partial preview of the text

Download Understanding Algorithms & Programming Paradigms: Procedural, OOP & Event-Driven. and more High school final essays Computer science in PDF only on Docsity!

ALGORITHMS AND PROGRAMMING

PARADIGMS

Algorithm: An algorithm is defined as the step by step process to solve a programming problem. An algorithm is used to solve a problem through different methods. Before writing a code, writing an algorithm for the code at hand is advised as it is a good practice. A programming algorithm is defined as a recipe that describes the exact steps needed for the computer to solve a problem or reach a goal. We have all seen food recipes - they list the ingredients needed and a set of steps for how to make the described meal. Well, an algorithm is just like that. In computer lingo, the word for a recipe is procedure, and the ingredients are called inputs. For instance rules to drive a vehicle on the road, brushing your teeth.

Characteristics:

 An algorithm must not contain infinite steps and the steps must end in finite steps.  An algorithm may have many inputs and no inputs at all.  An algorithm should ends up in a result.  The steps in an algorithm must be clear, accurate and well defined.  An algorithm must be independent. Advantages of an algorithm:  As an algorithm is a step by step solution of a given problem it makes it easy for the user to solve it.  Algorithm is not dependent on any of the programming language so it is quite easy for a user to understand it.  Algorithm breaks down the problem in simple steps which helps the programmer to convert it into an actual program. Disadvantages of an algorithm:  An algorithm consumes time of a programmer.  It is quite difficult to show loops in an algorithm.  It is difficult to make an algorithm of big tasks. Examples: Some of the examples of an algorithm are given bellow:

  1. Binary search:

Binary search works in a sorted array and returns the index of the value we are searching for. Binary search is well explained in an example below : Figure 1: binary search First you have to search the sorted array by repeatedly dividing the search interval in half. Then you have to begin with an interval covering the whole array. If the value of the search key is less than the item in the middle of the interval, narrow the interval to the lower half. Otherwise narrow it to the upper half. Repeatedly check until the value is found or the interval is empty.

  1. Bubble sort: It is a simple sorting algorithm that works by swapping the elements if they are in a wrong manner. Bubble sot is quite well explained in the picture below: Figure 2: bubble sort

Disadvantages of procedural programming:

Some of the disadvantages of procedural programming are given below:  In procedural programming the program code is harder to write.  Procedural programming is not safe as it exposes the data to the whole program.  Procedural code is usually not reusable.  Procedural programming makes harder to relate with real world objects.

Event driven paradigm:

Event driven programming is currently said to be the default paradigm is software engineering. Event driven paradigm use the events as basis which helps in developing the software. The events can be things like a user clicking on a specified button, writing text into a field, uploading a video or the loading of a program.

Characteristics of event driven paradigm:

Some of the key features of the event driven paradigm are written below:  Event driven paradigm is service focused.  Event driven programming is quite simple to use.  Service orientation is a main feature of event driven paradigm. 

Advantages of event driven paradigm:

Some of the disadvantages of event driven paradigm are below:  Event driven programming is flexible. Event driven user is alerted if the programmer wants to change something.  Event driven allows the user to select the different type of tools from the toolbar to create what they require.  Event driven is highly degradable.  It allows for more interactive programs.

Disadvantages of event driven paradigm:

The disadvantages of the event driven paradigm are given below:  The flow of the program in event driven paradigm is less logical.  The complex programs may be slower in running and loading.  Too many of the forms of a program can be very confusing in event driven programming.  In event driven paradigm it is difficult to find an error.

Relationship between procedural, object oriented, event driven paradigm:

The division of programs into small parts in procedural paradigm, is known as function while the division of programs into small parts in object oriented programming is known as object. Object oriented paradigm follows the bottom to up approach while the procedural paradigm follows the top to bottom approach.

Implementation of an algorithm using IDE:

complex. It's disheartening to spend hours troubleshooting a problem only to discover that the problem was in the debugging code, not the module under test.

Debugging facilities in IDE:

The source-level debugger is one of the most commonly used tools in the classic design-develop-debug cycle. This powerful tool in the IDE provides an intuitive debugging environment that is fully connected with the other workbench tools, providing you the freedom you need to handle the issues at hand. The source debugger in the IDE provides a unified environment for multi process and multithreaded debugging of C, C++, Embedded C++, and Java projects. You can debug such applications on one or more remote target computers at the same time. You must utilize executables compiled for debugging to get the most out of the Debug viewpoint. Additional debug information is included in these executables, allowing the debugger to make direct connections between the source code and the binaries created from it. You'll see different icons in the IDE, such as an arrowhead for executables that weren't compiled for debugging and a bug for executables that were. The GDB debug engine is used by the IDE debugger. It converts each GUI action into a series of GDB instructions, then processes the GDB output to display the current status of the debugged program.