Programming Languages
The Extended Design
Principles
This lecture introduces a list of more specific
principles that can be an aid to the language
designer.
Simplicity.
• Simplicity is perhaps the major reason Pascal
became so successful.
• On the other hand, overly simple programming
languages can actually make the task of using
them more complex.
• Perhaps it is worth repeating here the famous
remark of Einstein:
• Everything should be made as simple as possible,
but not simpler.
Expressiveness
• LISP is expressive in that both data and program
can change during execution in arbitrary ways
• This is especially useful in complex situations
where the size and form of data may not be
known.
• But as we have noted, expressiveness can conflict
with simplicity:
• LISP, Prolog, and Algol68 are extremely expressive
languages that are not simple – partially as a result
of their expressiveness.
Expressiveness (2)
• Expressiveness is some-times viewed as
conciseness, which can also compromise simplicity.
• The C language is expressive in this sense, yet
many programmers do not find C expressions such
as:
•
while (*s++ = *t++);
• easy to understand.
Preciseness.
• Preciseness is the existence of a precise definition
for a 1anguage, so that the behavior of programs
can be predicted.
• A precise 1anguage definition is an aid not only to
reliability of programs but also to the reliability of
translators:
• A precisely defined language will have more
predictable translators, so that program behavior
will not vary as much from machine to machine.
Preciseness (2)
• One step in achieving preciseness is the publication
of a language manual or report by the designer.
• Another is the adoption of a standard by a national
or international standards organization such as the
American National Standards Institute (ANSI) or
the International Organization for Standardization
(ISO).
• But, the Algo168’ reference manual, in attempting
to gain greater precision, was extremely difficult
to read, and the language lost acceptance.
Machine Independence.
• The primary method for achieving machine
independence is the use of predefined data types
that do not involve details of memory allocation or
machine architecture.
• Unfortunately, these data types can never be
entirely free from machine issues.
• The Ada language contains many facilities for
specifying the precision of floating point numbers
and thus removing dependencies on the precision
of the operations of a particular machine.
Security.
• This principle promotes a language design that
both discourages programming errors and allows
errors to be discovered and reported.
• Security is closely related to reliability and
preciseness.
• It was this principle that led language designers to
introduce types, type checking, and variable
declarations into programming languages.
Extensibility.
• This principle advocates that there should be some
general mechanism for the user to add features to
a language.
• Add new features could mean simply to be able
to define new data types, which most languages
allow.
• Or, it could mean to add new functions from a
library, which many languages permit as well.
• It could also mean to be able to add keywords and
constructs to the translator itself.
Restrictability.
• A language design should make it possible for a
programmer to program usefully using a minimal
knowledge of the language and a minimum
number of language constructs.
• Thus the language design should promote the ability
to define language subsets.
• This can be useful in two ways: first, a
programmer need not learn the whole language to
use it effectively; second, a translator writer could
choose to implement only a subset if implementing
the whole language is too costly or unnecessary.
Descargar

A Big Test Result - Knowledge Systems Institute