the paradigms programming paradigms · 03/02/2019 · programming paradigm: programming a...
TRANSCRIPT
The bird’s eye view
The Paradigms Programming
Paradigms
Outline
Programming Paradigms
4 Main Programming Paradigms
Learning Objective
2
Problem: Create a
calculator program
Paradigm A
Paradigm B
Solution: A
Solution: B
Programming Paradigm
A programming paradigm is a framework that define how the user conceptualized and interpret complex problems.
Paradigms Vs Languages
Programming Paradigm:
A programming paradigm is an approach to programming a computer based on a mathematical theory or a coherent set of principles.
Programming language:
A programming language is a tool for developing executable models for a class of problem domains.
5
In general, programming paradigms influence language design.
Why Programming Paradigm?
6
Paradigm A
Model 1
Problems Model 2
Model 3
Model 4
Overview of 4 Programming Paradigms
Object-Oriented
Imperative
Functional Logic
7
View everything as an “object”
Key characteristic of OO
Data Abstraction
Encapsulation
Polymorphism
Inheritance
Best for problems with a large number of related data abstractions organized in a hierarchy
Object-Oriented Paradigm
8
Name: Gender: Size: Eue _colour: Shopping()
Human
Animal
“Alice”
“Bob”
Building
Object-Oriented Paradigm
Question:
Is Object-Oriented the best paradigm for solving every problems?
If so, there wouldn’t be a need for other paradigm…
Overheads!!
Find the payroll of the salaries for all the employee in
the company Company
Employee 1
Employee 10000
sumAll()
calSal()
calSal()
Imperative Paradigm
First Do This
Next do that
View everything as “a sequence of steps to perform”
Characterized By
Procedures Functions Abstract Data Types (ADTs)
Best for expressing algorithms and the most common paradigm in use today
10
Order of Commands is Important!! Analogy: Cooking a cup noodles
Functional Paradigm
View everything as “functions”
Characterized by
Single Assignment
Referentially Transparent
Compositionality
Higher Order Function
Best for abstracting and reducing complexity in programming task with no side effects
11
Resulting Value
Used By An Expression
Another Expression
View everything as “Predicate Calculus”
Characterized by
Axioms
Facts
Inference rules
Queries
Best for solving problems in artificial intelligence such as medical diagnosis, fault finding in equipment and robot control
Logic Paradigm
12
List all programming
paradigms Automated
Search
Object-Oriented Imperative Functional Logic
Answer a question via search for a solution
Learning Objective
Each paradigm has its place
Learning different paradigms allow us to Identify suitable paradigms for a given complex problem
Decide the most suitable language to implement
Reason for focusing on paradigms Increasing number of programming languages
implementing similar paradigms exists
27 paradigms in total but some are in similar concept
Studying the 4 distinct basic paradigms allow us to easily pick up any programming languages on our own!
13
14
Programming Paradigms
4 Main Programming Paradigms
Learning Objective
15
Summary
Thank you!
End of Presentation