From: Corey Date: 2004-11-12T05:04:59+09:00 Subject: Re: ruby idiom for attribute definition? On Thursday 11 November 2004 12:46 pm, Dave Thomas wrote: > On Nov 11, 2004, at 13:29, James Edward Gray II wrote: > > For what it's worth, I think the Struct is better OO design. I'm > > firmly in the "Ask for help, not information." camp of OO programmers, > > so I try to avoid "getters/setters" whenever possible. > > And from the perspective a new ruby user, I'm in the "ask for help _and_ information" camp - so these explanations are really beneficial, thanks! > > A Struct on the other hand is just a record holder to my mind, so I > > have much less problem with using it in a case like this. > > Exactly - that's what made me suggest it. A class with a large number > of attr_accessors is not really an encapsulated class, so it felt to me > that a Struct would be more appropriate. > > I almost suggested using a Hash... :) > Heh - I actualy started off with a Hash, but I thought that was just my old perl habits trying break through... I'm in the midst of writing another question, which looks to be related to all this - ( perhaps I should be using a struct or hash after all ) - hopefully you guys can point me in the right direction. -- "To a mind that is still, the whole universe surrenders." - Chuang Tzu