Ok, I don't want to argument about formating.
But did you see that the call to FindManagedControl(found); is useless ?





________________________________
Von: Juha Manninen <[email protected]>
An: Lazarus mailing list <[email protected]>
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
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to