Programming Languages Language Design Issues

Download Report

Transcript Programming Languages Language Design Issues

Programming Languages
Language Design Issues
•
•
•
•
•
Why study programming languages
Language development
Software architectures
Design goals
Attributes of a good programming
language
• Language paradigms
• Standardization and internationalization
Why study programming
languages
• To improve your ability to develop
effective algorithms
• To improve your use of existing
programming languages
• To increase your vocabulary of useful
programming constructs
Why study programming
languages
• To allow a better choice of programming
language
• To make it easier to learn a new language
• To make it easier to design a new language
Language development
Numerically based languages
Computing mathematical expressions
FORTRAN, Algol, Pascal, PL/1, BASIC, C, C++
Business languages
COBOL (Common Business Oriented Language)
English-like notation
Language development
Artificial intelligence languages
Tree search; Rule-based paradigm
LISP (LISt Processing)
PROLOG (PROgramming in LOGic)
System languages
C, C++
Script languages: AWK, Perl, TCL/TK
Web programming: HTML, XML, Java,
Microsoft *.NET family
Software architectures
Mainframe era
Batch processing (batches of files)
Interactive processing (time sharing)
Effects on language design
File I/O in batch processing
Error handling in batch processing
Time constraints in interactive processing
Software architectures
Personal computers
Interactive processing
Embedded system environments
Effects on language design
No need for time sharing
Good interactive graphics
Non-standard I/O devices for embedded systems
Software architectures
Networking era
Client-server model of computing
Server: a program that provides information
Client - a program that requests information
Effects on language design
Interaction between the client and server programs
Active web pages, Security issues, Performance
Design Goals
During 1950s--1960s - Run-time considerations
Programmers are cheap, machines
expensive; Keep the machine busy
Today - program development time considerations
CPU power and memory are very cheap
Attributes of a good
language
•
•
•
•
•
•
•
•
Conceptual integrity
Orthogonality
Naturalness for the application
Support for abstraction
Ease of program verification
Programming environment
Portability of programs
Cost of use
Language paradigms
• Imperative / procedural languages
• Applicative / functional languages
• Rule-based / declarative languages
• Object-oriented languages
Imperative / procedural languages
Statement oriented languages that
change machine state
(C, Pascal, FORTRAN, COBOL)
Computation: a sequence of machine
states (contents of memory)
Syntax: S1, S2, S3, ... where S1, S2, …
are statements
Applicative / functional languages
Programming consists of building the
function that computes the answer
Computation: Function composition is
major operation (ML, LISP)
Syntax: P1(P2(P3(X)))
Rule-based / declarative
languages
Computation: Actions are specified by
rules that check for the presence of
certain enabling conditions. (Prolog)
The order of execution is determined
by the enabling conditions, not by the
order of the statements.
Syntax: Condition  Action
Object-oriented languages
Imperative languages that merge
applicative design with imperative
statements (Java, C++, Smalltalk)
Syntax: Set of objects (classes)
containing data (imperative concepts)
and methods (applicative concepts)
Language standardization
The need for standards - to increase
portability of programs
Problem: When to standardize a language?
If too late - many incompatible versions
If too early - no experience with language
Problem: What happens with the software developed
before the standardization?
Ideally, new standards have to be compatible
with older standards.
Internationalization
I18N issue - How to specify languages
useful in a global economy?
• What character codes to use?
• Collating sequences? - How do you
alphabetize various languages?
• Dates? - What date is 10/12/01?
10-12-01?
12.10.01 ?
Is it a date in October or December?
Internationalization
• Time? - How do you handle
• time zones,
• summer time in Europe,
• daylight savings time in US,
• Southern hemisphere is 6 months out of
phase with northern hemisphere,
• the date to change from summer to
standard time is not consistent.
• Currency? - How to handle dollars, pounds,
marks, francs, euros, etc.
Programming environments
Programming environment:
the environment in which programs
are created and tested.
Separate compilation
Separate execution
Testing
Debugging
Programming environments
Effects on language design:
Modular organization
Local/global variables
Libraries
Programming environments
Process control languages
Scripting languages
• Usually interpreted,
• Able to process programs and data files
• Specify a sequence of operations on
program and data files.
Awk, Perl, Tcl/Tk
Summary
Language design must:
• Allow program solution to match
problem structure
• Allow for world-wide use
• Be easy to prove correctness of
solutions