Design Criteria For Programming Languages
Design Criteria For Programming Languages
What are the goals of the language? Below are a list of guiding principles in the design of programming
languages. Most of which are listed in your textbook.
Principles may be conflicting. No language can accomplish all goals.
Language Goals
During 1950s--1960s - Compile programs to execute efficiently.
There was a direct connection between language features and hardware - integers, reals, goto statements
Programmers cheap;
Machines expensive;
Keep the machine busy
But today
Naturalness for the application - program structure reflects the logical structure of algorithm
Ease of program verification - verifying that program correctly performs its required function
Portability of programs - transportability of the resulting programs from the computer on which they are
developed to other computer systems
Cost of use - program execution, program translation, program creation, and program maintenance
Efficiency of execution
This is the earliest of design criteria, because of small memories and slow execution.
FORTRAN had (has) statements that resembled machine instructions.
Writability
This is the quality of expressivity in a language. Writability should be clear, concise, quick and correct
[1 2 3 4]
[5 6 7 8]
[9 10 11 12]
LISP has simple, writable syntax in that data structures and program structures use same syntax.
(f a1 a2 a3 ... an) is the statement and functional syntax (function name and arguments follow)
(+ 12 total)
(1 2 3 4 (5 6 ) 7 (9 10))) is a data structure that can represent a tree like structure, nested lists, matrices, etc.
Readability
The quality of a language that enables the reader (even non-programmers) to understand the nature of the
computation or algorithm.
IF NOT-END-OF-FILE-FLAG THEN
PERFORM 100-READ-NEXT-DATA-SET
VARYING I FROM 1 TO 10
AT END PERFORM 999-UNEXPECTED-EOF.
statically declared variables (vs stack based variables) are easy to reference
constants (#define)
register variables
++ (add 1 operation)
Efficiency of translation
How fast is the compiler or interpreter?
Pascal is easy
Reliabililty
Assurance that a program does not behave unexpectedly.
e.g. array bounds checking
Implementability
This is the efficiency with which a translator can be written
Algol as designed was a stack based language but computers at the time didn't have stacks as part of the
architecture
recursion implementation is difficult without a stack
FORTRAN EQUIVALENCE statement (a classic algorithms problem)
Maintainability
The ease of which errors can be found and corrected and new features added
This supplants writability.
Consider C++, Java, Ada and Modula-3
Generality
The avoidance of special cases and generalizing related constructs into one construct
Pascal has 3 different loop structures (while, repeat, and for)--not a good example of generality
Ada has 1 loop structure with variations -- a good example of generality
char yes
integer yes
real yes
boolean yes
enum no
m options on x axis
n options on y axis
mn interactions
m+n facts to learn
e exceptions
m+n+e facts and exceptions to be learned
mn-e features
want m+n+e << mn-e
Uniformity
The consistency of appearance and behavior of language constructs
Simplicity
keep it simple
Pascal's success
BASIC was simple but lacked declarations and blocks
Java tried to simplify C++
Expressiveness
Having enough features to be available as needed for the realm of applications
Preciseness
A measure of how well a language has features for slight variations
Security
Language violations of definition should not escape detection
Regularity (consistency)
Having consistency with accepted notations and conventions
MACROs in assembler
#define in C
FORTH allows definition of new structures
LISP allow definition of new functions (everything is a function)
operator overloading in Ada and C++
class definitions in object oriented languages