Transcript PPT
CSE-321 Programming Languages
Overview
박성우
POSTECH
March 5, 2007
Neanderthal Man
Three
???
Two
One
2
Java Man
IFoolish
Why
can
I've
Icount
are
got
eaten
Neanderthal!
two
five.
up
three.
left???
to ten!
3
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?"
4
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?
5
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?
6
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?
7
Maybe we can find the answer by
learning new programming
languages.
Here is my story.
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
9
C
• 1991
• Exciting ;-)
– It compiles to machine code.
– “So maybe I can make a computer game!”
• “Return of the Jedi” (1983) and DOOM (1993)
10
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?
11
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.
12
Anyone recognizes this picture?
13
Familiar?
14
WTH?
15
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.
16
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!
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
18
Common Features???
19
... runs faster on
20
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
source: Herb Sutter - "Software and the concurrency revolution"
• Intel, 80-cores, 2011 (prototype finished)
21
Tim Sweeney's POPL '06 Invited Talk
- Last Slide
Programming Language People
22
Course Overview
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.
24
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 2007
vs. Relative grading system in 2006
25
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.
26
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".
27