[Lazarus] Circular references and code quality

Thierry Coq tcoq at free.fr
Tue Oct 4 17:51:45 CEST 2011


Hello,
Avoiding circular references is of particular importance for big 
projects. I don't understand your rant here. Several years back, when I 
was making professional software in Delphi, I noted two things:
- big projects in Delphi tended to be smaller than equivalent big 
projects in other languages (C++, Java)
- big projects in Delphi benefited much from the (very fast) compilation 
times of Delphi, itself resulting in part from the prevention of 
circular references.

Typical big project = 1M+ lines of code.

When I measure quality these days in C++ or Java programs, I find a 
<lot> of copy/paste, big classes, and many, many circular references, so 
allowing circular references obviously doesn't solve the problems 
mentioned here.

I noticed you haven't mentioned three other possible means of reducing 
copy/paste and sharing code:
- events
- notification/publication,
- generics.

Your comment about having difficulty to read "big units" is valid, of 
course, if the unit holds diverse classes with poor cohesion between 
them. But if the classes need to work together closely, as implied by 
the need for circular references, then it improves readability that they 
are close together in the same unit.

Looking at another language: Ada also prevents circular references 
between packages, with quite some success in its intended area.  
Admittedly, the latest versions of the language do provide very 
interesting capabilities for adding new features to an existing package, 
without recompiling/changing anything in the original package. Maybe 
these sort of features in pascal could help you, while keeping the 
safety net of the pascal language.

Best regards,
Thierry

On 04/10/2011 16:40, Marcos Douglas wrote:
> 2011/10/4 Juha Manninen<juha.manninen62 at gmail.com>:
>> Hi
>> There is lots of duplicate code and data definitions between Lazarus
>> TProject and TLazPackage (and their ancestors).
>>
...




More information about the Lazarus mailing list