Re: Global Variable - as string vs object vs record ?
From: Jeremy Collins (jd.collins_at_ntlworld-not.com)
Date: 01/22/04
- Next message: Dieter: "High(Array)"
- Previous message: Lauchlan M: "Re: Global Variable - as string vs object vs record ?"
- In reply to: Lauchlan M: "Global Variable - as string vs object vs record ?"
- Next in thread: Lauchlan M: "Re: Global Variable - as string vs object vs record ?"
- Reply: Lauchlan M: "Re: Global Variable - as string vs object vs record ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 22 Jan 2004 13:25:55 +0000
Lauchlan M wrote:
> (ii) as an object that gets created in the main form's startup, eg
It's largely a matter of personal taste (preference for OO),
and the needs at hand.
What is "X" for? What does it interact with? As the application
grows, do you see a need to add further functionality specific
to "X"? Do you want to "protect" X from being modified in an
invalid way? Do you want to save X's value to the registy etc etc.
FWIW, none of my applications have global variables, just objects
and a file full of consts.
If it doesn't warrant on object of its own, you could consider making X
a property of the main form with "read" and "write" accessors.
TForm1 = class(TForm)
private
FX : string;
procedure SetX(const Value : string);
public
property X : read FX write SetX;
end;
-- jc Remove the -not from email
- Next message: Dieter: "High(Array)"
- Previous message: Lauchlan M: "Re: Global Variable - as string vs object vs record ?"
- In reply to: Lauchlan M: "Global Variable - as string vs object vs record ?"
- Next in thread: Lauchlan M: "Re: Global Variable - as string vs object vs record ?"
- Reply: Lauchlan M: "Re: Global Variable - as string vs object vs record ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|