[megido-general] [lazarus] Portable lib

Nicolas Aragon nico at clubdelphi.com
Thu Apr 29 18:20:13 EDT 1999


Hello,

>Why not just join Lazarus and place in the conditional defines for the win32
>stuff.

I just talked about Win32 as an example. There are more advantages. 

First: if design is right, you don't have to touch the code in one
part to correct or inprove the others. I know it doesn't sound too
impressive as of now, but I hope a first sample would show it clearly.

Second: if you later add support for Xlib, text mode (both could be
useful for installations programs), another OS'es... you will have a
code full of defines and, what's worse, you could have managed some
feature with an eye put on implementation, and it won't be so easily
maintenable. If you keep the separation between classes, it's much
more difficult to fall in such distractions. It's like the lines in
the roadway when you must adjust to an interface definition. 

Just an example: our other thread about boxes, panels, memos and
scrollbars. If you'd just want to follow the gtk way of doing things,
you should use typical gtk boxes like most other gtk programs. But you
don't. Why? because you want to keep as possible the way Delphi treats
controls positioning. At some point, when a difficult problem arises,
you'd probably feel the temptation to change some behaviour and code
relying on this behaviour would be difficult to translate, if possible
at all.

Third: it's clear that, this way, you don't have to recompile like
you'd have to do with defines. But you could even change the
underlying lib without re-linking. A program could check which library
is available at run-time and dynamically link to it. The IDE itself
could manage a number of different libraries. 

Yes, it seems toooo far from the present, when we don't have one :-)
But if it isn't done now, it will be very difficult to do it later.

I finally bought Gamma's book and, looking for bridge pattern, I found
this in the first page:

"Consider the implementation of a portable Window abstraction in a
user interface toolkit..."

Not bad example :)

>We would be more than happy to work with you!

I will like to join efforts, I think you are doing a fine job... who
said "show me the code"? :-)

But just because this, I will like to finish a complete example of
what I say. Then you could judge if it's acceptable to you. I don't
want just to say "this is the right thing to do (C)", and less to you
that have working code. If I propose an alternative, I want it to be
ready to compile and offer to change actual code seamlessly.

The problem I've found now it's about passing method references as
parameters. I think Michael is checking it now. In the meantime I'll
try to familiarize with your code. Hope you will slow down or I will
be unable!! :)

>I understand your position on a cross platform tool ;)

Mine is clear ;)

greetings

  Nico






More information about the Lazarus mailing list