comp.lang.ada
 help / color / mirror / Atom feed
* Design - cyclic dependencies
@ 2007-10-26 12:26 Maciej Sobczak
  2007-10-26 14:28 ` Robert A Duff
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Maciej Sobczak @ 2007-10-26 12:26 UTC (permalink / raw)


Consider:

--  a.ads:
package A is
   type T is new Integer;
   procedure P;
end A;

--  a.adb:
with B;
package body A is
   procedure P is
      X : T;
   begin
      B.P (X);
   end P;
end A;

--  b.ads:
with A;
package B is
   procedure P (X : A.T);
end B;

--  b.adb:
package body B is
   procedure P (X : A.T) is
   begin
      null;
   end P;
end B;

There are two logical modules A and B, implemented as packages.
There is no cyclic dependency between the specifications of these
packages and the code is legal.
Still, there is a design-level cyclic dependency between the whole
modules in the sense that A depends on B (A calls some operation of B)
and that B depends on A (B uses some type from A).

Being legal does not imply being good and therefore I ask: do you
consider this kind of design-level cyclic dependency to be acceptable?
If not, what measures would you recommend to correct it?
Extracting T to another package is probably the only reasonable
option, but then there are variants of it (child or sibling package,
etc.).

--
Maciej Sobczak * www.msobczak.com * www.inspirel.com




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-10-31 22:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-26 12:26 Design - cyclic dependencies Maciej Sobczak
2007-10-26 14:28 ` Robert A Duff
2007-10-27  0:09 ` anon
2007-10-31 22:16 ` kevin cline

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