[fpc-pascal] How to have smaller units
Hairy Pixels
genericptr at gmail.com
Sun Nov 30 17:15:58 CET 2025
On Nov 30, 2025 at 10:44:47 PM, DougC via fpc-pascal <
fpc-pascal at lists.freepascal.org> wrote:
> One good exercise is to place each class in its own unit. Do the classes
> now work well together? If not, you have not designed your hierarchy
> according to proper OOP methodology.
>
The problem I'm assuming is he wants to write access to some fields across
many classes but ONLY in the library. Users of the library should not have
write access.
This makes sense to me but it means due to the "file private" nature of the
scoping all classes must be in the same unit.
Personally I'm fine with big units. I have some that are nearly 10,000
lines but that doesn't matter because compilation times are fast and there
is a language server so you can jump to methods easily. I think OP should
just accept this and forget about putting each class in its own file, which
for me personally is harder to navigate.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20251130/0aa41b7b/attachment-0001.htm>
More information about the fpc-pascal
mailing list