CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우.

Post on 02-Jan-2016

216 views 3 download

Transcript of CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우.

CSE-321 Programming Languages

Overview

POSTECH

March 5, 2007

박성우

2

Neanderthal Man

OneTwoThree???

3

Why are two left???Foolish Neanderthal!I can count up to ten!

Java Man

I got five.I've eaten three.

4

Language = Frame of Thought• The language defines the frame of thought.

– what you can communicate to others– what concepts you are able to think over– how you think

• Big question:

"Does the programming language define the frame of thought in the course of programming?"

5

C Exercise: Integration• Specification

– input: function f from int to int range a and b

– output: f(a) + f(a + 1) + ... + f(b)

• Solution?int integral(int (*f)(int), int a, int b) {

int i, sum = 0;for (i = a; i <= b; i++)

sum += f(i);return sum;

}

• Question: what if there were no function pointer?

6

C Exercise: Derivative• Specification

– input: function f from float to float– output: derivative f' of f such that

f'(x) = (f(x + ) - f(x)) /

• Solution?

7

Question for You• What is your favorite language?

– Assembly, Basic, Pascal, C, C++, C#, Java, Perl, Python, Ruby, Prolog, Lisp, SML, Haskell, ...

• What is its strength?• What is its weakness?• What is its limitation?

• Do you think your language defines the frame of thought?

Maybe we can find the answer by learning new programming

languages.

Here is my story.

9

BASIC• 1984• Disappointing ;-(

– It does not compile to machine code.– It is slow.– “So I cannot make a computer game!”

• Had to learn anyway:– to run computer games stored in cassette tapes

10

C• 1991• Exciting ;-)

– It compiles to machine code.– “So maybe I can make a computer game!”

• “Return of the Jedi” (1983) and DOOM (1993)

11

C++• 1993• Cool!

– object-orientation (whatever that means)– instantly appreciated its power.

• Remark by the instructor:

“C++ will become the most dominant programming language in a decade from now.”

– Is it?

12

Java• 1995• Incredible!

– Not only object-orientation but also garbage collection!• no more hassle of memory allocation and

deallocation– Virtual Machine lets you run the code

“everywhere.”– The syntax and semantics seemed flawless.

13

Anyone recognizes this picture?

14

Familiar?

15

WTH?

16

ML• 1995• Eye-opener!

– functional language– strong type system

• ML = “Meta-Language”• Lessons that I learned:

– Programming is not about coding.– Programming is about design and specification.

But this course is not about learning new programming languages;

it is about programming language theory.

Then why do we study programming language theory?

) Because there is an ever growing need for new programming languages!

18

Mars Climate Orbiter Failure in 1998

• Destroyed due to a navigation error• Cause?

– One module used English units (feet).– The other module expected metric units (meter).

• Stupidity:– NASA scientists? No!– programming languages they used? Yes!

• Cf. Fortress at SUN Microsystems– support for dimension analysis

19

Common Features???

20

... runs faster on

21

Multi-core CPUs• IBM Power4, dual-core, 2000• Intel reaches thermal wall, 2004 ) no more free lunch!• Intel Xeon, quad-core, 2006• Sony PlayStation 3 Cell, eight cores enabled, 2006

• Intel, 80-cores, 2011 (prototype finished)

source: Herb Sutter - "Software and the concurrency revolution"

22

Tim Sweeney's POPL '06 Invited Talk- Last Slide

Programming Language People

Course Overview

24

Topics to Be Covered• Inductive reasoning• -Calculus• Type theory• Object-orientation• Concurrency

• Note:– This course is not about functional languages.– It is about basic programming language theory.

25

Grading• 50% assignments

– 8 programming assignments, all in Standard ML• 10% quizzes

– 4 quizzes (substitute for written assignments)• 20% midterm, • 20% final

• Why 50% for quizzes and exams?– average of 2006 midterm: 53.66 of 100– average of 2006 final: 27.62 of 80

• Closed book for quizzes and exams

• Absolute grading system in 2007vs. Relative grading system in 2006

26

NO CHEATING• Read the document on the disciplinary policy.

• 2006– 7 students cheated (out of 46 students)– 2 suspicious cases

• Cheating will not be tolerated.– Cheating even once will expel you from class or get

you an F.– We will check your programs at the end of the semester.

• You should complete your assignments on your own.

27

Homework by Wednesday• Visit the course webpage.

– http://www.postech.ac.kr/~gla/cs321/• Visit the discussion board.

– telnet pl.postech.ac.kr• Install

– Standard ML 110.58.– AFS client software.

• Read "A Critical Look at Programming Languages".