comp.lang.ada
 help / color / mirror / Atom feed
* Re: The Obfuscated Ada Contest
@ 1992-10-28 13:45 crispen
  0 siblings, 0 replies; only message in thread
From: crispen @ 1992-10-28 13:45 UTC (permalink / raw)


!gary@ucbvax.Berkeley.EDU  (Gary Funck) sez:

>dissenting/confirming opinions welcome,

OK, here's a few of the former.

> I've heard of a project
> which mandated that global (library level package) variables 
> could *not* be referenced by packages other than the packages
> that declared them.  This mandate apparently led to the development
> of procedures with up to 20 parameters, whose values were passed
> up and down the call hierarchy.  When the delivered system couldn't
> meet its time constraints, the code was reworked so that it
> judiciously used global variables. Voila!  it was twice as fast
> and half the size.

I would very much like to know the details of this since it
doesn't match my experience.  Mind you, there are smart ways and dumb
ways to do this (why 20 parameters, for example?) and some early
Ada compilers made you pay a severe penalty on values returned by
functions, but my experience has been that controlling data flow
through subprogram parameters has never had overwhelming effects on
speed.  I've seen (but not really believed) claims that because stack
and heap variables are likelier to be in cache than globals, parameters
might actually make code run faster!  Could it be that the folks you're
talking about also suppressed checks to get their speed improvement?

> First, I'm aware of some/most of the gotchas related
> to the rampant use of the "use clause".  But hey, I give the
> programmer the benefit of the doubt, and also believe in code
> review.  If a "use" makes things clearer, then so be it.  If
> adding a new item to another package causes a clash in one of
> its "users", then fix the clash and get on with it.

Perhaps I'm unique, but my biggest gotcha with USE clauses is that
they obscure the audit trail.  It seems that the folks who deliver
us package bodies with 97 use clauses are also fond of putting
millions of subprograms and visible variables in all the packages
they USE.  There is, BTW, a very acceptable alternative: the local
USE clause within a DECLARE block created just for the purpose of
permitting the code readability helped by the USE.

And a couple of the latter:

I couldn't agree more about stupid names.  One particularly heinous
program that's going on now requires prefixing package identifiers
to all names.  They probably also recommend the USE clause!  So
instead of saying Package_Name.Thing_Name you have to say
Package_Name_Thing_Name.  Oooooh, good idea!

And I suppose I really ought to sit down and work through all the steps
to justify my ill-considered belief that when Booch components are
non-trivial, they're harmful.
+-------------------------------+--------------------------------------+
| Bob Crispen                   |   The owls are not what they seem    |
| crispen@foxy.boeing.com       +--------------------------------------+
| (205) 461-3296                |Opinions expressed here are mine alone|
+-------------------------------+--------------------------------------+

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1992-10-28 13:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-10-28 13:45 The Obfuscated Ada Contest crispen

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