[Lazarus] OOP basics - 2

Florian Klaempfl florian at freepascal.org
Thu Apr 15 10:29:57 CEST 2010


Juha Manninen schrieb:
>> I agree with Michael here. "Put everything in one big file" is a pure
> evil,
> 
>> equivalent to "I do not want to think about proper design, let's just
> 
>> pile all the code in one big heap"
> 
> I don't know what is wrong with you guys. SW design can be good even if
> it has interdependent classes. It depends on the original problem scope.
> 
> This is from Michael's other mail:
> 
>> If that is really the case they should be in the same unit, and the
> 
>> problem is moot.
> 
>>
> 
>> It's not for nothing that TCollection and TCollectionItem are in the
> 
>> same unit.
> 
> Right, so the original comment
> 
> "In more than 20 years of pascal programming, I never encountered this
> problem."
> 
> actually means to copy everything into one file.

Yes, this is what is done in C++ basically as well. Even worse, C/C++
pulls in this big file (aka header mess) in every compilation unit again
and again. You can also split your pascal code in several include files
as in C/C++ and claim that you don't use one big file.

> 
> That's what I was saying, too! :-)
> 
> If I understand right, Michael and Mattias have made big parts of
> Lazarus core which I referred to. They have used types casting to avoid
> circular references. Now they say they never encountered this problem.
> 
> It is like:
> 
> "We never encountered a problem. We just typecast everything! Hey no
> problem!"

In the TCollection and TCollectionItem case typecasting is always required.




More information about the Lazarus mailing list