comp.lang.ada
 help / color / mirror / Atom feed
From: Ray Blaak <blaak@infomatch.com>
Subject: Re: exiting a bloc
Date: 06 Sep 2000 00:00:30 -0700
Date: 2000-09-06T00:00:30-07:00	[thread overview]
Message-ID: <m3d7ii6m41.fsf@ns45.infomatch.bc.ca> (raw)
In-Reply-To: 39B532CB.73D359F8@ix.netcom.com

Richard Riehle <laoXhai@ix.netcom.com> writes:
> I know of one manager with responsibility for embedded Ada software who
> prohibits declare blocks in the code [...nested procedures are better...] His
> point-of-view evolved over many years of watching declare blocks grow to
> cover several pages, become more convulted with the nesting of additional
> declare blocks during program maintenance, and transmogrify into long
> passages of increasingly unreadable code.

This doesn't make sense to me. If the problem is large blocks of code, then the
solution is to break the large blocks into smaller blocks. Declare blocks
themselves are not the problem, and banning them doesn't fix the problem.

After all, nested procedures can also grow as well, until the over all routine
is simply huge and unwieldy.

The rule should simply be: "do things right!". Use the right language language
features for the situation, so that the result is beautiful crystaline code. 

Other stupid rules: no recursion, no instantiations in procedures, no nested
procedures, no access types... I once saw someone, in accordance to the no
access types rule, implement an abstract string referencing scheme using
private integers to index into a pool of string "chunks". Basically he
reimplemented pointers all over again, with the same lost and dangling
reference bugs being possible. Using access types directly would have been much
much simpler, faster, easier to understand and maintain, as well as more
amenable to the automated detection of memory leaks by system tools.

The moral of the story is that banning language features by fiat is stupid. One
should instead understand why a feature should not be used in certain
situations, and what is the right feature to use instead, or at least what can
be done to use the feature in the right way.

> So, are declare blocks, echoing the ancient Jeremiad of Dijkstra,
> "considered dangerous" ?

I don't see how, any more than routines in general can be dangerous.

-- 
Cheers,                                        The Rhythm is around me,
                                               The Rhythm has control.
Ray Blaak                                      The Rhythm is inside me,
blaak@infomatch.com                            The Rhythm has my soul.



      parent reply	other threads:[~2000-09-06  7:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-09-02 20:10 exiting a bloc Mathias Dolidon
2000-09-02 20:39 ` Mathias Dolidon
2000-09-02 21:01 ` Robert Dewar
2000-09-02 22:34   ` Mathias Dolidon
     [not found]     ` <86snrhkfep.fsf@acm.org>
2000-09-03 15:46       ` Mathias Dolidon
2000-09-05 17:52   ` Richard Riehle
2000-09-06  2:06     ` Ted Dennison
2000-09-06  9:41       ` Philip Anderson
2000-09-06 13:54         ` Ted Dennison
2000-09-06 21:10           ` Robert Dewar
2000-09-06 23:33             ` Ed Falis
2000-09-07  0:39               ` Robert Dewar
     [not found]               ` <39B72109.89DFAB8C@telepath.com>
2000-09-07 12:34                 ` Ed Falis
2000-09-08 10:33                   ` Ian Caldwell
2000-09-08 13:35                     ` r_c_chapman
2000-09-09  1:52                       ` Robert Dewar
2000-09-12 11:30                       ` Ian Caldwell
2000-09-12 20:13                         ` Robert Dewar
2000-09-09  1:48                     ` Robert Dewar
2000-09-12 11:24                       ` Ian Caldwell
2000-09-12 20:14                         ` Robert Dewar
2000-09-13  8:34                           ` Philip Anderson
2000-09-13 11:02                             ` Peter Amey
2000-09-06  7:00     ` Ray Blaak [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox