Tue, 14 Apr 1998 10:07:29 -0700
Joel Seidman wrote:
> Mail*Link( SMTP with considered harmful? (was: Compilation
> speed dataI
> Robert I. Eachus said:
> <<I've actually had to convince projects to accept guidelines...
> (More than six withs on a package spec, or fifteen on a package body
> indicates that there is restructuring that should be considered. There are
> good arguments for having more withs on the main program, but a with on a
> subunit is almost always an indication of a design problem.) >>
> I found this very interesting. I've always considered minimizing with's a
> good design goal, evidencing good choice of modularity. But I'm sure many
> programmers I work with are not aware of the concept you are advocating.
> While most would never (almost never) use a "goto", many would add a "with"
> at the drop of a hat if it would "make the program work". Are there specific
> references I can cite when I argue for this? (I don't have enough
> authority/stature, and saying "some guy on the internet said so" has never
> worked well for me.) Or is this just basic stuff "everybody knows"?
> -- Joel
These "rules of thumb" relate directly to well-established design
1) minimize inter-module coupling,
2) maximize intra-module cohesion, and
3) the concern for information hiding (encapsulation).
If these principles are applied consistently, proliferation of "with"s
will not occur.
If you don't understand how to design Ada modules which are consonant
with these principles, that is to say if you don't understand the
mechanics of Ada well enough to see how to use Ada constructs to support
these principles in your software design, there is no hope that you will
produce a well-engineered system in the first place.