Thought questions
- There are over 3000 programming languages. Why?
- New programming languages are still being invented, why? New
application domains, improved ways of expressing ideas, ...
- If many languages are the norm, why do we teach you to program in only
one language in CS 121/122? Must assume no prior familiarity with
programming.
- Which language is better or worse? We will present some criteria for
evaluating languages, in a very non-rigorous manner.
- With so many languages, what should we study? Like Biology 101, we
study abstractions.
What is a Programming Language?
"Programming languages provide the abstractions, organizing principles, and control
structures that programmers use to write
programs."
Common features
- universality - it can compute anything that can be computed (too strict in
my opinion)
- implementability - it can be implemented -- point ahead to Ch. 2
Why learn about Programming Language?
- Expression of ideas will improve - Improved potential for expression
leads to improved thinking. You can improve your programming/problem
solving because new languages give you new vocabulary for thinking.
- Some languages are especially suited for some applications - knowing
about them can improve your ability to choose an appropriate
language.
- Practice learning new languages quickly.
- Understand implementation - sometimes limits language features.
- Historical perspective - why did language X become mainstream? C.A.R. Hoare on Algol 60: "Here is a language so far ahead of its time, that it was not only an improvement on its predecessors, but also on nearly all its successors."
Programming domains
"Virtually all successful programming languages were originally designed for one specific use." - Mitchell, p.3. Do you think that is true? On the other hand some spectacular language failures occurred when people attempted to design for every possible use: PL/I, Algol 68, Ada(?).
- Scientific computing - 1950s, 1960s, Fortran
- Business applications - 1960s, COBOL
- AI - 1950s, Lisp, Prolog
- Systems prog. - 1960s - IBM and PL/S, Unix and C
- Scripting languages - awk, tcl, javascript, perl, python, visual
basic
- Special purpose - PostScript
Influences
- Hardware
- Imperative languages model changes in state
(e.g., in the values in registers, memory, and on disk).
- Languages - Algol 60, C, C++, Java, Pascal, perl, python,
- Parallel machines - there are languages for parallel computing
- Mathematics
- Lambda calculus - LISP
- Functional languages view programs as functions - ML,
Scheme, LISP: characterized by use of higher-order functions
- Logic programming view programs as mathematical proofs: a
program computes by trying to prove a theorem - Prolog
- Programming Methodology
- 1960s - larger and larger systems
- 1970s - top-down design - Pascal
- late 1970s, early 80s - data-oriented design (ADTs) Ada and
Modula
- 1980s - object-oriented design - C++, Smalltalk
- 1990s - concurrency; graphics; libraries - Java
- throughout - increasing trend to use of types
- Special purpose languages
- Visual languages for designing user interfaces - Visual Basic
- Markup Languages - HTML, XML, SGML
Computer Language Levels
- low-level -- close to the machine instruction set, examples are machine
language and assembler language (symbolic machine code)
- high-level -- make it easier for humans, examples are C and Pascal
- very high-level -- give a general idea of what computer should do, let
it do it, example is Prolog
Criteria for Evaluating Languages
Readability, writability, reliability, maintainability, ...
Cost
Cost is another way to evaluate languages--the MBA approach: what is the return on investment? Various kinds of costs.
- Training.
- Writing.
- Compilation (in terms of time and size of produced code)
- Execution. A dominant cost in some applications. Often, optimization
can reduce the cost, at the expense of increasing the cost of
compilation/writing/and or training.
- Language implementation - is the compiler free?
- Reliability - Failure in produced code/run-time environment can be very
costly, think of a program running an X-ray machine.
- Maintenance - Useful code is always refined, updated, debugged. This
cost can outweigh development cost.
Source of Information
These lecture notes are based on Chapter 1 in
Programming Language Concepts
and Paradigms by David Watt, Chapter 1 in
Programming Languages by Robert
Sebesta and Chapter 1 of
Concepts in Programming Languages by John
C. Mitchell.