programming paradigms seminar 1

Post on 17-Dec-2014

1.971 Views

Category:

Documents

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

Seminar 1 : The bird’s eye view

The ParadigmsProgramming

Paradigms

2

Outline

Programming Paradigms

4 Main Programming Paradigms

Learning Objective

Plans

Paradigm – The Dancer

LEFT BRAIN(counter –clockwise)AnalyticalNumbersLinearDetailsConcrete

RIGHT BRAIN(clockwise)IntuitiveImagesNon-linearBig pictureabstract

664X 5

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.

6

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.

In general, programming paradigms influence language design.

7

Why Programming Paradigm?

Paradigm A

Model 1

ProblemsModel 2

Model 3

Model 4

8

Overview of 4 Programming Paradigms

Object-Oriented

Imperative

Functional Logic

9

View everything as an “object”

Key characteristic of OOData AbstractionEncapsulationPolymorphismInheritance

Best for problems with a large number of related data abstractions organized in a hierarchy

Object-Oriented Paradigm

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

getSal()

return amt1 Employee 1

Employee 10000

getSal()return amt1

sumAll()

calSal()

calSal()

11

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

Order of Commands is Important!! Analogy:Cooking a cup noodles

12

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

Evaluates Resulting Value

Used By EvaluatesAn Expression

Another Expression

13

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

List all programming

paradigmsAutomated

Search

Object-OrientedImperativeFunctionalLogic

Answer a question via search for a solution

14

Learning Objective

Each paradigm has its place

Learning different paradigms allow us toIdentify suitable paradigms for a given complex problemDecide the most suitable language to implement

Reason for focusing on paradigmsIncreasing number of programming languages

implementing similar paradigms exists27 paradigms in total but some are in similar conceptStudying the 4 distinct basic paradigms allow us to easily

pick up any programming languages on our own!

15

16

Plans

Research [S2]• Paradigms• Advantages & Disadvantages• Case Studies / Examples

Project [S3 / S4]

Conclusion [S4]• Summary and reflections

Problem Statement

Feasible Solutions Evaluate Prototype

of Solution

17

Programming Paradigms

4 Main Programming Paradigms

Learning Objective

Plans

Summary

Thank you!

End of Presentation

19

WAIT! Please help us to help you!

3-5 min survey

top related