[Lazarus] OOP basics - 2

Jürgen Hestermann juergen.hestermann at gmx.de
Thu Apr 15 18:25:41 CEST 2010


> Yes, I also finally realized that a big source file is not necessarily a bad 
> thing. It is a question of attitude. A good editor and IDE helps browse and 
> maintain the code.
> Include files seem to be useful with FPC/Lazarus. With Delphi they are not so 
> useful.

The problem discussed here is not about OOP. It's about units (modules) and how compiler and linker use them. 

The general question is: For what reason should I split my program in units at all? The only reasons I can think of are:

1.) Modularity: You use a unit written by someone else. Then of course this code is in a separate unit. Since Turbo Pascal you can get this (compiled) unit without having the source code.

2.) Compile speed: If you have code in a separate unit which you do not change (any longer), then the compiler does not need to compile all the functions/classes within this unit on each build of the program. In the past that has been a large speed up but I am not sure whether this is still an issue on fast machines today (maybe only for very large projects).

Any other known reasons? In the past there were other limitations that forced people to split programs into units (like 64 segment barriers) but I don't know about such things today.

Include files only make sense if you include such a file in multiple source files. 





More information about the Lazarus mailing list