[Lazarus] Best practices on using classes for subroutine libraries

Hans-Peter Diettrich DrDiettrich1 at aol.com
Tue Apr 10 12:28:02 CEST 2012


Frank Church schrieb:
> When I need a variation in procedures (standalone, not a class or
> object procedure) I use across my applications, I often find it more
> convenient to create a copy the unit into the project folder and make
> the changes there. Sometimes they get merged back into the shared unit
> or not at all.

I use conditional compilation for such variations. Typically only for 
one new implementation, that can be turned on and off for testing 
purposes. The $DEFINEs are set and documented near the top of the unit, 
as an overview of available options.

> I am thinking now of using classes with procedures, without any data
> in them, so that I subclass them in the projects where I need to
> change them.

That's another useful solution.

DoDi





More information about the Lazarus mailing list