From: Rick DeNatale Date: 2009-05-25T22:47:46+09:00 Subject: Re: Do you nest classes inside classes? On Mon, May 25, 2009 at 8:53 AM, trans wrote: > > > On May 25, 7:24 am, Andy F wrote: > >> Generally I think using nested classes for real helper classes that can conceptually only be for use with the parent class is a useful way of avoiding namespace clutter. > This is the only really good reason I've found for doing so. I can't agree with that, the value of namespaces is orthogonal to ideas like 'private' classes, in fact, I think it's more valuable when the names are intended to be used outside of the implementation of a class, it helps whenever two things end up competing for a name. For example in my new icalendar gem, I use nested name spacing so that I can have an Event class, and a using application can have it's own Event class(es), maybe one might be a database model. I've seen, and been involved with too many languages which suffered from the lack of Namespaces, sometimes adding them in later versions of the language, not to appreciate the value. It really isn't an issue of containing a class within a class, it's an issue of containing names within name spaces. And I do other things like putting a module which I've used to refactor a large class into separate files inside the namespace of the (main or only) class which includes it. http://github.com/rubyredrick/ri_cal/tree/master -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale