[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Functional Paradigm popularity and Maths (Was: XML as a transitionto s-expr)



On Wed, 19 Dec 2001, David Simmons wrote:
> Well, ok. I have to jump in here a bit.
>
> Alan Kay's goals for Smalltalk were to invent a language that "children"
> could program. In that, it has been shown to be quite successful.
> Children of ages 4 and up have been able to understand and write
> programs and design objects in Smalltalk.

Could you pass along any references to this work on teaching four
year olds how to program in Smalltalk?  It sounds interesting (like
the Logo work). I'm actually more interested in teaching college students
than children however.

>
> It takes just hours for most people to pick up Smalltalk and begin to be
> productive.
>
> Lisp requires one to think in terms of "lists" and "recursion". This can

Not ncessarily. We spend about six weeks teaching web programming in Lisp
before getting into lists and recursion. Quite a bit of web programming is
in fact, reactive programming. Process a form by reading the form inputs,
reading some data from files, writing data to other files (or databases),
sending email, and generating a web page. None of which requires recursion
and all of which is useful and fun for novices. Likewise, there is a
fairly large design space for interactive programs that are reactive and
do not deal with lists, e.g. creating windows with menus, buttons,
textfields, etc. and adding actions that read from various components and
write to others. In this contest lists arise naturally (e.g. how do I deal
with a form where multiple checkboxes are checked ---> leads into uses of
"map" or list recursion).

> be a very difficult cognitive barrier that is limited by the persons
> (mental development -- abstract thinking) "age" and the corresponding
> "educational" exposure (to abstract thinking) of the person involved.
>
> For children, thinking in terms of conversations with "things" and
> adding new "verbs" or "nouns" for those conversations is easier.

But Scheme can also express the idea of dealing with "things" and
adding "actions", e.g., the following is a snippet of code using
a GUI library written in Scheme (such libraries are clearly easy to write)
and that is a typical 20 minute "quiz" question.

;;;; untested code, using the "JLIB" library of Jscheme

(define tx (textfield "" 10))
(define ty (textfield "" 10))
(define tz (textfield "" 10))
(define ta (textfield "" 10))
(define w
  (window "test"
    (menubar
      (menu "File"
        (menuitem "quit" (action (lambda(e) (.hide w)))))
      (menu "Help"
        (menuitem "about" (action (lambda(e) (.pack w) (.show w))))))
    (col
       (label "triangle area given three sides")
       (table 3 2 (label "x") tx (label "y") ty (label "z") tz)
       (button "compute area" (action (lambda(e)
         (let* (
            (x (readexpr tx))
            (y (readexpr ty))
            (z (readexpr tz))
            (s (/ (+ x y z) 2.0))
            (a (sqrt (* (- s x) (- s y) (- s z) s)))
               )
          (writeexpr ta a))))
       (row (label "area") ta))))
(.pack w)
(.show w)

I would claim that this type of program allows students to
think about objects and actions in a very simple and declarative
way. It would be interesting to see how such a simple application
looks in other languages (python, perl, smalltalk.

Also, as for the )))))) build up, (say at the end of menus).
Students are generally able to "count" parens by naming the
enclosing expression, e.g.
  close-show, close-lambda, close-action close-menuitem close-menu close-menubar
as long as the expression fits on one page, this is easy to do without any
support. Once procedures get larger than a page, its often a good time to
refactor and abstract.

>
> So just what are we saying...
>

I guess I'm saying that the simplicity of the Scheme syntax and the
simplicity of the functional model (as illustrated in the previous
example) makes it easy to teach fairly
sophisticated programming to students with no programming background.

What is it about smalltalk, python, etc. that would make it easy
for novices to become productive?

---Tim---