Procedural Programming Language:
A computer programming language that can follow many instructions at once is called a
procedural programming language. Examples of the PC procedural languages Java, C,
FORTRAN, and BASIC are shown here. Substance and programming engineers often make use
of a variety of programming jargon, one of which is procedural programming language. They
create scripts that allow a computer to find and display an optimum yield by using constraints,
unexpected clarifications, and components. (Lightbringer,2019)
Characteristics of Procedural Programming Language:
Functions are used to break down large issues into
smaller programs.
There is no restriction on the free flow of data between
system functions.
When developing programs, it follows a hierarchical
approach.
Data from across all departments is shared.
(Lightbringer,2019)
Advantages of Procedural Programming Language:
The syntax and structure of procedural languages tend
to be simpler, which makes them more approachable to
newcomers.
It directly corresponds to machine instructions, and
procedural code often executes rapidly, resulting in
efficient use of resources.
Procedural code, with its sequential execution, might
be less complicated to maintain and troubleshoot,
particularly for less involved projects or activities.
Disadvantages of Procedural Programming Language:
Data is exposed to the whole program, so there is no security for data.
Difficult to relate with real-world objects.
Importance is given to process rather than data.
Difficult to create new data types. (Lightbringer,2019)
Example Of Code Using PPL:
Basic Input /Output:
The term "input/output" (I/O) refers to how a computer interacts with the physical environment.
Installing software or an application onto a computer is the most fundamental step of an
information system (IS), and users from the outside world are responsible for operating the
computer to solve issues. The term "input" describes the data or commands entered a computer
system. What comes out of a computer is called its output. I/O operations is another name for
this, which stands for the input and output processes. (Byju’s,2024)
Example Basic Input/Output:
Control Statement:
A control statement is a kind of programming statement that, depending on certain
circumstances, decides whether to execute other statements in the program. It lets the program
decide what to do and in what sequence depending on the values of variables or user Points.
There are three types of control statements in the C Programming Language:
1. Conditional Statements
2. Looping Statements
3. Jump Statement.
1. Conditional Statements: These Statements execute different Codes depending on whether
a certain condition is true or false. In C the two main conditional statements are.
(Kochar,2023)
a) If Statements: It is Used to execute a block of code if a certain condition is true.
(Kochar,2023)
b) Switch Statement: It is used to select one of many blocks of code to execute based
on the value of a variable. (Kochar,2023)
2. Looping Statements: These Statements repeat a block of code until a certain condition is
met. In c three main Looping statements are. (Studysmater,2024)
a) For Loop: A control flow statement in C, the for loop lets you run a piece of code
repeatedly depending on a condition. There are three sections to it: setup,
condition, and update. With a true condition, the loop will continue to repeat.
Although the for-loop components are all optional, the semicolons that.
(Studysmater,2024)
b) While Loop: It is possible to continually run a block of code in C using the while
loop, a control flow statement, provided that a certain condition is true. In contrast
to the for loop, which includes both an initialization and an update phase, the
while loop only checks a condition. Hence, the control variables used by the loop
must be initialized manually before it begins and updated as needed while it is
running. (Studysmater,2024)
c) Do-While Loop: One control flow statement in C is the do-while loop, which
continually runs a block of code until a stated condition turns false. While loops
don't run their code blocks until after testing the condition, do-while loops do so
at least once. Regardless of the starting value of the condition, this guarantees that
the loop body will be run at least once.
3. Jump Statements: These Statements transfer control to a different part of the program. In
C the three main Jump Statements are (Studysmater,2024)
a) Break Statements: To "break" out of a loop too soon, programmers in C use the break
statement, which is a control flow statement. It is often used within loops (such for,
while, or do-while loops) to invoke the loop's exit function when certain criteria are met.
The loop instantly ends and program control moves on to the statement once a break
statement is met inside a loop. (Studysmater,2024)
b) Continue Statements: Using the continue statement, a control flow statement in C, inside
loops (such as for, while, or do-while loops) allows the program to skip the current
iteration and go on to the next one. It is often used to omit certain calculations or actions
depending on particular circumstances without completely leaving the loop.
c) Goto Statements: As a control flow statement, the goto statement in C enables you to
move program control to a designated label inside the same function. Although it's best
avoided since it may lead to spaghetti code and make the logic of the program difficult to
grasp, there are cases when it's necessary, such as when dealing with error circumstances
or breaking out of nested loops. (Studysmater,2024)
Array: The C programming language defines
an array as a set of adjacent memory regions
containing items of a particular data type. You
can store numerous values of the same type
under a single name in an array. It's handy.
Array elements are accessible by indexes that
reflect their positions inside the array. Starting
at 0 for the first entry, the index continues up
to the array size minus one. (Trivedi,2023)
Structure: It is possible to organize similar data objects of various kinds under a
single name using C's user-defined data type called a structure. An entity's members or fields are
the many pieces of data that make up that entity. It is easy to construct complicated data
structures and organize data hierarchically using structures. Using the dot operator, you may
access specific elements of a structure. (Trivedi,2023)
Pointer: To access another variable's location in memory, a C programmer uses a pointer.
When it comes to dynamic memory allocation, data structure access, and algorithm efficiency,
pointers are a godsend. The data stored at certain locations in memory may be accessed directly
via pointers. In both simple and complex programming, pointers—represented by the symbol *
—are vital for managing memory at low levels. (Geeksforgeeks,2024)
String: A string is a collection of characters in
C that are stored in adjacent memory regions
and ended by a null character ('\0'). The
storage and manipulation of textual data is
often accomplished via strings, which are
usually shown as arrays of characters. It is
usual practice to use character arrays and
library functions like strlen, strcpy, strcat, etc.,
to handle strings as C lacks an in-built string
data type. (Dham,2023)
Function: A function in C is a self-contained
block of code that performs a specific task. It
is a reusable unit of code that can be called
from other parts of the program. Functions
help organize code, improve readability, and
facilitate code reuse. In C, a function typically
consists of a function signature (including the
return type, function name, and parameters),
followed by a function body containing the
actual code to be executed.
(Geeksforgeeks,2023)
Object Oriented Programming:
The core idea of the object-oriented programming paradigm, sometimes known as OOP, is that
objects are instances of classes. In object-oriented programming (OOP), these objects stand in
for actual things or ideas in the actual world. Object-oriented programming (OOP) is concerned
with objects, their relationships, and how to create and modify them. (Gaurav,2023)
Characteristics of Object-Oriented Programming (OOP)
Classes and Objects.
Encapsulation.
Inheritance.
Polymorphism.
Abstraction.
Modularity.
Message Passing.
Advantages of Object-Oriented Programming (OOP):
Code is more easily maintained and reused when it is abstracted and encapsulated.
Code reuse and modularity are both made easier via inheritance.
With polymorphism, programmers may make their code more adaptable and extensible.
Allows for the effortless translation of physical items into their digital counterparts.
(Gaurav,2023)
Disadvantages of Object-Oriented Programming (OOP):
This can cause complexity and overhead to rise, even on relatively minor projects.
Dynamic dispatch and memory allocation have the potential to cause performance
overhead.
More difficult to grasp than procedural programming for newcomers.
Possible lengthening of development time due to pre-development meticulous planning
and design. (Gaurav,2023)
Data Encapsulation: As part of C++'s data
encapsulation, classes may include both data
and methods and access specifiers like
"public" and "private" allow developers to
restrict who can access which parts of the
class. Code that is more secure, easier to
maintain, and reusable is the result of its
emphasis on information hiding and code
organization. (Doherty,2024)
Class of OOP:
The foundation of C++'s class-based object-
oriented programming (OOP) is the idea of
classes and objects. Classes under this
paradigm define the behaviors (methods) and
characteristics (properties) of objects and
provide a framework for their creation.
Polymorphism, inheritance, and encapsulation
are cornerstones of class-based object-
oriented programming. Data and methods are
encapsulated when they are packaged into
classes and access modifiers like protected,
private, and public are used to govern who
can access them. Code reusability and
hierarchical connections are both facilitated
by inheritance, which enables classes to take
on the characteristics and behaviors of other
classes. Polymorphism allows for the
consistent treatment of objects of multiple
classes, which in turn allows for more code
extension and flexibility. Class-based object-
oriented programming (OOP) has become a
popular paradigm in contemporary software
development due to its emphasis on
modularity, code reuse, and straightforward
problem-solving. .(Doherty,2024)
An object of OOP:
The Object-Based Protocol Instead of classes, objects are the center of attention in C++'s Object-
Oriented Programming (OOP). Encapsulating data (properties) and behavior (methods) in
objects enable modular and reusable programming under this paradigm. Messages allow objects
to communicate with one another, much as in class-based object-oriented programming. In
contrast to class-based OOP, object-oriented OOP does not fully enable polymorphism or
inheritance. The concepts of encapsulation and message forwarding are fundamental to object-
oriented programming (OOP). Bundling data and methods into objects is called encapsulation,
and objects may interact and work together via message passing. Object-oriented programming
(OOP) is a dynamic and adaptable method for creating software that is well-suited to projects
that call for code reuse and modularity but don't want to deal with the complexities of inheritance
hierarchies. (Doherty,2024)
Inheritance: One of the cornerstones of
object-oriented programming (OOP) is the
idea of inheritance, which enables a new class
to take on the characteristics and methods of
an older class. Because it allows for
hierarchical connections between classes and
encourages code reuse, inheritance is a
powerful feature in C++. Many different kinds
of inheritance exist, such as: (Goyal,2024)
1. Single Inheritance: In single inheritance, a derived class is inherited from only one base
class. (Goyal,2024)
2. Multiple Inheritance: Multiple inheritance allows a derived class to inherit from multiple
base classes. However, C++ does not support direct multiple inheritance, but it can be
achieved through virtual inheritance.
3. Multilevel Inheritance: Multilevel inheritance involves chaining together multiple
classes, where a derived class inherits from another derived class, forming a hierarchy.
(Goyal,2024)
4. Hierarchical Inheritance: In hierarchical inheritance, multiple derived classes inherit from
the same base class, forming a tree-like structure. (Goyal,2024)
Polymorphism:
An essential idea in object-oriented programming (OOP), polymorphism ensures that objects of
various classes are handled consistently. It makes it possible for many objects and behaviors to
be represented via a single interface. Both static binding at compile time and dynamic binding at
run-time are strategies that may be used to create polymorphism in C++. (Geeksforgeeks,2023)
1. Runtime Polymorphism in C++:
Runtime polymorphism, also known as dynamic polymorphism, occurs when the appropriate
function to execute is determined at runtime. It involves the use of virtual functions and late
binding. In C++, runtime polymorphism is achieved through inheritance and virtual functions.
When a base class pointer or reference is used to access a derived class object, the appropriate
function to execute is determined based on the actual type of the object at runtime.
2. Compile-time Polymorphism in C++:
In compile-time polymorphism, often called static polymorphism, the correct function to run is
decided upon during compilation. Function overloading and operator overloading are essential
components. By using function overloading, compile-time polymorphism may be accomplished
in C++. This technique allows for the definition of numerous functions with identical names but
distinct parameter lists. The compiled-in parameters determine which function is used for the
respective task. In a similar vein, operator overloading enables the redefinition of operators to
accommodate user-defined data types. (Geeksforgeeks,2023)
Abstraction: By focusing on the most
important parts of a system and leaving out
the rest, abstraction in C++ makes
complicated systems easier to understand
and work with. It enables developers to zero
down on object properties that matter while
ignoring those that don't. Classes are a key
component of C++ that allows for the
abstraction of data and behaviors. Classes
encapsulate attributes and methods into one
single entity. Abstraction allows for the
construction of code that can be reused and
extended by specifying well-defined
interfaces. (Geeksforgeeks,2023)
Modularity: Modularity in C++ refers to the
practice of dividing large systems into
smaller, more manageable parts, or modules.
The codebase is made simpler to
comprehend, maintain, and expand by
encapsulating certain functions in each
module. Modules, classes, namespaces, and
header files are the building blocks of C++
that allow for modularity. Modularity improves
code readability and maintainability,
encourages code reuse, and makes
development collaboration easier by
organizing code into modular pieces. (Atomic
object,2024)
Event-Driven Programming:
Event-driven programming is a computer programming paradigm where the control flow of the
program is determined by the occurrence of events. It is a paradigm of system architecture where
the logic flow within the program is driven by events such as user actions, messages from other
programs, GPS signals, or hardware (sensor) inputs. These events are monitored by a code
known as an event listener. If it detects that an assigned event has occurred, it runs an event
handler (a callback function or method that's triggered when the event occurs). It is determined
by events such as user actions (mouse clicks, key presses), sensor outputs, or message passing
from other programs or threads. (Room,2022)
Advantages of event-driven programming language:
It allows for more interactive programs. Almost all modern GUI programs use event-
driven programming.
It can be implemented using hardware interrupts, which will reduce the power used by
the computer.
It allows sensors and other hardware to easily interact with software. (Room,2022)
Disadvantages of event-driven programming language:
The flow of the program is usually less logical and obvious.
Event Driven Programming is generally only useful in GUI programming.
Classes are often not reusable or hard to implement in other applications. (Room,2022)
Components of Event-Driven Programming:
Event: An event is a signal or notification that indicates something has happened. Events can be
triggered by various sources, including user actions (such as mouse clicks or keyboard presses),
system notifications (like timer expiration or network activity), or messages from other parts of
the program. Each event typically carries information about the event type and additional data
relevant to the event. (StudySmater,2024)
Event Handler: A method or function that is called upon to perform in reaction to a particular
event is called an event handler, event listener, or event callback. The behavior or action to be
executed when a certain event happens may be defined by the event handlers. After receiving the
event, it is their responsibility to analyze it and react appropriately. To automate the process of
responding to certain events, event handlers are set up to listen for certain sorts of events.
(StudySmater,2024)
GUI Components: Windows, text fields, menus, and graphical user interface (GUI) components
like buttons are fundamental to event-driven programming. Users can engage with the program
via the use of graphical user interface components, which respond to user actions by producing
events. Event handlers may be used to collect and process events, such as when a button is
clicked, text is typed into a text field, or a window is resized. (StudySmater,2024)
References:
Procedural Programming
Lightbringer. (2019) Programming paradigms-what is procedural programming. Available at:
[Link]
programming/ (Accessed:28 March 2024).
Byju’s. (2024) Input and Output Functions in C. Available at: [Link]
output-functions-in-c/#:~:text=Types%20of%20Input%20and%20Output%20Functions%20in
%20C,-In%20C%2C%20input&text=The%20scanf()%20and%20printf,a%20character%2C
%20and%20many%20more (Accessed:28 March 2024).
Kochar, A. (2023) Conditional Statements in C. Available at: [Link]
programming/conditional-statements-in-c/#:~:text=Conditional%20statements%20in%20C
%20are,else%20if%2C%20and%20else%20statements (Accessed:28 March 2024).
Study smarter. (2024) Statements in C. Available at:
[Link]
statements-in-c/ (Accessed:28 March 2024).
Trivedi, S. (2023) Difference Between Array and Structure in C. Available at:
[Link] (Accessed:28 March
2024).
Geeksforgeeks. (2024) C Pointers. Available at: [Link]
(Accessed:28 March 2024).
Dham, M. (2023) What is String in C. Available at: [Link]
programming/what-is-string-in-c/ (Accessed:28 March 2024).
Geeksforgeeks. (2023) C Functions. Available at:
[Link] (Accessed:28 March
2024).
Object Oriented Programming:
Gaurav, S. (2023) Advantages and Disadvantages of OOP. Available at:
[Link] (Accessed:29 March 2024).
Doherty, E. (2024) What is object-oriented programming? OOP explained in depth. Available at:
[Link] (Accessed:29 March 2024).
Goyal, S. (2024) Inheritance in C++ & Its 5 Types Explained with Multiple Examples. Available
at: [Link] (Accessed:29 March 2024).
Geeksforgeeks. (2023) Introduction of Object-Oriented Programming. Available at:
[Link] (Accessed:29
March 2024).
Atomic object. (2024) Object-Oriented Programming. Available at: [Link]
programming/encapsulation-modularity (Accessed:29 March 2024).
Event-Driven Programming:
Room, M. (2023) 5 Advantages and Disadvantages of Event Driven Programming | Limitations
& Benefits of Event Driven Programming. Available at: [Link]
[Link]?m=1
(Accessed:30 March 2024).
Study Smarter. (2024) Event Driven Programming. Available at:
[Link]
driven-programming/ (Accessed:30 March 2024).