[Lazarus] When do I need a component rather than a plain object?
Frank Church
vfclists at gmail.com
Tue Nov 16 20:54:39 CET 2010
On 16 November 2010 10:32, Michael Van Canneyt <michael at freepascal.org>wrote:
>
>
> On Tue, 16 Nov 2010, Frank Church wrote:
>
>
>>
>> I realized the wisdom of Bo's approach to creating components at run-time
>> and setting the properties in code only 2 days go.
>>
>> I overwrote some of my newer code with older code, and although I restored
>> the *.pas from git, I forgot about the*.lfm where the SQL was stored. It
>> was
>> only hours later that I realized the the update code was in the components
>> that I restored it.
>>
>> Initialzing non-visual components from form properties is an evil which is
>> best avoided.
>>
>
> I think your mileage may vary. I work with lots of custom components in
> Delphi and Lazarus (in fact, I never use the 'standard' ones, always
> descendants or third-party components, installed in the IDE). In 12 years,
> I never experienced any of the problems you describe.
> Not in Lazarus, not in Delphi.
>
> So I cannot say that my experience supports your conclusion.
>
>
> It will be good if Lazarus can generate the source code to initialize
>> components at the start of a program, rather than stream them in,
>> hopefully
>> in a future version. It makes revision control much easier, a lot more
>> transparent.
>>
>
> I am all for such a feature (to each his own, after all), but I don't think
> it solves any real problems. You admitted you made a mistake in your VCS,
> but you blame the lazarus way of doing for it. This is definitely not
> logical to me.
>
> Michael.
>
>
>
I am not blaming Lazarus as such, as Delphi does the same, but when I do a
diff of a .lfm file it is obvious to me that things would be much clearer
from source code generated at runtime, rather than looking at the properties
text in source. Runtime source code can also be formatted properly or even
have an order of generation so stuff don't get move around much. It can even
be generated in separate files, or as Graeme said in some private section of
the file.
Eg. when you move components around sometimes for the sake of accessing
other components properties to change them, it creates a lot of noise in the
diffs, as positions in most cases are irrelevant to a lot of components.
Setting properties in code is fine, and some design IDE component can be
used to generate the source code to initialize them at runtime.
To be honest it is something I noticed some time ago, but never realized how
hard it could hit if you made some error or forgot about something.
Perhaps Graeme will permit the inclusion of that kind of facility into
Lazarus in some future version, and component designers can include it in
their component design.
--
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>
--
Frank Church
=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20101116/429f41b0/attachment-0003.html>
More information about the Lazarus
mailing list