comp.lang.ada
 help / color / mirror / Atom feed
From: Maciej Sobczak <see.my.homepage@gmail.com>
Subject: Design - cyclic dependencies
Date: Fri, 26 Oct 2007 05:26:00 -0700
Date: 2007-10-26T05:26:00-07:00	[thread overview]
Message-ID: <1193401560.389194.282030@o3g2000hsb.googlegroups.com> (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




             reply	other threads:[~2007-10-26 12:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-26 12:26 Maciej Sobczak [this message]
2007-10-26 14:28 ` Design - cyclic dependencies Robert A Duff
2007-10-27  0:09 ` anon
2007-10-31 22:16 ` kevin cline
replies disabled

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