Programming paradigm
Programming paradigm
NAME OF STUDENTS;
1. MIZAN KIFLU UGR/6421/16
2. ABIY SHITA UDR/0968/16
- a method to solve a problem using tools and techniques that are available to us following some
approach. There are lots for programming language that are known but all of them need to follow some
strategy when they are implemented and this methodology/strategy is paradigms.
# Apart from varieties of programming language there are lots of paradigms to fulfill each and every
demand.
one of the oldest programming paradigms. It features close relation to machine architecture. It
is based on Von Neumann architecture.
It works by changing the program state through assignment statements.
It performs step by step task by changing state. The main focus is on how to achieve the goal.
The paradigm consists of several statements and after execution of all the result is stored.
Advantages:
Disadvantage:
Examples:
C: developed by Dennis Ritchie and Ken Thompson
Fortran: developed by John Backus for IBM
Basic: developed by John G Kemeny and Thomas E Kurtz
Imperative programming is divided into three broad categories: Procedural, OOP and parallel
processing.
Procedural programming paradigm – Procedural programming is a programming paradigm, classified as
imperative programming, that involves implementing the behavior of a computer program as
procedures that call each other. The resulting program is a series of steps that forms a hierarchy of calls
to its constituent procedures.
Advantages
Procedural Programming is excellent for general-purpose programming
The coded simplicity along with ease of implementation of compilers and interpreters
A large variety of books and online course material available on tested algorithms, making it
easier to learn along the way
The source code is portable, therefore, it can be used to target a different CPU as well
The code can be reused in different parts of the program, without the need to copy it
Through Procedural Programming technique, the memory requirement also slashes
The program flow can be tracked easily
Disadvantages
The program code is harder to write when Procedural Programming is employed
The Procedural code is often not reusable, which may pose the need to recreate the code if is
needed to use in another application
Difficult to relate with real-world objects
The importance is given to the operation rather than the data, which might pose issues in some
data-sensitive cases
The data is exposed to the whole program, making it not so much security friendly
Disadvantages of OOP:
it can increase the complexity and size of the code, especially when the system involves multiple
levels of inheritance, polymorphism, and dynamic binding. These features can make the code
harder to understand, debug, and test, and can introduce errors and bugs that are difficult to
detect and fix. Another drawback of OOP is that it can consume more memory and CPU
resources than other paradigms, such as procedural or functional programming. This is because
objects store both data and methods, and require more space and time to create and
manipulate.
Examples of Object Oriented programming paradigm:
Simula: first OOP language
Java : developed by James Gosling at Sun Microsystems
C++ : developed by Bjarne Stroustrup
Objective-C : designed by Brad Cox
Visual Basic .NET : developed by Microsoft
Python : developed by Guido van Rossum
Ruby : developed by Yukihiro Matsumoto
Smalltalk : developed by Alan Kay, Dan Ingalls, Adele Goldberg
Declarative programming paradigm:
- In computer science the declarative programming is a style of building programs that expresses logic of
computation without talking about its control flow.
-It often considers programs as theories of some logic.
-It may simplify writing parallel programs. The focus is on what needs to be done rather how it should be
done basically emphasize on what code is actually doing. It just declares the result we want rather how
it has be produced. This is the only difference between imperative (how to do) and declarative (what to
do) programming paradigms.
Advantages Disadvantages
Can be implemented using methods not yet known at Based on an unfamiliar conceptual model for people (solut
the time of programming state)
Easy optimization as implementation is controlled by an Hard to take characteristics of individual applications into
algorithm account during programming
Event Driven Programming: A programming paradigm that structures and organizes the flow of code
around responding to events originating from external sources such as user input or system changes.
Advantages of Event Driven Programming
Utilizing Event Driven Programming can offer an array of benefits to improve responsiveness,
productivity, and general versatility within application development. Some of the more
prominent advantages of Event Driven Programming include:
Responsive Applications: Event Driven Programming allows applications to effectively
respond to user input, resulting in a more dynamic and user-friendly experience. The
event loop and event queue maintain the timely processing of events, ensuring that
user interactions are effectively handled.
Concurrency: Asynchronous event handling enables applications to execute multiple
tasks concurrently. This capability can improve the overall performance and
responsiveness of an application, particularly in situations where tasks are resource-
intensive or time-consuming.
Modularity and Maintainability: The separation of concerns in event-driven
applications, through distinct event handlers and event management, promotes
modularity and maintainability. Developers can focus on individual event handlers,
making it simpler to comprehend, adjust, and augment the software.
Scalability: Asynchronous event-driven architecture allows applications to efficiently
utilize system resources, making it possible to scale both vertically and horizontally.
Real-Time Processing: In the context of real-time applications, Event Driven
Programming enables the processing of events as they occur, ensuring the continuous
distribution of up-to-date information and consistent system responsiveness.
Wide Range of Applications: Event Driven Programming can be applied across diverse
domains, including web applications, graphical user interfaces, server-side systems, and
data-driven applications.
Disadvantages of Event Driven Programming
While there are numerous advantages to using Event Driven Programming, some challenges and
limitations must also be considered. The main disadvantages of Event Driven Programming
encompass:
Complexity: The asynchronous nature of event-driven applications can increase the
software's complexity. Ensuring correct synchronization, managing race conditions, and
addressing deadlock scenarios may necessitate extensive effort and precision in coding.
Debugging Difficulties: Debugging event-driven applications can prove challenging,
especially when dealing with concurrency, as the order of event execution is not
predetermined and may vary during runtime. This unpredictability can complicate the
process of identifying and resolving issues.
Event Handling Overhead: The execution of event handlers and management of events
demand additional system resources. Furthermore, the event loop and event queue
require constant monitoring, potentially impacting performance.
Steep Learning Curve: Developers who are unfamiliar with Event Driven Programming
may experience a steep learning curve, particularly when grappling with complex
concurrency behaviors and synchronization.
Dependencies on External Libraries: In certain programming languages and
environments, Event Driven Programming might rely on external libraries for managing
events and handling asynchronous tasks. This dependence on external code may
complicate deployment and maintenance.
References:
https://www.ionos.com/digitalguide/websites/web-development/declarative-programming/
https://www.geeksforgeeks.org/introduction-of-programming-paradigms/