Recent

Author Topic: Circular references in one unit  (Read 4628 times)

Tongadall(byGalbi)

  • Guest
Circular references in one unit
« on: November 29, 2005, 03:28:37 am »
Well, supose I have declared two classes in the same unit, let's say one inhereted from TForm and other from TFrame (or combinations) which are both visual classes. I know it's not possible to visualize them (in Lazarus nor in Delphi) because only one .xfm/.lfm could be associated to every unit, by, for example, {$R *.dfm}.

My suggestion is that, it would be great if this could be done, that is, when I want to see the forn associated to a unit, the program should take care that inside that unit, there is more than one, and, for example, it should ask which one I want to see, in a window with a list of the visual resources that can be loaded.

This would be great because, in this way, it's reduced the number of necesary units and in addition circular references between them could be created (since they are in the same unit using TSomething = class), even though this must be discussed since it could lead to a bad dessign.

Greetings and thanks.

(This is a Tongadall post translated by Galbi)(Both Argentains)

Anonymous

  • Guest
RE: Circular references in one unit
« Reply #1 on: November 29, 2005, 07:43:12 am »
Why do you want to reduce the number of units? As you said yourself putting two forms in one unit is bad design. Futhermore it makes your code less readable (and thus less maintainable) of all functionallity is put into one unit.
I even sometimes bring code for a form to other units. F.i. when I use a TNotebook with a lost of tabs, where each tab has its own functions. This makes (to my opinion) for better maintainable code.

Galbi

  • New member
  • *
  • Posts: 6
RE: Circular references in one unit
« Reply #2 on: November 29, 2005, 09:13:55 pm »
Spanish traslation of the above message:
Para que querés reducir el número de unidades? Como vos decís, poner dos formularios en una unidad, es un mal diseño. Además hace el código menos facil de leer (y por ende menos mantenible) toda la funcionalidad puesta en una unidad.
Yo a veces llevo código de un form. a otras unidades. P.ej. cuando uso un TNotebook con muchas pestañas (tabs) donde cada pestaña tiene su propia función. Esto hace (en mi opinión) un código mucho mas mantenible.

tongadall

  • Newbie
  • Posts: 2
RE: Circular references in one unit
« Reply #3 on: December 06, 2005, 09:12:29 pm »
Thanks for you. I understand now.

Thanks for the traduction too.