Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: "wooks" <wookiz@xxxxxxxxxxx>
- Date: 8 Jan 2006 01:22:38 -0800
Gerry Quinn wrote:
> In article <1136550849.114794.145020@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
> wookiz@xxxxxxxxxxx says...
> > Gerry Quinn wrote:
>
> > > It's ironic to see the somewhat trivial concepts of pointers and
> > > recursion feted as challenging, purely on the basis that certain
> > > programmers are unfamiliar with their use. [And surely Java supports
> > > recursion as well as any language?]
>
> > Misses the point.
>
> > 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.
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.
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).
Same thing with a lecturer marking papers or a clerk processing
invoices. Only programmers approach these iterative tasks by counting
the total and keeping a running total as you process each one.
> (Actually I would expect many beginning programmers will be over-
> excited by the concept of recursion, and will use it in inappropriate
> circumstances.)
>
> > Iterative solutions don't scale well to increasingly complex data
> > structures. In those situations your imperative programmer takes a lot
> > longer to produce buggier, less concise solutions, because they are not
> > practised in recursive techniques.
>
> 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. Lets not even talk
about things like higher order functions that Java doesn't even
support.
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.
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.
> > > Then comes the extolling of functional languages such as Lisp, which
> > > have more advocates than useful programs written in them. It expands
> > > the brain and makes you a better person, or so we're told. I've heard
> > > colonic irrigation does the same.
>
> > 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.
>
> - Gerry Quinn
>
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.
.
- Follow-Ups:
- Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: Walter Bright
- Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: Gerry Quinn
- Re: Interesting article by Joel Spolsky: The Perils of JavaSchools
- From: Chuck F.
- 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
- Interesting article by Joel Spolsky: The Perils of JavaSchools
- Prev by Date: Re: What is the flowchart symbol for try and catch?
- Next by Date: Re: What is the flowchart symbol for try and catch?
- 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
|