[comp.lang.forth] Learning Curve

ir230@sdcc6.ucsd.edu (john wavrik) (12/06/89)

Steve Rudek writes:

> Forth probably has the steepest learning curve of any language in existence.  
> Given the severity of the learning curve, even "ordinary" levels of 
> documentation are NOT sufficient.

Steve, please do not say this so loudly. The course I teach is a course in 
mathematics. I justify the fact that sneak in an introduction to the Forth 
language by telling my department that it is a very easy language to learn.

Forth is very much like mathematics. You can either understand a few simple
underlying ideas or you can insist that ideas are irrelevant, you want 
formulas to plug numbers in to. Anyone can learn mathematics provided they
approach it on its own terms.

Forth *is* a very easy language to learn -- we've had many novices do very 
well with it. But we have also had a few students who have trouble with it, 
and I've tried to understand why. 

The students who learn the language easily are those who believe me when I
say that VIEW, SEE and DUMP are the most important words in Forth.

       VIEW  lets them see the source code and understand how the word
             is defined

       SEE   lets them see (symbolically) what has actually been compiled
             in memory

       DUMP  lets them check that they are storing the right data in the
             right place

They also believe me when I say that the use of screens for source code is one 
of Forth's strong points -- if their definition does not fit on a screen it is 
because their ideas have not been clarified. They need to factor -- and, of 
course, to test their definitions before they go on to the next screen.

[P.S. Things have been helped along by a good Forth screen editor. I used
a commercial one for my own work, but Nick Spies wrote a generic one. I will 
be happy to supply a copy, customized for F83, by email.]

Most students quickly learn how to exploit an interactive programming 
environment and find that understanding what they are doing is a refreshing 
experience. 

There are, of course, some students who insist upon imposing batch programming 
ideas on Forth. They use the "vi" editor to write definitions which go on for 
7 screens and contain 21 bugs -- and then criticize Forth for not having 
adequate debugging tools.

There is a kind of mental barrier that exists for some people: they've been 
trained to believe that what goes on underneath a language is so arcane that 
only specialists (or hackers) can understand it. [The same kind of barrier 
prevents many people from understanding mathematics.] 

I guess we all can admit to having some problems with understanding CREATE ..
DOES> when we first saw it. But the problems go away if you spend about an
hour finding out what DOES> actually does. Look at the definitions, see how 
the child word's code address has been changed, disassemble the code that 
this points to and, lo, you understand DOES>.

I once tried to teach my course allowing students to use the language of their 
choice. My conclusion is that most students, even after taking a course in a 
conventional language, cannot program their way out of a paper bag and have 
gained no understanding of computers and their languages.

Forth, unconventional though it may seem to be, can be used to teach both the 
traditional disciplines of programming and an understanding of how computers 
deal with languages. I use it to show everything from what machine language is 
about to how high level languages compile source code. 

Forth, in my experience, has a shallow learning curve because it can be 
learned by understanding how it works. It is a strong language because of its 
simplicity and the insight it can impart.

DISCLAIMER:
   All of my personal work and my classes have been based on "traditional"
   implementations of Forth (i.e. those which are descendants of the FIG
   model). My comments concerning simplicity and strength may only be
   applicable to them.


                                                  John J Wavrik 
             jjwavrik@ucsd.edu                    Dept of Math  C-012 
                                                  Univ of Calif - San Diego 
                                                  La Jolla, CA  92093