0% found this document useful (0 votes)
3 views

Programming paradigm

Programming paradigm jdhgdfgsdfgdfgd

Uploaded by

mizankiflukiros
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Programming paradigm

Programming paradigm jdhgdfgsdfgdfgd

Uploaded by

mizankiflukiros
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

ADDIS ABABA UNIVERSITY

COLLEGE OF COMPUTATIONAL AND


NATURAL SCIENCES
SCHOOL OF INFORMATION SCIENCE

COURSE TITLE:COMPUTER PROGRAMMING


Assignment Title: PROGRAMMING PARADIGMS
CLASS: Section A

NAME OF STUDENTS;
1. MIZAN KIFLU UGR/6421/16
2. ABIY SHITA UDR/0968/16

INSTRUCTOR NAME: TESHOME ALEMU


DATE OF SUBMISSION: MAY 25 2024
Programming paradigm
- an approach to solve problem using some programming language

- 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.

Imperative programming paradigm:

 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:

 Very simple to implement


 It contains loops, variables etc.

Disadvantage:

 Complex problem cannot be solved


 Less efficient and less productive
 Parallel programming is not possible

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

Examples of Procedural programming paradigm:


C: developed by Dennis Ritchie and Ken Thompson
C++: developed by Bjarne Stroustrup
Java: developed by James Gosling at Sun Microsystems
ColdFusion: developed by J J Allaire
Pascal: developed by Niklaus Wirth
Object oriented programming – The word object-oriented is the combination of two words
i.e., object and oriented. The dictionary meaning of the object is an article or entity that exists in the
real world.
-The program is written as a collection of classes and object which are meant for communication. The
smallest and basic entity is object and all kind of computation is performed on the objects only. More
emphasis is on data rather procedure. It can handle almost all kind of real-life. problems which are today
in scenario.
Advantages of OOP:
 Data security
 Inheritance
 Code reusability
 Flexible and abstraction is also present

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

Short, efficient code Sometimes hard to understand for external people

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

Maintenance possible independent of application


development

The best-known declarative programming languages are:


 Prolog
 Lisp
 Haskell
 Miranda
 Erlang
 SQL (in the broadest sense)
Functional programming paradigms –
-The functional programming paradigms has its roots in mathematics and it is language independent.
-The key principle of this paradigms is the execution of series of mathematical functions.
-The central model for the abstraction is the function which are meant for some specific
computation and not the data structure. Data are loosely coupled to functions. The function hides
their implementation. Function can be replaced with their values without changing the meaning of
the program. Some of the languages like Perl, JavaScript mostly uses this paradigm.
Concepts and terminology of functional programming;
1. Immutability: Functional programming emphasizes immutability, where data cannot be modified
once created. Functions in functional programming do not have side effects, ensuring predictability
and avoiding bugs.
2. Higher-Order Functions: Functional programming supports higher-order functions, where
functions can take other functions as parameters or return them as results.
3. Recursion: Recursion is heavily used in functional programming to iterate and perform
computations.
Advantages of Functional Programming:
1. Scalability: Functional programming lends itself well to parallel processing and distributed
computing, making it suitable for scalable and high-performance applications.
2. Modularity: Functional programming promotes modularity and code reusability through the use
of pure functions.
3. Predictability: The absence of side effects and immutability in functional programming leads to
more predictable and testable code.
Disadvantages of Functional Programming:
1. Steep Learning Curve: Functional programming requires a shift in mindset, especially for
developers accustomed to imperative programming paradigms.
2. Performance: Some functional programming techniques, such as recursion, can introduce
performance overhead.
Languages that follow Functional Programming:
Haskell, Lisp, Erlang, and Scala are some of the popular languages that follow the functional
programming paradigm.

Examples of Functional programming paradigm:


JavaScript : developed by Brendan Eich
Haskell : developed by Lennart Augustsson, Dave Barton
Scala : developed by Martin Odersky
Erlang : developed by Joe Armstrong, Robert Virding
Lisp : developed by John Mccarthy
ML : developed by Robin Milner
Clojure : developed by Rich Hickey

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/

You might also like