Top Banner
1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructo r: Dr. Chung-Chih Li Home page of the Class
19

1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

Dec 31, 2015

Download

Documents

Colin Bond
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

1

Concepts of Programming Languages

TK 327, Fall 2015MW 2:00 PM – 3:15 PMSTV 104

Instructor: Dr. Chung-Chih Li

Home page of the Class

Page 2: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

2

Concepts of Programming Languages

This is not a survey course

• Course Description and Purposes• Objectives

Page 3: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

04/19/23 ITK 327 3

In order to understand the universe, we have to understand the language in which

the universe is written, and mathematics is the language.

-- Galileo Galilei (1564 -1642) --

In order to understand Information Technology, we have to understand the language in which

Information Technology is written,and the Programming Language is the language.

-- --

Page 4: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

4

What is a computer?

What is a machine?

A machine that can compute!

What is computation?

Why bother?

Because, the way we understand and formalize them directly shapes the design of programming languages.

Page 5: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

5

Computer --

Machine --

Computation --

A sequence of procedures that manipulate data.

A device that follows a certain fixed causal rules.

A machine that can compute!

Page 6: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

6

Charles Babbage (1791-1871)

Difference Engine No. 1

design:Difference Engine No. 1 (1821-1832)Analytical Engine (1834-1840)Difference Engine No. 2 (1840-1849)

Difference Engine No. 2 (2002)

http://www.computerhistory.org/babbage/

04/19/23

Page 7: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

7

Leibniz’s Dream

“Sir! Let’s sit down and compute!! ”

Gottfried W.V. Leibniz (1646-1716)

http://sunsite.informatik.rwth-aachen.de/phil/filosofer/leibniz.html

Page 8: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

8

Aristotle (384 - 322 BC)

http://www.klima-luft.de/steinicke/ngcic/persons/aristoteles.htm

L E J Brouwer (1881-1966)

Logic and Thought and Computing

Page 9: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

9http://www-groups.dcs.st-and.ac.uk/~history/PictDisplay/Godel.html

Completeness theorem

Incompleteness theorem

Recursive theory

Computable functions are recursively definable function Kurt Gödel

(1906-1978)

Page 10: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

10

Alonzo Church 1903-1995

http://www.princeton.edu/pr/pwb/03/0505/7a.shtml

Lambda Calculus

Computable functions are Lambda-term definable

Page 11: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

11

Alan Turing (1912-1954) – The Enigma

The man who invented the computer.

Image from http://ei.cs.vt.edu/~history/Turing.html

Computable functions are Turing machine computable

Page 12: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

12

Wittgenstein says:

“Turing Machines are human that compute.”

Ludwig Wittgenstein (1889-1951)

http://www.ags.uci.edu/~bcarver/wgallery.html

Page 13: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

13

Church-Turing Thesis: all algorithms are computable

1. Logic

2. Recursive, λ-terms

3. Turing machines

Logical languagese.g. PROLOG

Functional languagese.g. LISP, ML

Imperative languagese.g. Algol-60, Fortran, C

OOP, (e.g. Small Talk, JAVA, C++)

What is it? Really?

?????

Page 14: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

14

Imperative Languages

• C

Using instructions to command the machine to do something, with branches, iterations, control flows, and side-effects,.

int fact(int n) { int sofar = 1; while (n>0) sofar *= n--; return sofar;}

Page 15: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

15

Functional Languages

• MLfun fact x = if x <= 0 then 1 else x * fact(x-1);

defun fact (x) (if (<= x 0) 1 (* x (fact (- x 1)))))

• LISP

Function definition, Recursion, no side-effect

Page 16: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

16

Logical Languages

• PROLOG

parent(A,B) :- dad(A,B).parent(A,B) :- mom(A,B).

grandparent(A,B) :- parent(A,C), parent(C,B).

dad(dennis, sean).

dad(dennis, leon).

dad(john, dennis).

mom(sandy, leon).

mom(sandy,sean).

grandparent(X, sean).

X = john.

parent(X, leon).

X = dennis.

X = sandy.

Rules (logic) and facts

Page 17: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

17

Logical Languages

• PROLOG

fact(X,1) :- X =:= 1.fact(X,Fact) :- X > 1, NewX is X - 1, fact(NewX,NF), Fact is X * NF.

fact(4,X).

X = 24.

fact(5,30).

false.

Page 18: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

18

OOP (Object-oriented Programming)

A new programming paradigm after ’80s.

Problem solving Procedure finding

ButWhy should I have to write the same procedure to

do the same job over and over again?

Fact: Different problems usually consist of many

common smaller problems.

Problem solving Solution arranging

Page 19: 1 Concepts of Programming Languages TK 327, Fall 2015 MW 2:00 PM – 3:15 PM STV 104 Instructor:Dr. Chung-Chih Li Home page of the Class.

19

OOP

• Java

public class MyInt { private int value; public MyInt(int value) { this.value = value; } public int getValue() { return value; } public MyInt getFact() { return new MyInt(fact(value)); } private int fact(int n) { int sofar = 1; while (n > 1) sofar *= n--; return sofar; }}