[fpc-devel] "Friend" classes?

DrDiettrich drdiettrich at compuserve.de
Tue Mar 22 10:00:09 CET 2005

Micha Nelissen wrote:

> The real question is: was the design of the code ok ?

Some dependencies cannot be removed by a redesign :-(

In some cases interfaces instead of classes can help, because they don't
need implementation in the same unit. But then the classes have to be
implemented as well.

IMO it's important to keep classes encapsulated in distinct units, so
that no unintended interaction (use of private/protected members of
other classes...) can occur, as is possible in a single unit.

> Circular references makes code harder to understand.
> Layers are easier to understand.

I see no problem in understanding here? When two objects refer to each
other, but the objects are not otherwise functionally related, they can
be understood without knowing about the other one. It also should be
possible to implement all these objects seaparately.


More information about the fpc-devel mailing list