Re: [Vala] [Genie] Object members
- From: Patrick Castle <lemeia bigpond com>
- To: jamie mccrack gmail com
- Cc: vala-list gnome org
- Subject: Re: [Vala] [Genie] Object members
- Date: Thu, 29 Oct 2009 03:24:29 +1100
Jamie McCracken wrote:
Hmmm - maybe I'm just not understanding then. To me properties would be
a way of implementing the idea of information hiding or encapsulation -
so that I create an interface separated from the implementation. I'm
actually guessing that this is exactly what I could use properties for
as it fits with the idea (in my mind anyway). And in this way, I would
probably make the decision to make fields private and properties public.
On Thu, 2009-10-29 at 01:50 +1100, Patrick Castle wrote:
Thanks for that. I looked back at the Genie page and did a bit of Googling. I think I understand the
distinction between field and property. It would seem from a good practice point of view that fields would
generally be private and properties would generally be public. Would that be a reasonable way to explain it?
If so - I understand where I would want to use one or the other.
You would use a property mainly for design time setting as they can be
introspected (EG think glade and setting properties on a widget when
designing) or if you needed explicit getter/setter methods or the
ability to override them.
Fields by comparison are for runtime usage only and cannot be
introspected nor can they have get/set methods or be readonly or
Am I at least right that this would be a valid use of properties?
I'm struggling a little with the introspection idea. I'll have to mull
that over a bit and perhaps do a bit more reading.
] [Thread Prev