Spring 2010 CS 214 Programming Languages. Details Course homepage: cs.calvin.edu/curriculum/cs/214/...
Preview:
Citation preview
- Slide 1
- Spring 2010 CS 214 Programming Languages
- Slide 2
- Details Course homepage: cs.calvin.edu/curriculum/cs/214/
Important dates: February 19: Project language choice March 5: Test
1 March 19: Project proposal April 16: Test 2 May 10-12: Final
project presentations Final Exam: May 15, 1:30p
- Slide 3
- Programming Language History In the beginning Binary machine
language Difficult to write Prone to programmer errors Difficult to
debug 0010 1011 1000 0000 0010 1111 1000 0100 0011 0011 1000
1000
- Slide 4
- Assembly Languages Mnemonic for each operation Symbolic names
instead of memory addresses Programs called assemblers automate
translation MOV ADD STO 0010 1011 0010 1111 0011 MOV I ADD J STO K
0010 1011 1000 0000 0010 1111 1000 0100 0011 0011 1000 1000 IJKIJK
1000 0000 1000 0100 1000
- Slide 5
- Assembly Languages Pros: Not quite so cumbersome Somewhat less
error prone Cons: Not portable Not intuitive
- Slide 6
- High Level Languages Rear Admiral Grace Hopper 1952: Develops
first compiler called, simply, A The Idea: Write code independent
of the machine-level details Use a compiler to translate into
machine language k = i + j; MOV I ADD J STO K 0010 1011 1000 0000
0010 1111 1000 0100 0011 0011 1000 1000 compiler assembler
- Slide 7
- Edsger Dijkstra Quotes The use of COBOL cripples the mind; its
teaching should, therefore, be regarded as a criminal offense. It
is practically impossible to teach good programming to students who
have had prior exposure to BASIC: as potential programmers they are
mentally mutilated beyond hope of regeneration. APL is a mistake,
carried through to perfection. It is the language of the future for
the programming techniques of the past: it creates a new generation
of coding bums.
- Slide 8
- High Level Languages 1950s 1957: Backus et al design FORTRAN
FORmula TRANslation; for scientific users Subsequent versions in
58, 62, 77, 90, 95 1959: Hopper et al design COBOL Emphasized
readability; for business users Introduced If-Then-Else statement
1959: McCarthy designs LISP LISt Processing; introduced the linked
list as primitive type First functional programming language (every
op is a function) Also introduced dynamic scope, garbage
collection
- Slide 9
- Early 1960s 1960: Wirth et al design Algol-60 ALGOrithmic
Language: designed for encoding algorithms Introduces block
structure: basis for structured programming Introduces procedures:
basis for procedural programming 1964: Wirth designs Algol-W, with
the case statement 1964: Kemeny and Kurtz design BASIC 1965: IBM
designs PL-1 Introduces multi-tasking, exception-handling 1967:
Nyquist & Dahl design Simula SIMULAtion HLL; introduces class
construct Laid foundation for O-O programming
- Slide 10
- Late 1960s and early 1970s 1968: Wirth designs Algol-68
Introduces If-Then-Elseif statement; pointer variables 1970: Wirth
designs Pascal Consolidates Algol-x features into one simple
language 1970: Ritchie designs C for OS implementation (Unix)
Provides direct hardware access, separate compilation/linking AKA
high level assembly language and Fortran done right 1972:
Colmerauer, Roussel & Kowalski design Prolog PROgramming LOGic;
designed for logic programming Logic/predicate-based HLL for
programming inferences First logic HLL; used in expert systems
- Slide 11
- 1970s continued 1977: Gordon & Milner design ML
(MetaLanguage) Hybrid HLL: functional, with inference rules
(Prolog) Allows linked ADTs to be defined without pointers
(recursively) AKA a higher level language 1979: Hoare designs CSP
Introduces support for concurrent programming 1980: Xerox PARC team
designs Smalltalk First pure object-oriented language (inheritance,
polymorphism) Program statements translated to byte code, not
machine code Introduces virtual machine to execute byte code
Functions replaced by methods, calls by messages
- Slide 12
- Early 1980s 1980: Wirth designs Modula-2 Introduces the module
- a container for types and operations 1981: DOD designs Ada
Algol-family HLL Introduces generic types, task synchronization
(rendezvous) 1983: May designs Occam Concurrent HLL based on CSP
1983: LLNL designs SISAL Concurrent HLL for array-processing on
supercomputers 1984: Sussman & Abelson design Scheme Simplified
easier-to-use Lisp, with static scope
- Slide 13
- Later 1980s 1984: Jordan designs The Force First HLL for
programming SIMD multiprocessors 1986: Stroustrup designs C++
Hybrid language: (procedural) C with object-oriented features
Parameterized types via macro-substitution (templates) 1987: Wall
designs Perl Interpreted procedural language; features of C, sh,
awk, sed, Lisp 1988: Wirth designs Oberon Algol-family with
features for OO and systems programming 1988: Mehrotra & van
Rosendale design Kali First language for programming MIMD
multiprocessors
- Slide 14
- Early 1990s 1990: Hudak & Wadler design Haskel Hybrid
language: functional and OO features 1990: van Rossum designs
Python Scripting language; features from Perl, Scheme, Smalltalk,
Tcl Focus on readability, ease for the person instead of the
machine 1991: Microsoft designs Visual Basic BASIC with integrated
support for building GUIs Later versions add OO features VB
controls are most-reused objects in the world 1993: High
Performance Fortran (HPF) released Fortran extended for SIMD and
MIMD multiprocessors
- Slide 15
- Late 1990s 1994: Perl-5 released OO features added to Perl
1995: Ada-95 released OO features added to original Ada (renamed
Ada-8x) 1995: Matsumoto releases Ruby Fully OO scripting language;
features from Perl, Python, Emphasis on making menial programming
tasks easy 1996: Gosling et al. design Java C++ syntax, Smalltalk
philosophy Extensive class library (networking, graphics, threads,
etc.) Provides Java Virtual Machine (JVM) for platform-independence
Support for both applications and applets (run via
www-browser)
- Slide 16
- Development continues PHP (1995) UML (1996) C# (2000) Scriptol
(2001) Scala (2004) Not to mention hundreds of other languages
developed along the way!
- Slide 17
- Programming Paradigms Imperative / Procedural Central features
are variables, assignment statements, and iteration Write blocks of
statements e.g. C, Pascal Functional Main means of making
computations is by applying functions to given parameters Write
functions, pass arguments e.g. LISP, Scheme Logic Rule-based (rules
are specified in no particular order) Write inference rules e.g.
Prolog Object-oriented Data abstraction, inheritance, late binding
Build objects, send messages e.g. Java, C++ Concurrent Build
communicating processes/threads/tasks e.g. CSP, Occam
- Slide 18
- Markup: New; not a programming per se, but used to specify the
layout of information in Web documents e.g. XHTML, XML
- Slide 19
- FORTRAN COBOL BASIC ALGOL-60 ALGOL-W ALGOL-68 Pascal PL/1 Lisp
Simula PrologC Modula ML Smalltalk FORTRAN-II Modula-2 C++ Scheme
Ada Ada-95 Haskel Oberon Java Visual Basic Visual Basic 5.0 1960s
1970s 1980s 1990s Fortran-90 FORTRAN-IV Fortran-77 Fortran-95 Perl
Perl-5 Python awksed Procedural OOFunctionalLogic 1950s
- Slide 20
- How to decide? Readability: the ease with which programs can be
read and understood Writability: the ease with which a language can
be used to create programs Reliability: conformance to
specifications (i.e., performs to its specifications) Cost: the
ultimate total cost Portability, Generality, Well-definedness
- Slide 21
- Trade-offs Reliability vs. cost of execution Example: Java
demands all references to array elements be checked for proper
indexing but that leads to increased execution costs Readability
vs. writability Example: APL provides many powerful operators (and
a large number of new symbols), allowing complex computations to be
written in a compact program but at the cost of poor readability
Writability (flexibility) vs. reliability Example: C++ pointers are
powerful and very flexible but not reliably used
- Slide 22
- Implementation Methods Compilation Programs are translated into
machine language Pure Interpretation Programs are interpreted by
another program known as an interpreter Hybrid Implementation
Systems A compromise between compilers and pure interpreters