Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #8810

Re: Many forward reference in the code. Is it a ugly design?

From "Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Many forward reference in the code. Is it a ugly design?
Date 2011-08-14 07:27 +0200
Organization A noiseless patient Spider
Message-ID <j27mbe$vhc$1@dont-email.me> (permalink)
References <74a4b057-7063-4944-8cb9-b6bc7559abd5@g5g2000prn.googlegroups.com> <j27g73$6f3$1@dont-email.me>

Show all headers | View raw


On 14.08.2011 05:42, Lynn McGuire wrote:
> On 8/13/2011 10:33 PM, KaiWen wrote:
>> Many forward reference in the code. Is it a ugly design?
>
> If it is then so is mine. I've got about 30
> classes forward referenced. Can't get a clean
> compile without doing that. This is a user
> interface program with about 700 classes.

A large number of forward references need not be a sign of bad design. 
For example, for a sufficiently large system build time can be an 
important criterion. Trading some idealism for shorter build time can 
make sense.

However, a large number of circular references indicate that things 
could be simplified a lot. Whether it's worth the time to do it, that's 
another question.

So, I think, the OP's question has too little information to say 
anything (we don't know the reason for the forward references), and your 
reply has too little information (we don't know the cost of working out 
the circular references, or where they came from).

But as a general rule, it's a good idea to try to avoid circular type 
dependencies.

Circular dependencies make things complicated both for physical 
packaging of the code, and for understanding the constraints on data 
structures etc., and for automating things via smart-pointers.


Cheers,

- Alf

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Many forward reference in the code. Is it a ugly design? KaiWen <wenkai1987@gmail.com> - 2011-08-13 20:33 -0700
  Re: Many forward reference in the code. Is it a ugly design? Lynn McGuire <lmc@winsim.com> - 2011-08-13 22:42 -0500
    Re: Many forward reference in the code. Is it a ugly design? KaiWen <wenkai1987@gmail.com> - 2011-08-13 21:27 -0700
      Re: Many forward reference in the code. Is it a ugly design? Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-08-14 05:54 +0000
        Re: Many forward reference in the code. Is it a ugly design? KaiWen <wenkai1987@gmail.com> - 2011-08-13 23:56 -0700
    Re: Many forward reference in the code. Is it a ugly design? "Alf P. Steinbach" <alf.p.steinbach:usenet@gmail.com> - 2011-08-14 07:27 +0200
      Re: Many forward reference in the code. Is it a ugly design? KaiWen <wenkai1987@gmail.com> - 2011-08-13 23:48 -0700
        Re: Many forward reference in the code. Is it a ugly design? Nobody <nobody@nowhere.com> - 2011-08-14 10:32 +0100
          Re: Many forward reference in the code. Is it a ugly design? KaiWen <wenkai1987@gmail.com> - 2011-08-14 05:13 -0700
        Re: Many forward reference in the code. Is it a ugly design? Paul N <gw7rib@aol.com> - 2011-08-15 13:15 -0700
      Re: Many forward reference in the code. Is it a ugly design? KaiWen <wenkai1987@gmail.com> - 2011-08-14 00:10 -0700

csiph-web