cse-321 programming languages overview postech march 5, 2007 박성우

27
CSE-321 Programming Languages Overview POSTECH March 5, 2007 박박박

Upload: rafe-sanders

Post on 02-Jan-2016

216 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

CSE-321 Programming Languages

Overview

POSTECH

March 5, 2007

박성우

Page 2: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

2

Neanderthal Man

OneTwoThree???

Page 3: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

3

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

Java Man

I got five.I've eaten three.

Page 4: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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?"

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

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?

Page 6: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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?

Page 7: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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?

Page 8: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

Maybe we can find the answer by learning new programming

languages.

Here is my story.

Page 9: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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

Page 10: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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)

Page 11: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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?

Page 12: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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.

Page 13: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

13

Anyone recognizes this picture?

Page 14: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

14

Familiar?

Page 15: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

15

WTH?

Page 16: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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.

Page 17: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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!

Page 18: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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

Page 19: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

19

Common Features???

Page 20: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

20

... runs faster on

Page 21: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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"

Page 22: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

22

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

Programming Language People

Page 23: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

Course Overview

Page 24: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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.

Page 25: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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

Page 26: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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.

Page 27: CSE-321 Programming Languages Overview POSTECH March 5, 2007 박성우

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".