[Lazarus] Circular references and code quality

Jürgen Hestermann juergen.hestermann at gmx.de
Tue Oct 4 17:41:53 CEST 2011


 > In other words: It's nicer to work with ten 3000 lines units than 
with one big 30.000 lines unit.

Why that? I would prefer the one unit including everything over having 
multiple files (i.e. when searching for something). If it has no other 
impact than I would always vote for having lesser files instead of 
cluttering all into many files.



 > 2. classes were split instead of using parameterization. Instead of 
adding a parameter to many methods, an abstract class and multiple 
descendants are defined. This almost always duplicates code, but the 
code itself has far less if-then-else blocks. OTOH it can create more 
if-then-else outside the split classes.

Code is much more readable (understandable) when if-then-else blocks and 
no OP-methods (like descendants) are used. You see all relevant code in 
one block and there is no need to gather it from multiple places.



 > 3. information hiding. A class is split into the public part and the 
private part. Because the public part is used by third parties it must 
be carved in stone and therefore you must be very careful what to put there.

True. But there must be also a way to evolve in time so it *must* be 
possible to change things. Of course, the less it's needed the better.







More information about the Lazarus mailing list