From: James Britt Date: 2004-11-12T08:00:43+09:00 Subject: Re: ruby idiom for attribute definition? Corey wrote: ... > I can see the usefullness in this, thanks for the heads-up - but I > can see that if I had a lot of attributes, it would seem somewhat > awkward: > > class Thing < Struct.new (:attr1, :attr2, :attr3, :attr4, :attr5, > :attr6,:attr7, :attr8, :attr9, :attr10 ) > # do stuff > end > > Besides, I just get a weird feeling that this Struct approac is kinda > odd - to tricky or something - as I'm learning ruby, I'm trying to stick > with the most common idioms and oop practices. I suspect that "common idioms and oop practices" are very language-dependent. The use of external iterator objects are a common Java idiom, but it doesn't strike me as particularly OO. > > I guess it's just a matter of personal aesthetics? : That's part of it, but if you are new to a language, many of the idioms may strike you as aestheticly distasteful, yet are indeed quite elegant within their context. It may be better to just dive in, try doing things a Ruby Way, and see if that doesn't alter how you think about OO design and programming, rather than having particular notions about OOP direct how you use Ruby (or any other language, for that matter). James