Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: Gerry Quinn <gerryq@xxxxxxxxxxxxxxxxxxx>
- Date: Mon, 9 Jan 2006 14:31:15 -0000
In article <1136648171.253255.116760@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
wookiz@xxxxxxxxxxx says...
> Gerry Quinn wrote:
> > > Most Java(any imperative language) programmers will instinctively opt
> > > for an iterative solution and will only use recursion when they are
> > > forced to.
> > If that's the point, it's not a very good one. A language that allows
> > you to pick appropriate solutions is better than one that forces you
> > into unsuitable ones.
> The problem is with your conception of "appropriate" and unsuitable.
>
> Lists (or some derivative thereof so that includes arrays, stacks,
> queues) are just about the most common and useful data structure in
> computer science. How can you possibly class a recursive solution to
> processing a list as unsuitable and inappropriate. It actually is the
> best and most natural fit for the processing lists like structures for
> the simple reason that a list is in fact a recursively defined data
> structure.
Complete nonsense. A list is a data structure, and different means can
be used to define it. Recursion is useful in mathematical definitions,
but programming is not math. But even if there is no better way than
recursion to define an ordered set, that does not imply (as you imply
above) that recursion is in every possibly situation the best way to
process it. Many languages are suitable for the implementation of both
recursive and iterative methods.
> There is nothing suitable or appropriate about stating
>
> y = y + 1
>
> because it quite obviously isn't true. It makes no mathematical sense
> nor would it make sense to the man in the street. It's just the
> perverted way in which many programmers go about effecting iteration.
> Just because thats the way they easily understand whats going on
> doesn't mean there's anything suitable or appropriate about it.
Actually it is an example of recursion. A function (+1) is called
repeatedly to modify y.
Iteration usually looks like:
for( int i = 0; i < maxVal; i++ ) {}
...or
for ( iterator i = begin(); i != end(); i++ ) {}
The above succintly indicate that all elements of a set are to be
processed, and the sequence in which this will occur. The first
includes a counter, which is often very useful.
> The fact is the mental model humans adopt to doing iterative things is
> a recursive one.
>
> Whether it's a 2 year old toddler, middle aged man or 90 year old
> woman, if you put them at the bottom of the steps and ask them to climb
> to the top they do they
>
> start by counting the number of steps,
> climb a step,
> then say steps climbed = steps climbed + 1,
> then compare steps climbed to the total number of steps.
>
> or do they
>
> climb(steps)
> if no more steps stop
> go up the first step
> climb (rest of steps).
Once they have learned to walk and count, they do what is best in a
given situation. But I would say that they normally do:
go to bottom of stairs
if ( at top ) stop
climb next step
repeat
This corresponds best to my second example of iteration.
> > Then the solution is to practice the techniques, but there's no need to
> > abandon Java in favour of a toy language that is limited to them and no
> > other.
> You are confusing popularity with capability and power!! Just because
> Java gives you 3 different ways of writing loops in addition to
> recursion do you think that makes it more powerful.
Yes. And it's nothing to do with popularity.
> Lets not even talk
> about things like higher order functions that Java doesn't even
> support.
If functional languages were so great, people would use them. That is
the 'popularity' argument, and it is quite a valid one.
> The main reasons why imperative programming languages are in more
> widespread use have nothing to do with them being better suited for
> "real work", or being "serious languages". It's because they are
> accessible to the mathematically unsophisticated which is a
> description that probably applies to the majority of people employed
> as programmers today.
In other words, they are suited to real work by real people. And
frankly, if a language is easier to use for ordinary folks, it is
probably easier to use for everyone.
> The whole point Spolsky is making is that teaching people in Java means
> that the odds are they won't practice these techniques in the first
> place.
And it's the same half-baked point that has been made for millennia,
when those who consider themselves as members of an intellectual elite
get worried that their inferiors are achieving much the same things as
they can, without having bothered with the elaborate membership
initiations. "They must be stopped", they wail. "How can the sacred
work be left in the hands of ignorami?".
> > > Misses the point again.
> > > The ability to think recursively is an important skill for a programmer
> > > and indeed problem solvers at large.
> >
> > Yes, it's very useful. And you can learn it from Java, or Basic for
> > that matter.
> But the fact is your average Java programmer can't parse an abritarily
> nested regular expression and can't grok XSLT because they ain't used
> to thinking recursively. Why. Because they work in languages that lets
> them work around having to.
When they need to learn it, they will. Hopefully employers will choose
to hire staff capable of doing or learning to do what they need,
whether that includes the above things or not.
Though if their teachers haven't taught them the basics, I would blame
them rather than the language.
- Gerry Quinn
.
- Follow-Ups:
- Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: Jonathan Bartlett
- Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: wooks
- Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- References:
- Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: Casey Hawthorne
- Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: Gerry Quinn
- Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: wooks
- Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: Gerry Quinn
- Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: wooks
- Interesting article by Joel Spolsky: The Perils of JavaSchools
- Prev by Date: Re: which PC for software development?
- Next by Date: Re: Reply to Gerry Quinn - Perils of Java Schools.
- Previous by thread: Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- Next by thread: Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- Index(es):
Relevant Pages
|