CS 334
Programming Languages
Spring 2000

Lecture 1

Do programming languages matter?

Absolutely!!!

Otherwise, why would the Java folks have rejected C++ for their programming language?

Explore in this course all aspects of programming languages, including their features, type systems, programming styles supported, and implementations.

Programming languages are the main interface between computers and programmers, allowing us to express or understand algorithms to be executed by the computer.

Abstractions

By providing abstractions (or mechanisms to create abstractions) they influence the way we think about problems.

Data abstractions:

Control abstractions:

Syntax and Semantics

For all constructs need to have clearly specified syntax and semantics:

Syntax always given formally (as well as informally).

Semantics usually given informally (English), but more and more formally.

Both necessary in order to ensure programs give predictable results.

How can programming languages support the software development process?

Phases in the development process are:

Need to evaluate languages with respect to overall picture. Not good if just supports one aspect. Important to evaluate language based on what its goals are.

Languages which are good for quick hacking together of programs may not be suitable for large-scale software development.

Better choices for large-scale software include:

I heard two weeks ago at a conference in Boston that 50% of all security problems reported to CERT (center charged with reporting security problems and solutions) are due to one particular feature of one specific programming language. Given the increasing interest in programs communicating over the internet, one has to wonder why those interested in security still write in that language.

Most languages today designed to support specific software development methodology or philosophy. E.g., top-down design, object-based design, encapsulation, information-hiding.

Languages influence the way people think about programming process.

Faculty always complain about BASIC hackers.

Minimum requirements for programming languages:

Alternative Programming Language Paradigms

Important to be aware of different programming language paradigms, allow one to think about problems in different ways.

Partially driven by new architectures (or at least not constrained by old). Procedural paradigm (C, Pascal, FORTRAN, Ada, Modula-2) is closest to machine architecture.

Other paradigms:

History of Programming Languages

Machine language -> Assembly language -> High-level languages

Programmers: Single highly trained programmer -> large teams which must cooperate

Early

Early Schisms:

Consolidation

Next Leap Forward

Abstract Data Types

Other paradigms

4th generation languages



Topics to be covered in course:

Three main concerns:

Start out by learning ML so can explore some new ideas & rapidly program interesting applications.

Write our own interpreters for simple languages so can see impact of various design decisions.


Functional Languages

Problems with imperative (command-based) languages

In his 1978 Turing award lecture (granted in recognition of his role in the development of FORTRAN, ALGOL 60, and BNF-grammars), John Backus attacked the pernicious influence of imperative programming languages and their dependence on the von Neumann architecture.

What is problem with imperative languages?

Designed around architectures available in 1950's.

Components:

To execute an instruction, go through fetch, decode, execute cycle.

Ex. To execute statement stored in location 97 (ADD 162):

  1. Fetch instruction from memory location 97 (to CPU)

  2. Decode into operation (ADD) and address (162)

  3. Fetch contents of address.

  4. Add contents to accumulator and leave result in accumulator.

Simple statement like A:=B+C results in several accesses to memory through "Von Neumann bottleneck."

Imperative program can be seen as control statements guiding execution of a series of assignment statements (accesses and stores to memory).

Variable in programming language refers to location whose contents may vary with time.

Hard to reason about variables whose values are always changing, even within same procedure or function.

Math notation not like that. Static. If want to add time, add new parameter. Gives static reasoning about dynamic processes.

Important notion called referential transparency. Can replace an expression anywhere that it occurs by its value.

Very important for parallelism, since compute once and then reuse.

Not true of imperative languages. Can't compute x+1 once and replace all occurrences by its value.

Order of execution in imperative programs very important - inhibits parallel execution.

We will see several advantages of functional programming.

  1. Referentially transparent - easier to reason about, easier to make parallel. Once expression evaluated, it can be reused.

  2. Order of execution need not be specified. Expressions can automatically be executed when needed, even in parallel.

  3. Higher-level, resulting in shorter, more understandable programs.

  4. Can build new higher-order functions which allow you to put together old programs in more flexible ways.

  5. "Lazy evaluation" can allow one to compute with infinite objects.

Other important reasons to study functional languages:

  1. Useful in AI research

  2. Useful in developing executable specifications and prototype implementations.

  3. Closely related to CS theory (e.g., recursive functions, denotational semantics).


Back to:
  • CS 334 home page
  • Kim Bruce's home page
  • CS Department home page
  • kim@cs.williams.edu