Java Reference
In-Depth Information
Italian, are full of ambiguities. A sentence can often have two or more different
meanings. For example, consider the following sentence:
Time flies like an arrow.
The average human is likely to interpret this sentence as a general
observation: that time moves quickly in the same way that an arrow
moves quickly. However, if we interpret the word time as a verb
(as in “run the 50-yard dash and I'll time you”) and the word flies
as a noun (the plural of fly), the interpretation changes completely.
We know that arrows don't time things, so we wouldn't normally interpret the
sentence that way, but it is a valid interpretation of the words in the sentence.
A computer would have a difficult time trying to determine which meaning is
intended. Moreover, this sentence could describe the preferences of an unusual
insect known as a “time fly,” which might be found near an archery range. After
all, fruit flies like a banana.
The point is that one specific English sentence can have multiple valid mean-
ings. A computer language cannot allow such ambiguities to exist. If a program-
ming language instruction could have two different meanings, a computer would
not be able to determine which one should be carried out.
KEY CONCEPT
Syntax rules dictate the form of
a program. Semantics dictate the
meaning of the program statements.
Errors
Several different kinds of problems can occur in software, particularly during
program development. The term computer error is often misused and varies in
meaning depending on the situation. From a user's point of view, anything that
goes awry when interacting with a machine can be called a computer error. For
example, suppose you charged a $23 item to your credit card, but when you
received the bill, the item was listed at $230. After you have the problem fixed,
the credit card company apologizes for the “computer error.” Did the computer
arbitrarily add a zero to the end of the number, or did it perhaps multiply the
value by 10? Of course not. A computer follows the commands we
give it and operates on the data we provide. If our programs are
wrong or our data inaccurate, then we cannot expect the results to
be correct. A common phrase used to describe this situation is “gar-
bage in, garbage out.”
You will encounter three kinds of errors as you develop programs:
KEY CONCEPT
The programmer is responsible for
the accuracy and reliability of a
program.
compile-time error
run-time error
logical error
 
Search WWH ::




Custom Search