> [EMAIL PROTECTED] wrote:
> Sent: 17 decembrie 2007 12:59
> To: [email protected]
> Subject: Avoiding form loops?
> 
> I have taken over some of my colleagues applications, as he has left.
> Unfortunately, he and I obviously have not had the same ideas about
> writing code.
> 
> I have found lots of procedures in sub-units that access components,
> procedures and variables on/in the main form/unit directly.
> 
> So far all that has been removed by moving the variables and
> procedures to either the unit in question or a new unit, Global.pas,
> used by all others.
> Instead of accessing components directly, I now send messages to the
> main form, and let that handle whatever was supposed to happen.
> Also in one case, where two sub-units were talking to each others
> form.
> 
> At least compile time has now been reduced by something like a factor
> of 5.
> 
> But is the above 'structure' the propper way of doing it ?
> Are there other ways, that are more efficient at run-time ?
> 
> Only one thread is in use, but loads of timer events etc.

There's a syndrome amongst programmers, making us think all code is bad
and needs rewriting, including our own code, including the code we wrote
5 minutes ago :-) In my opinion, if the code works, don't change it.
There's a good chance you'll ether spend a lot of time testing OR you'll
end up explaining to end-users how function X no longer works because
the code that implemented that was a mess and it got lost in
translation. You might be better off keeping the application as it is
and changing bits only when that's absolutely required. This will
certainly be hard at first but I'm 100% sure it would be harder to
re-structure the whole application at once.

Do a google search for "never rewrite working code" and you'll see the
same thing said by smarter people :-)

--
Cosmin Prund

_______________________________________________
Delphi mailing list -> [email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to