Programming Languages: Administrivia
Programming Languages: Administrivia
programming languages
Administrivia
Weight of grades:
homework: 30%
midterms: 30% optional project: 30%
final exam: 40%
Final grades:
A = 90pt, B = 80, C = 60, ... no curve!
Administrivia
Working together
Express computations
• precisely
• at a high level
• so that we can reason about them
copy(Array a, Array b) {
for(int i=0; i < a.length; i++)
b.val[i] = a.val[i];
}
PL to the rescue: ccured
Research in PL
Learn by doing
• write mostly short programs, thought required
Preliminaries
Chapter 1 Topics
• Programming Domains
• Language Evaluation Criteria
• Influences on Language Design
• Language Categories
• Language Design Trade-Offs
• Implementation Methods
• Programming Environments
Programming Domains
• Scientific applications
– Large number of floating point computations: Fortran
• Business applications
– Produce reports, use decimal numbers and characters:
COBOL
• Artificial intelligence
– Symbols rather than numbers manipulated: LISP
• Systems programming
– Need efficiency because of continuous use: C
• Web Software
– Eclectic collection of languages: markup (e.g., XHTML),
scripting (e.g., PHP), general-purpose (Java)
• 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
Evaluation Criteria: Readability
• Overall simplicity
– A manageable set of features and constructs
– Few feature multiplicity (means of doing the same
operation)
– Minimal operator overloading
• Orthogonality
– A relatively small set of primitive constructs can be
combined in a relatively small number of ways
– Every possible combination is legal
• Control statements
– The presence of well-known control structures (e.g.,
while statement)
• Syntax considerations
– Form and meaning: self-descriptive constructs,
meaningful keywords
Evaluation Criteria: Writability
• Type checking
– Testing for type errors
• Exception handling
– Intercept run-time errors and take corrective measures
• Aliasing
– Presence of two or more distinct referencing methods
for the same memory location
• Portability
– The ease with which programs can be moved from one
implementation to another
• Generality
– The applicability to a wide range of applications
• Well-definedness
– The completeness and precision of the language’s
official definition
Influences on Language Design
• Computer Architecture
– Languages are developed around the prevalent
computer architecture, known as the von Neumann
architecture
• Programming Methodologies
– New software development methodologies (e.g.,
object-oriented software development) led to new
programming paradigms and by extension, new
programming languages
• Imperative
– Central features are variables, assignment statements,
and iteration: C, Pascal
• Functional
– Main means of making computations is by applying
functions to given parameters: LISP, Scheme
• Logic
– Rule-based (rules are specified in no particular order):
Prolog
• Object-oriented
– Data abstraction, inheritance, late binding: Java, C++
• 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
Compilation
• No translation
• Easier implementation of programs (run-time errors
can easily and immediately displayed)
• Slower execution (10 to 100 times slower than
compiled programs)
• Often requires more space
• Becoming rare on high-level languages
• Significant comeback with some Web scripting
languages (e.g., JavaScript)
• Ainterpreters
compromise between compilers and pure
• Aintermediate
high-level language program is translated to an
language that allows easy
interpretation
• Faster than pure interpretation
• Examples
– Perl programs are partially compiled to detect errors
before interpretation
– Initial implementations of Java were hybrid; the
intermediate form, byte code, provides portability to
any machine that has a byte code interpreter and a
run-time system (together, a Java Virtual Machine)
Just-in-Time Implementation Systems
• Initially
language
translate programs to an intermediate
• Then
code
compile intermediate language into machine
Summary