Fundamental sciences - FISE A3 INFO
Programming paradigm
Ahmed-Rafik-El Mehdi BAAHMED
Instructor
Doctoral Researcher at CESI LINEACT.
Computational efficiency of federated learning techniques
on edge-cloud infrastructures.
Artificial Intelligence Expert.
IoT Developer and Solution Architecte.
Ahmed-Rafik-El Mehdi BAAHMED
What is a
Programming
Paradigm ?
Ahmed-Rafik-El Mehdi BAAHMED
What is an
Algorithm ?
Ahmed-Rafik-El Mehdi BAAHMED
What is an Algorithm ?
Set of rules and steps to
Inputs Outputs
obtain the expected
(Entries) (Results)
results from the inputs
Algorithm
Ahmed-Rafik-El Mehdi BAAHMED 03
What is a Programming Paradigm ?
A programming paradigm is a:
Fundamental style
Approach to programming
that dictates how code is structured and how solutions to problems are expressed.
It provides a set of:
Principles
Concepts
Methods
for designing and organizing programs.
Ahmed-Rafik-El Mehdi BAAHMED 04
Why use
Programming
Paradigms ?
Ahmed-Rafik-El Mehdi BAAHMED
Why use Programming Paradigms ?
1. Provide structured approaches to solving problems.
2. Make code more understandable, maintainable, and scalable.
3. Help organize thinking around how to model data, control program flow, and ensure reusability.
4. Offer unique benefits, such as improving code efficiency, reducing complexity, or enhancing
flexibility, depending on the type of problem being addressed.
Ahmed-Rafik-El Mehdi BAAHMED 06
What are the
types of
Programming
Paradigms ?
Ahmed-Rafik-El Mehdi BAAHMED
What are the types of Programming Paradigms ?
Imperative Declarative
Paradigm Paradigm
Ahmed-Rafik-El Mehdi BAAHMED 08
What are the types of Programming Paradigms ?
Focuses on describing how a program operates, by
specifying the steps the computer must take to
Imperative
accomplish the desired result.
Paradigm
Explicit control flow, where the program changes its state
through commands.
Procedural Programming
Object-Oriented
Programming (OOP)
Concurrent Programming
Event-Driven
Programming
Ahmed-Rafik-El Mehdi BAAHMED 09
What are the types of Programming Paradigms ?
Focuses on describing how a program operates, by
specifying the steps the computer must take to
Imperative
accomplish the desired result.
Paradigm
Explicit control flow, where the program changes its state
through commands.
Procedural Programming
Object-Oriented
Programming (OOP)
Concurrent Programming
Event-Driven
Programming
Ahmed-Rafik-El Mehdi BAAHMED 10
Procedural Programming : key aspects and features
It focuses on a structured approach to programming, using procedures (also known as routines, subroutines, or functions) to
break down the logic of a program.
1. Top-Down Design
The main problem is broken down into smaller, manageable subtasks or procedures. These subtasks are then
implemented individually.
2. Sequence of Instructions
A program is composed of a sequence of instructions executed in a specific order. The flow of control is explicit and
moves from one operation to the next.
3. Functions/Procedures
The program is divided into functions (or procedures), which are reusable blocks (reducing duplication) of code that
perform specific tasks.
Functions allow code to be modular, meaning different parts of a program can be developed and tested independently.
4. Local and Global Variables
5. State Changes
The program’s state is often modified through variables and control structures.
Each function manipulates the state of the program by changing the values of variables.
6. Data and Function Separation
7. Easier Debugging and Testing
Ahmed-Rafik-El Mehdi BAAHMED 11
Object-Oriented Programming (OOP) : key aspects and
features
It is a programming paradigm based on the concept of objects, which can contain both data (attributes or properties) and
functions (methods) that operate on that data.
1. Classes and Objects
Class: A blueprint or template for creating objects. It defines the properties (attributes) and behaviors (methods) that the
objects created from the class will have.
Object: An instance of a class. Each object has its own unique set of data but shares the structure and behaviors defined
by the class.
2. Encapsulation and Abstraction
The practice of bundling the data (attributes) and methods that operate on the data into a single unit (object).
Hiding the implementation details/complexity and exposing only the necessary functionality.
3. Inheritance
A class (called a subclass or derived class) to inherit attributes and methods from another class (called a superclass or
base class).
4. Polymorphism
Allows objects of different classes to be treated as objects of a common superclass. It also allows the same method to
behave differently based on the object calling it.
Ahmed-Rafik-El Mehdi BAAHMED 12
What are the types of Programming Paradigms ?
Focuses on what the outcome should be, without
specifying how to achieve it. The program describes the
Declarative
logic without defining the control flow.
Paradigm
Describes properties of the result rather than the step-by-
step process.
Functional Programming
Logic Programming
Ahmed-Rafik-El Mehdi BAAHMED 13
How to choose
the right
Programming
Paradigm ?
Ahmed-Rafik-El Mehdi BAAHMED
Lab 1 : Bank account
management system
Ahmed-Rafik-El Mehdi BAAHMED
Lab 1 : Bank account management system
Ahmed-Rafik-El Mehdi BAAHMED 16
Lab 1 : Bank account management system
The system should allow users to:
1. Create accounts
2. Deposit money
3. Withdraw money
4. Check balances
Ahmed-Rafik-El Mehdi BAAHMED 17
Lab 1 : Bank account management system
The system should allow users to:
1. Create accounts
2. Deposit money
3. Withdraw money
4. Check balances
Object-Oriented
Procedural Programming
Programming (OOP)
Ahmed-Rafik-El Mehdi BAAHMED 18
Lab 2 : Writing an operating
system kernel
Ahmed-Rafik-El Mehdi BAAHMED
Lab 2 : Writing an operating system kernel
Ahmed-Rafik-El Mehdi BAAHMED 20
Lab 2 : Writing an operating system kernel
The operating system kernel-like should allow:
1. Kernel initialization
2. Processes management
a. Create processes
b. Terminate processes
c. Switch processes
d. Run processes
Ahmed-Rafik-El Mehdi BAAHMED 21
Lab 2 : Writing an operating system kernel
The operating system kernel-like should allow:
1. Kernel initialization
2. Processes management
a. Create processes
b. Terminate processes
Procedural Programming
c. Switch processes
d. Run processes
Ahmed-Rafik-El Mehdi BAAHMED 22
Lab 3 : Developing a Graphical User
Interface (GUI) framework
Ahmed-Rafik-El Mehdi BAAHMED
Lab 3 : Developing a Graphical User Interface (GUI)
framework
Ahmed-Rafik-El Mehdi BAAHMED 24
Lab 3 : Developing a Graphical User Interface (GUI)
framework
Object-Oriented
Programming (OOP)
Ahmed-Rafik-El Mehdi BAAHMED 25
Ahmed-Rafik-El Mehdi BAAHMED