[lazarus] Circle dependencies in the lcl

Michael A. Hess mhess at miraclec.com
Mon Jan 15 10:51:17 EST 2001


Mattias Gaertner wrote:
> 
> I believe it is bad coding to program circle dependencies.

Possibly but not always avoidable.

> Case 1:
>   graphics.pp <-> controls.pp
>     Even Delphi avoids this. This circle can easily be destroyed.
>     Move the procedure CN_SendMessage from
>     controls.pp to lmessages.pp.

By all means if this can remove a circle dependency I am all for it. The
reason SendMessage was original placed in controls.pp was because I
wanted to limit the location of the link between the LCL and the Widget
API. Since just about everything uses controls.pp this seemed reasonable
at the time. However things have evolved over time. If it now makes more
sence to place this link in lmessages.pp and it doesn't  break anything
else and removes the circle dependency then move it.   :-)
 
> Case 2:
>   controls <-> dialogs
>     Why does controls depend on dialogs?

You got me there. I'm not sure why. The comment that it is needed for
SetVisible doesn't make sense. Try removing it form the uses clause and
see what happens.
 
> Case 3:
>   forms.pp <-> controls.pp
>     Delphi has the same problem. The LCL should be
>     very similar to the VCL, but of course we don't
>     want to copy the problems, do we?

Well this is were we tend to get into various arguements. How closely do
we match the VCL and it's layout. The idea was to match the unit layout
as close as possible so that very little needed to change in uses
clauses in current Delphi code. You know easier porting type stuff. Is
that a big factor to me. No. So maybe we should combine the controls and
forms units into just the controls unit with a dummy forms unit that
doesn't do anything but make code compatible.

Other comments.

-- 
==== Programming my first best destiny! ====

Michael A. Hess      Miracle Concepts, Inc.
mhess at miraclec.com   http://www.miraclec.com






More information about the Lazarus mailing list