[Lazarus] Circular references and code quality

Juha Manninen juha.manninen62 at gmail.com
Tue Oct 4 18:11:42 CEST 2011


2011/10/4 Mattias Gaertner <nc-gaertnma at netcologne.de>

>    OP has one big feature: type safety. In a language like javascript you
> don't need typecasts, but the drawback is that it is much more complicated
> to find a bug and to extend existing code, because you don't know what a
> change effects. It's one of the reasons why you can write one order of
> magnitude bigger projects in OP than in javascript.
>
> So, the typecasts are ugly, but they have an advantage.
>

No Mattias, this problem is not caused by type safety. It is caused by
forbidden circular references.
Better comparisons are Java and the .NET languages C# and VB.NET, or even
C++ (which has otherwise messy syntax).
In those languages you can refer to other classes as you like.
One could argue that it allows more sloppy class design but in reality it
IMPROVES the code.
No type-casts or interfaces just to get rid of circular references are
needed, or any other such tricks.

True, the dynamic, weakly typed languages are not suitable for big
applications but that is a whole different issue.


That being said:
>
> What duplicated method do you want to combine into one?
>

All of them :)
I can send a list later, now I am at school in a C++ course.

Regards,
Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20111004/182f24f7/attachment-0003.html>


More information about the Lazarus mailing list