[plt-scheme] Perplexed Programmers

From: Marco Morazan (morazanm at gmail.com)
Date: Thu Aug 30 23:42:12 EDT 2007

On 8/30/07, Prabhakar Ragde <plragde at uwaterloo.ca> wrote:
> > To my surprise Monday, first day of the semester, a group of complete
> > novice programmers understood recursion.
> >
> > Tell this to your resistors:  Recursion is easier to understand if
> > you are young, or young at heart, if closing your eyes and just
> > "using the force" feels natural.  Recursion is hard if a person
> > thinks it is hard and then works too hard on expansions.
>
> I don't think this is the issue. Recursion is hard to understand when
> one is programming in Java, C++, or the like, because one has to
> understand a stack model (or equivalent). That's why it's traditionally
> a CS 2 topic and struggled with even then. In a purely functional subset
> of Scheme, with a substitution model, recursion is easy to understand --
> easier than loops in an imperative language. Marco's colleagues were
> remembering their own difficulties with recursion and those of students
> they had taught in a classic CS 2 mode. I've had this problem with my
> colleagues as well. One has to read through the appropriate chapter of
> HtDP, or better yet, teach out of it, before one entirely believes
> otherwise. --PR

Yes, that is closer to the mark. Furthermore, the vast majority of
intro to programming textbooks that use Java, for example, seem to
purposely avoid recursion as a perfectly good programming technique.
The reason must be, of course, that recursion is too hard according to
a few people I know.

I have also tried talking to them about the connection between
tail-recursion and for-loops. It seems an article of faith that
for-loops are simpler......... There is a lot of what I call Von
Neumann contamination in their mental processes: some people believe
that sequencing statements is an _essential_ part of all algorithms.
It is a tough culture to change.

Marco


Posted on the users mailing list.