Re: Property or get/set methods ?
From: David Browne (meat_at_hotmail.com)
Date: 12/14/04
- Next message: SlasherStanley: "Resize Images"
- Previous message: Bruce Wood: "Re: fastest way to parse a file; Most efficient way to store the data?"
- In reply to: Rachel Suddeth: "Re: Property or get/set methods ?"
- Next in thread: Mike Newton: "Re: Property or get/set methods ?"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 14 Dec 2004 16:48:43 -0600
"Rachel Suddeth" <rachel@bldhound.com> wrote in message
news:uGPhtbh4EHA.1524@TK2MSFTNGP09.phx.gbl...
> Also, if you have a case where you want to be able to set, but not get,
> then personally I think a write-only property is weird and confusing, and
> I would make that a set method.
>
Agree on both. Properties should only be used as a replacement for a
getter, or a getter/setter pair, where the methods are:
-Not resource intensive
-The getter does not change the state of the object in any visible way
-The setter does not change the visible state of the object, except for the
value returned by the getter.
I don't like properties at all where you have to set PropertyX before you
can run MethodY. This should be a constructor argument or an argument to
MethodY.
David
- Next message: SlasherStanley: "Resize Images"
- Previous message: Bruce Wood: "Re: fastest way to parse a file; Most efficient way to store the data?"
- In reply to: Rachel Suddeth: "Re: Property or get/set methods ?"
- Next in thread: Mike Newton: "Re: Property or get/set methods ?"
- Messages sorted by: [ date ] [ thread ]