From: chad fowler Date: 2001-01-02T00:56:30+09:00 Subject: [ruby-talk:8462] design question In the Java world, I tend to encapsulate Java's supplied libraries/types by composing things like collections inside my own domain objects. So, for example, to create a collection ("People") or "Person" objects, I would create a "People" class with a limited interface that delegated any requests for members of the list to an internal representation which I could vary at a later time (like an ArrayList or something like that). The problems I'm trying to solve by doing that in Java are: 1) I don't want to expose an explicit type which is not under my control as part of an externally visible interface, 2) I want to be able to vary the internal representation at any time, 3) I want to take care of type casting--mine is a colleciton of "Person"s, not "Object"s 4) I want my intent to be as clear as possible (users of my classes won't have to think "What is this array for?"). So, my question is: What are the recommended practices in Ruby? Do folks generally inherit the supplied Ruby classes or do they try to use delegation in the same way I've outlined above? It seems that a lot of my reasons for using composition/delegation are somewhat irrelevant in Ruby, but it still feels really weird to extend an Array to create a domain-specific list. Thanks, Chad __________________________________________________ Do You Yahoo!? Yahoo! Photos - Share your holiday photos online! http://photos.yahoo.com/