<#102#>We ascribe beauty to that which is simple,
which has no superfluous parts;
which exactly answers its end,
which stands related to all things,
which is the mean of many extremes.
<#102#> ---Ralph Waldo Emerson, <#103#>The Conduct of Life<#103#>
We have chosen Scheme as the programming language for this book, and we
have designed and implemented DrScheme, a programming environment for the
language with special assistance for beginning students. The programming
environment is freely available at the book's official Web site (see
below).
Still, the book it is not about programming in Scheme. We only use a small
number of Scheme constructs in this book. Specifically, we use six
constructs (function definition and application, conditional expressions,
structure defininition, local definitions, and assignments) plus a dozen
or so basic operations. This tiny subset of the language is all that is
needed to teach the principles of computing and programming. Someone who
wishes to use Scheme as a tool will need to read additional material.
The choice of Scheme for beginners is natural. First, the core of Scheme
permits programmers to focus on just those two elements of programming
that we pointed out at the beginning of the preface: programs as relations
between quantities and evaluating programs for specific inputs. Using
just this core language, students can develop complete programs <#106#>during the first session<#106#> with a teacher.
Second, Scheme can easily be arranged as a tower of languages. This
property is crucial for beginners who make simple notational mistakes that
generate obscure error messages about advanced features of a language. The
result is often a wasteful search and a feeling of frustration on the
student's side. To avoid this problem, our programming environment,
DrScheme, implements several carefully chosen sublanguages of
Scheme. Based on this arrangement, the environment can signal error
messages that are appropriate to a student's level of knowledge. Better
still, the layering of languages prevents many basic mistakes. We
developed the layers and the protection modes by observing beginners for
weeks in our laboratory. As students learn more about programming and the
language, a teacher can expose students to richer layers of the language,
which allows students to write more interesting and more concise programs.
Third, the DrScheme programming environment offers a truly interactive
evaluator. It consists of two windows: a <#107#>Definitions<#107#> window,
where students define programs, and an <#108#>Interactions<#108#> window, which
acts like a pocket calculator. Students can enter expressions into the
latter, and DrScheme determines their values. In other words, computation
starts with pocket-calculator arithmetic, which they know quite well, and
quickly proceeds from there to calculations with structures, lists, and
trees---the kinds of data that computer programs really manipulate.
Furthermore, an interactive mode of evaluation encourages students to
experiment in all kinds of manners and thus stimulates their curiosity.
Finally, the use of an interactive evaluator with a rich data language
permits students to focus on problem solving and program design
activities. The key improvement is that interactive evaluation renders a
discussion of input and output operations (almost) superfluous. This has
several consequences. First, input and output operations require
memorization. Learning these things is tedious and boring. Conversely,
students are better off learning problem-solving skills and using canned
input and output support. Second, <#109#>good<#109#> text-oriented input
requires deep programming skills, which are best acquired in a course on
computational problem-solving. Teaching bad text-oriented input is a
waste of the teachers' and the students' time. Third, modern software
employs graphical user interfaces (GUI), which programmers design with
editors and ``wizards'' but not by hand. Again, students are best off
learning to design the functions that are connected to rulers, buttons,
text fields and so on, rather than memoizing the specific protocols that
currently fashionable GUI libraries impose. In short, discussing input and
output is a waste of valuable learning time during a first introduction to
programming. If students decide to pursue programming in more depth,
acquiring the necessary (Scheme) knowledge about input and output
procedures is straightforward.
In summary, students can learn the core of Scheme in a couple of hours, yet
the language is as powerful as a conventional programming language. As a
result, students can immediately focus on the essence of programming,
which greatly enhances their general problem solving skills.