Chapter One Opl
Chapter One Opl
Chapter One Opl
Programming Domain
"Programming domain" in computer science and computer programming is a general term that
refers to the field or problem that a program, programming language or language syntax
is designed to operate within or solve.
In this section, we briefly discuss a few of the areas of computer applications and their associated
languages:
Scientific Applications:
The first digital computers, which appeared in the late 1940s and early 1950s, were invented
and used for scientific applications
They used simple data structure but require large number of floating point arithmetic
computation
The most common data structures were arrays and matrices, ; the most common control
structures were counting loops and selections
The first language for scientific applications was Fortran. ALGOL 60
Business Application
Artificial intelligence (AI) is a broad area of computer applications characterized by the use of
symbolic rather than numeric computations.
The first widely used programming language developed for AI applications was the functional
language Lisp (McCarthy et al., 1965), which appeared in 1959
Most AI applications developed prior to 1990 were written in Lisp
Web Software
The World Wide Web is supported by an eclectic collection of languages, ranging from markup
languages, such as HTML, which is not a programming language, to general-purpose
programming languages, such as Java
Readability
One of the most important criteria for judging a programming language is the ease with which
programs can be read and understood.
The following subsections describe characteristics that contribute to the readability of a
programming language.
Overall Simplicity
The overall simplicity of a programming language strongly affects its readability.
A language with a large number of basic constructs is more difficult to learn
than one with a smaller number.
Readability problems occur whenever the program’s author has learned a
different subset from that subset with which the reader is familiar.
feature multiplicity
Orthogonality
Orthogonality in a programming language means that a relatively small set
of primitive constructs can be combined in a relatively small number of
ways to build the control and data structures of the language.
(The word orthogonal comes from the mathematical concept of orthogonal
vectors
A lack of orthogonality leads to exceptions to the rules of the language. For
example, in a programming language that supports pointers, it should be
possible to define a pointer to point to any specific type defined in the
language. However, if pointers are not allowed to point to arrays, many
potentially useful user-defined data structures cannot be defined.
We can illustrate the use of orthogonality as a design concept by comparing
one aspect of the assembly languages of the IBM mainframe computers and
the VAX series of minicomputers.
The VAX addition instruction for 32-bit integer values is
ADDL operand_1, operand_2
whose semantics is
operand_2 d contents(operand_1) + contents(operand_2)
The VAX instruction design is orthogonal in that a single instruction can use
either registers or memory cells as the operands.
Writability
Writability is a measure of how easily a language can be used to create programs for a chosen
problem domain.
As is the case with readability, writability must be considered in the context of the target
problem domain of a language.
For example, the writabilities of Visual BASIC (VB) (Halvorson, 2013) and C are dramatically
different for creating a program that has a graphical user interface (GUI), for which VB is ideal.
The following subsections describe the most important characteristics influencing the writability
of a language.
Simplicity and Orthogonality
Expressivity
Reliability
A program is said to be reliable if it performs to its specifications under all conditions.
The following subsections describe several language features that have a significant effect on
the reliability of programs in a given language.
Type Checking
Type checking is simply testing for type errors in a given program, either by
the compiler or during program execution.
One example of how failure to type check, at either compile time or run
time, has led to countless program errors is the use of subprogram
parameters in the original C language (Kernighan and Ritchie, 1978).
Exception Handling
The ability of a program to intercept run- time errors (as well as other
unusual conditions detectable by the program), take corrective
measures, and then continue is an obvious aid to reliability
Aliasing
aliasing is having two or more distinct names in a program that can be
used to access the same memory cell.
Cost
The total cost of a programming language is a function of many of its characteristics.
First, there is the cost of training programmers to use the language
Second, there is the cost of writing programs in the language.
Third, there is the cost of compiling programs in the language
Fourth, the cost of executing programs written in a language is greatly influenced by that
language’s design.
The fifth factor in the cost of a language is the cost of the language implementation system
Sixth, there is the cost of poor reliability
The final consideration is the cost of maintaining programs
The late 1960s and early 1970s brought an intense analysis, begun in large part by the
structured-programming movement, of both the software development process and
programming language design
An important reason for this research was the shift in the major cost of computing from
hardware to software, as hardware costs decreased and programmer costs increased
The new software development methodologies that emerged as a result of the research of
the 1970s were called top-down design and stepwise refinement.
In the late 1970s, a shift from procedure- oriented to data- oriented program design
methodologies began.
The first language to provide even limited support for data abstraction was SIMULA 67
Language Categories
Programming languages are often categorized into four bins:
Imperative
Functional
Logic
and object oriented
Implementation Method
Compilation
Programming languages can be implemented by any of three general methods. At one extreme,
programs can be translated into machine language, which can be executed directly on the
computer. This method is called a compiler implementation and has the advantage of very fast
program execution
Most production implementations of languages, such as C, COBOL, and C++, are by compilers.
The language that a compiler translates is called the source language
The lexical analyzer gathers the characters of the source program into lexical units
The syntax analyzer takes the lexical units from the lexical analyzer and uses them to construct
hierarchical structures called parse trees
Pure Interpretation
Pure interpretation lies at the opposite end (from compilation) among implementation
methods.
The interpreter program acts as a software simulation of a machine whose fetch-execute cycle
deals with high- level language program statements rather than machine instructions.
Pure interpretation has the advantage of allowing easy implementation of many source-level
debugging operations, because all run-time error messages can refer to source- level units
Some language implementation systems are a compromise between compilers and pure
interpreters; they translate high-level language programs to an intermediate language
designed to allow easy interpretation. This method is faster than pure interpretation
because the source language statements are decoded only once. Such implementations are
called hybrid implementation systems.
Preprocessors
A preprocessor is a program that processes a program just before the program is compiled.
Preprocessor instructions are commonly used to specify that the code from another file is to
be included. For example, the C preprocessor instruction
#include "myLib.h"
causes the preprocessor to copy the contents of myLib.h into the program at the position of
the #include.
Programming Environment
A programming environment is the collection of tools used in the development of software.
. This collection may consist of only a file system, a text editor, a linker, and a compiler. Or it
may include a large collection of integrated tools, each accessed through a uniform user
interface.
several programming environments
UNIX
UNIX is an older programming environment, first distributed in the
middle 1970s, built around a portable multiprogramming operating
system.
It provides a wide array of powerful support tools for software
production and maintenance in a variety of languages.
BORLAND JBUILDER