[fpc-pascal] How to have smaller units

Sven Barth pascaldragon at googlemail.com
Sun Nov 30 00:36:07 CET 2025


Amir via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am Fr., 28.
Nov. 2025, 23:06:

> Hi,
>
>   One of the main thing bothering me while developing projects in Pascal
> is that my units are getting huge in size! The main reason is that the
> nice property that the classes could access each other private members
> if they are defined in the same unit motivates/forces me to define a lot
> of classes in the same unit. Then, all the functions/procedures
> implementation must go into the same unit. I know I can use inc file but
> I do not like it! The other option is to use "Cracker" pattern, in
> Delphi, which is fine but seems like a hack!
>

Then you simply have the wrong idea what a unit it. It is intended for code
with high cohesion, so it doesn't matter if it gets large.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20251130/85d623f2/attachment.htm>


More information about the fpc-pascal mailing list