[Lazarus] Challenge of converting a Delphi project
Samuel Herzog
sam_herzog at yahoo.com
Wed May 5 13:26:19 CEST 2010
Ok, I don't want to argument about formating.
But did you see that the call to FindManagedControl(found); is useless ?
________________________________
Von: Juha Manninen <juha.manninen at phnet.fi>
An: Lazarus mailing list <lazarus at lists.lazarus.freepascal.org>
Gesendet: Mittwoch, den 5. Mai 2010, 13:34:09 Uhr
Betreff: Re: [Lazarus] Challenge of converting a Delphi project
Samuel Herzog wrote:
> They way I format the my source-code and and ess-model is a good example why
such things are important
>
> Original:
> ******
> procedure TessConnectPanel.DblClick;
> var
> found: TControl;
> begin
> inherited;
> found := FindLCLWindow(Mouse.CursorPos);
> if Assigned(found) then
> begin
> FindManagedControl(found);
> if found <> Self then
> TCrackControl(found).DblClick;
> end;
> end;
>
> The same with my formating-style:
> **************************
> procedure TessConnectPanel.DblClick;
> var
> found: TControl;
> begin
> inherited;
> found := FindLCLWindow(Mouse.CursorPos);
> if not Assigned(found) then exit;
> FindManagedControl(found);
> if found = Self then exit;
> TCrackControl(found).DblClick;
> end;
>
> Much better to read, and you see at once, that "FindManagedControl" looks
strange!
>
> There is only one rule that applies for all programmer's! We read source-
code from top-down.
> That's why I try to avoid "else"-statements.
Thanks, I took out the useless FindManagedControl call. It was already in the
original EssModel code.
I must say I like the original indented formatting more.
Indentation carries information by itself. Your formatting loses that
information. ... and there was no "else"-statements.
Anyway, it is a minor thing.
Regards,
Juha
--
_______________________________________________
Lazarus mailing list
Lazarus at lists.lazarus.freepascal.org
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20100505/c69a7e14/attachment-0004.html>
More information about the Lazarus
mailing list