From: Jeremy Whetzel Date: 2003-08-22T13:16:23+09:00 Subject: Re: One Module for one Class? On Thu, 21 Aug 2003 13:48:58 +0900 "Brett H. Williams" wrote: > On Aug 21, Jeremy Whetzel wrote: > > > For example, if I have an object that represents > > a software tarball, and that object has a number of attributes such > > as dependancies, reverse dependancies, comments, versions, etc, and > > then I have all the methods that go with it for fetching, > > configuring, building, resolving dependancies, etc, would it make > > more sense to keep all those methods out of the class or leave them > > in the class, even though it would make that class huge? > My personal sense would be to represent some of these 'attributes' as > members of their own class, i.e. have a Dependency class which you use > through composition. Your 'Tarball' class would then have a container > of'Dependency' objects (and so forth for other things which have a > logical grouping). I had thought of that, but I believe I chose poor wording in saying a "tarball object". I was thinking more specifically of having a"port" class that has all those different attributes. The thing with making the dependancies a seperate class is that they can also have dependancies. Essentially they're all ports requiring ports requiring ports. They're all kind of the same object. > My personal taste suggests you should not make a module which can't > usefully be mixed in to any other class than the one you have in mind. Understood, and I feel the same way. To me it just seemed kind of awkward, although so did having a huge class with loads of methods... > You can even have several files, which all contain method definitions > for the one class, grouped by what they do :-P In some ways I like > that better than a bunch of mixins. I like this idea, too. Perhaps I'll give it a shot. > OT: Isn't the biggest complaint right now about Gentoo's portage > speed? It's written in Python, but I think you might run into the same > problem with a similar implementation written in Ruby. This may be. I hadn't actually used Gentoo's portage system in quite a while. I've been unable to get the darn thing to build on my system. =0p But when I used it 6+ months ago, the speed of portage itself seemed fine, especially comparing it to the time to download and build stuff. *g* I'm just mainly doing this as a learning experience and for benefit of myself while using FreeBSD. Thanks, Jeremy