From: Alan Chen Date: 2002-05-01T04:13:06+09:00 Subject: Re: Source File/Class relationship - the Ruby way On Tue, Apr 30, 2002 at 10:38:10PM +0900, Volkmann, Mark wrote: > I imagine this has been discussed in the past on this mailing list, but I'd > appreciate a brief explanation of why it's good to define multiple classes > in a single source file. Using grep to find classes seems very tedious. There's nothing preventing you from putting one class per file in your code. I know many C++ projects that do just that -- a few ruby projects too. If you have a lot of small classes, sometimes it makes more sense to group all the classes in one module and call the file .rb. Other times, ruby is employed in single file scripts (with multiple classes). Forcing the standard of one class per file would be very annoying for these uses. Have you looked at rdoc? It will let you jump to code definitions via a browser (in additon to extracting and assembling inline documentation) Or if you use emacs, you can use tags to jump to the definition of classes. (Vi too, I'm sure). Heck, if it really bothers you that much, you could write a utility to parse through ruby code and rewrite it into a new standardized tree of your preferred convention. The rdoc utility I mentioned earlier might be a good place to start - as it has code to do ruby code parsing too. -- alan -- Alan Chen Digikata LLC http://digikata.com