Date: 05/30/01
- Next message: Klaus Seidenfaden: "Re: [phplib] PHP and recursion"
- Previous message: Roy Huggins: "Re: [phplib] PHP and recursion"
- In reply to: Paul Smith: "Re: [phplib] PHP and recursion"
- Next in thread: Maxim Derkachev: "Re: [phplib] PHP and recursion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>Yikes, that is dubious advice. Recursion is one of the things that
>makes programming so great!
I was thinking of the wrong book. I was thinking of the section on
recursion in 'Code Complete' by Steve McConnell. I've read both
books recently and got them confused. Steve says:
"In general, recursion leads to small code and slow execution
and chews up stack space. For a small group of problems,
recursion can produce simple, elegant solutions. For a slightly
larger group of problems, it can produce simple, elegant,
hard-to-understand solutions. For most problems, it produces
massively complicated solutions - in those cases, simple
iteration is usually more understandable. Use recursion
selectively."
So anyway, Steve McConnell is a great programmer - I can
recommend his book - and I stand by my dubious advice!
>Yikes, that is dubious advice. Recursion is one of the things that
>makes programming so great! It is a powerful concept, *not* some obscure
>or obtuse feature. Casually dismissing it is akin to blowing off, say,
>object-orientation, or abstraction. I highly encourage you to explore the
>application of recursion further, not less, because it can dramatically
>reduce complexity and reveal solutions that are otherwise unattainable.
>
>
>On Thu, May 31, 2001 at 03:30:41PM +0100, James Johnson wrote:
> > Roy
> >
> > I seem to recall Tobias Ratschiller's book,Web Application
> > Development with PHP 4.0 talks about using recursion.
> > I think he says it can be useful under certain unusual
> > circumstances, but to avoid it generally.
> >
> > James
> >
> >
> > At 09:07 AM 5/31/01 -0500, Roy Huggins wrote:
> > >Hola.
> > >
> > >My question is not related to PHPLib specifically, for which I
> apologize. But
> > >the members of the list have oft displayed good knowledge of the
> underworkings
> > >in PHP and I'd like to get some insight into something I've run into
> recently.
> > >
> > >I recently built a pair of classes whose purpose is to create a tree of
> > >TreeNode
> > >objects in which each node has one parent, many children and an array of
> > >arbitrary data. Performing operations on these trees uses a lot of
> > >recursion, of
> > >course. Upon testing one function that traverses the tree, creating an
> > >array of
> > >path illustration strings through the tree (i.e. $paths[0] ==
> > >"root:node1:node2", $paths[1] == "root:node1:node4:node7"), PHP quit while
> > >complaigning about using too much memory. My script was using a
> whopping 8
> > >megs!
> > >
> > >I examined my code to see if I was doing something stupid to fill up the
> > >RAM and
> > >didn't find anything (which, of course, doesn't mean it isn't there.
> :) But I
> > >wanted to get some more info on how PHP deals with recursion and whether
> > >or not
> > >people have any comments/caveats to express on the issue. I've been
> spoiled by
> > >Scheme and find that recursion is wonderful at times. I'd like to know
> if it's
> > >really a good idea to use it that much in PHP.
> > >
> > >Thanks in advance!
> > >
> > >Regards,
> > >Roy Huggins
> > >roy <email protected>
> > >http://www.royhuggins.com/employability
> > >
> > >
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> > >For additional commands, e-mail: phplib-help <email protected>
> >
> > James Johnson
> > Managing Director
> > Publitek New Media Ltd.
> >
> > IMPORTANT NOTE: NEW ADDRESS
> >
> > 18 Brock Street, Bath, BA1 2LW, UK
> > T: +44 (0) 1225 780174
> > F: +44 (0) 1225 470047
> > Courier deliveries should be addressed to 'West Door'
> > Please amend your records and let your colleagues know
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: phplib-unsubscribe <email protected>
> > For additional commands, e-mail: phplib-help <email protected>
>
>--
>Paul Smith <paul <email protected>>
>InfoTech Designer
>Center for Neighborhood Technology
>Chicago, Illinois USA
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: phplib-unsubscribe <email protected>
>For additional commands, e-mail: phplib-help <email protected>
James Johnson
Managing Director
Publitek New Media Ltd.
IMPORTANT NOTE: NEW ADDRESS
18 Brock Street, Bath, BA1 2LW, UK
T: +44 (0) 1225 780174
F: +44 (0) 1225 470047
Courier deliveries should be addressed to 'West Door'
Please amend your records and let your colleagues know
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Klaus Seidenfaden: "Re: [phplib] PHP and recursion"
- Previous message: Roy Huggins: "Re: [phplib] PHP and recursion"
- In reply to: Paul Smith: "Re: [phplib] PHP and recursion"
- Next in thread: Maxim Derkachev: "Re: [phplib] PHP and recursion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

