[Lazarus] Challenge of converting a Delphi project

Juha Manninen juha.manninen at phnet.fi
Wed May 5 14:54:46 CEST 2010


Mattias Gärtner wrote:
> Yes, the description is misleading. Original is "Verify object method  
> call validity", which is longer without being more clear.
> AFAIK it only checks class typecasts.

So it should be renamed to "Verify class typecasts" or something.

For this program the best would be to get rid of typecasts. It would need more 
designing and refactoring again.


> The code uses some dirty tricks that are doomed to fail with newer  
> Delphi versions, and even more to port to FPC and other platforms. 

Did you find other dirty tricks than the typecast trick for setting mouse 
events, and delegated interface methods?

> I think it is a bad example for testing the converter.

Yes, it was way beyond testing the converter. I thought the manual conversion 
is easier. Then I became obsessed with it because I didn't understand what is 
going on. Now I understand more or less.


>> The interfaces were used to make some kind of model-view system between the
>> model and the visual controls showing it. I replaced interfaces with
>> Listener classes. How do other Delphi / Lazarus programs do such things?
> 
> see for example tiopf.
> 
> 
>> Mattias mentioned at forum a need for a class diagram component. What kind
>> of component? Would it be integrated in Lazarus IDE?
> 
> Well, the codetools provide a lot of data. I would like to show class  
> diagrams of units, packages and projects. I need a control to show  
> graphs with hundreds (or even thousands) of nodes. Later we can add  
> editing abilities.
> The EssModel looks promising, but I have some doubts about the code quality.

Ok.
I think the design of EssModel is OK but the authors implemented it in a too 
fancy way.

About the editing abilities you mentioned. Ideally the only editing should be 
to select the classes and methods etc. you want included. Then an advanced 
layout algorithm takes care of the rest.
Otherwise you have to relocate things in the diagram every time the class 
structure changes.

In my experience code generation from a diagram doesn't work very well in 
practice. Or maybe there are people who can use it but I got my classes 
screwed up completely by using the Delphi UML tool. Then I was afraid of the 
whole tool and didn't want to touch it.

There are now reverse engineering class diagram tools (but not for OP) with 
automatic layout calculation, like UMLGraph http://www.umlgraph.org/. It uses 
an external program (Graphviz) for layouting.


Juha




More information about the Lazarus mailing list