Re: OOP style
- From: "Maarten Wiltink" <maarten@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 25 Aug 2005 22:51:57 +0200
"swansnow" <schultz@xxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1125001669.617678.171510@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Nested routines... Do you mean you declare procedures inside a
> procedure? That sounds intriguing.
That's Pascal for you.
There are drawbacks, though. In some of the more interesting cases,
they can't be used.
> In my scenario of a humongous method, needing to be broken down, then,
> would you put the "helper" methods nested inside the "main" method?
Sometimes. It limits code reuse, though, so unless the oversized method
very naturally falls to pieces, there is not all that much call to do
this.
But sometimes the outer method congeals into five simple procedure calls.
That does look nice.
> Scope-wise, does this mean that the nested procedures are only visible
> to the containing procedure? Do they have access to the class's
> variables, and the containing procedure's variables, too?
Yes, yes, and yes.
The last yes is provisional. They have access to local variables in
the containing routine that were declared _before_ the nested routine.
Since this is entirely too much like global variables, I consider
this reason enough to declare all local variables _after_ any nested
routines, and pass parameters if they are needed.
It probably has access to the outer procedure's parameters, though,
and this can't be fixed. But it can be ignored.
Groetjes,
Maarten Wiltink
.
- Follow-Ups:
- Re: OOP style
- From: swansnow
- Re: OOP style
- From: Bruce Roberts
- Re: OOP style
- References:
- OOP style
- From: swansnow
- Re: OOP style
- From: Bruce Roberts
- Re: OOP style
- From: swansnow
- OOP style
- Prev by Date: Re: Newbie question about release, freeAndNil, etc
- Next by Date: Re: OOP style
- Previous by thread: Re: OOP style
- Next by thread: Re: OOP style
- Index(es):
Relevant Pages
|