CSE130 LECTURE NOTES
WELCOME
This is CSE 130. Please see today's introductory
handout. Points to note:
-
Very restricted add policy.
-
Sections on Wednesdays.
-
Do come to lectures, but not if you won't pay attention.
-
For group projects: teams of exactly three.
-
Absolute academic honesty is required.
-
Easy to ask questions with the class bulletin board.
-
Account slips to be distributed in last 10 minutes of class today.
Class will start at 4:40pm sharp and end at 6:00pm sharp.
OVERVIEW OF THE COURSE
A programming language is a notation for writing software. Good programming
languages have many properties:
-
Readability for humans
-
Portability across multiple OSs and multiple CPU architectures.
-
Abstraction, i.e. letting the implementation decide details instead of
the programmer.
-
Performance.
-
Programmer productivity, especially facilitating code reuse.
-
More...
A common theme is that the design of the PL should help the programmer
avoid mistakes. To err is human!
All the properties above are design objectives. Sometimes the
objectives can conflict, for example portability and performance.
But often multiple objectives point in the same direction.
Why study programming languages?
-
To understand the most widely used languages (e.g. C++) better.
-
To choose the best language for new applications.
-
Perhaps as a foundation for research on improved languages.
Because PLs are interesting!
HISTORY OF PROGRAMMING LANGUAGES
Most of the ideas of modern PLs appear in four or five classic languages:
-
Fortran (1956/8): Jump-based control structures (looping, conditionals),
subroutines, arrays, formatted I/O.
-
Cobol: Task-specific types for business applications, e.g. decimal arithmetic
and strings.
-
Algol (1960+): Lexical scoping, composite types (records), automated type-checking,
high-level control structures, recursion.
-
Lisp (1959): Functions yielding functions as return values, same notation
for code and data, dynamic typing, recursion in lieu of iteration.
-
Simula (1967): Information hiding, object-oriented programming.
I said "four or five classic languages" because Cobol has not had much
impact on later languages, although it remains important.
Fortran's most important innovation was the very idea of a high-level
PL, i.e. that a compiler could generate machine code from a program written
in a machine-independent notation. But CSE 130 is not about compilers.
CSE 130 TOPICS
We will study modern languages that are in widespread use:
-
Haskell (similar to ML): Very high-level, first-class functions, no
destructive assignment, no explicit pointers, automated type
inference.
-
Pascal: Designed to minimize programmer errors, and for structured flow
of control.
-
C: Close to standard sequential hardware.
-
Java: For safe, portable, distributed computing; object-oriented.
We won't study C++ directly, because it is not as well-designed as the
languages above. It is an interesting sociological question why C++
is so widely used today. Possible answers include that C++ is widely
available, close to traditional CPU architecture, and familiar to most
programmers since it is based on C.
CSE 130 will be organized by concept, not by language. All
the languages mentioned above have many more similarities than differences.
We will concentrate on the core concepts that all widely-used modern languages
are based on.
Based on lecture notes by Charles Elkan, 1999.