From: John Lam Date: 2006-05-04T14:02:49+09:00 Subject: Re: Ruby idiom for attributes / properties ------=_Part_74316_20083937.1146718965775 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 5/4/06, James Britt wrote: > > What would you consider to be an attribute? I'm just borrowing the ActiveRecord terminology for attributes. In my mind, an attribute =3D=3D a property. In .NET, a property is a bit of syntactical sugar (but also a distinct metadata entity) for a getter and setter method. Consider this bit of C# code: class Foo { public string StringProperty { get { return "string"; } set { Console.WriteLine("setting a string to " + value); } } } This generates under the covers a get_StringProperty and a set_StringProperty method. I would consider it equivalent to this Ruby code: class Foo def string_property 'string' end def string_property=3D(value) puts "setting a string to #{value}" end end The problem is that I can't distinguish a string_property method from any other method. In .NET, I can walk the property metadata to discover all of those properties (and those are things that can be bound to data-aware controls in the framework). ------=_Part_74316_20083937.1146718965775--