Professor
Cramwell’s History is currently only available on Android, that means
that its written in Java. Java is a workhorse language: used, loved, and
loathed by programmers the world over. If you have never programmed
before you may be under the impression that all programming is basically
the same thing; that writing a program to run an industrial machine, a
pacemaker, or something on the internet is basically the same. If so,
you are correct, but in a way that is entirely misleading.
There is a mathematical proof
(which I don’t really understand) which has the consequence that
every type of computation which can be written in one logical language
can be written in another. A famous thought experiment in the field deals
with a robot that moves up and down an infinitely long track and in
doing so produces many diverse and wonderful effects.
This
thought experiment can be used to prove that all languages are the same
from a formal standpoint. While theoretically correct, it is
practically misleading.
Practically,
languages are less like like infinitely long tracks, and more like
airplane cockpits. A thousand different tiny controls, many of which, if
set improperly will cause a difficult to diagnose crash. But they
aren’t really standardized to any great extent , though they have many
common elements; each language is its own standard. And they evolve and
change, and have the equivalent of vestigial organs (switches that
should never be touched).
All
common computer languages are completely precise. Expressing anything
in any of them takes a lot of time and effort. A simple statement in
english--get the letter, search the letter for the word Dr. Smith,
replace it with Dr. Smithy, and send it to Dr. Smithy’s secretary--can
take many millions of instructions to a machine. But it doesn’t take
millions of lines of human generated code.
Describing
these instructions directly to a machine is too hard. Programming was
done that way in the early days; and this type of machine instructional
description is the end result of every computer program. But it is not
written by people anymore.
Consider
a small child who repeats “wa-wa” over and over again; his mother
understands that he wants water, she asks her husband to go to the
drink-stand; he goes and selects a bottle of water, requests it from the
cashier, pays the cashier, delivers the water to the child. The water
had previously been bottled and ordered by the manager of the store. And
had at one point been filled into the bottle.
This
is also how computer programs attempt to work. The programmer writes
something simple (she is the child), the simple statement is transformed
by other programs into more and more complex and specific statements
(which are physically represented in the machine by electrical changes),
and eventually an effect is produced for the programmer.
No
program or system of programs has been built yet which can come close
to robustness, fault tolerance and flexibility of the family in search
of water for their child. But within very constricted domains, such as
search, we see this type of flexibility becoming a reality.
All
computer language designers unconsciously struggle to capture the
expressive power of natural language given the constraints of machines.
Most programs are attempts to codify simple concepts.
So
what does Java bring to the pool of programming languages? The big idea
behind java is that it is easier to reason about things if they can be
put into a logical hierarchy. So the structure of Java encourages the
programmer to deal with hierarchies to solve problems. So if you were
writing a program for people and you wanted to write part of it
especially for people in Botswana:
1.) you would write the portion that applies to all people
2.) you would write the portion that applies to all people in Africa and including the portion that applies to all people.
3.) you would write the portion that applies to all people in Botswana including the portion which applies to Botswana
Therefore
a person from Botswana in your java program would have all the
characteristics of a person from Africa and any person in the world.
This
type of an approach works ok, but in reality its very hard to design a
hierarchy and to decide which aspects should be reflected in which
portion. Most programmers work by iterating toward a solution, meaning
that hierarchies grow in a process which resembles the natural growth of
a bush. This makes hierarchies less likely to reflect original logical
assumptions and more likely to reflect the problem space; which in turn
seriously compromises their ability to aid in understanding.
So,
if thats the case it makes more sense to use flatter hierarchies, or
even to dispense with hierarchies and to have different independent
portions of the program interact with one another, in the style of the
family above.
-Tomaz
No comments:
Post a Comment