From: Uwe Kubosch Date: 2006-04-19T22:44:29+09:00 Subject: Organizing Ruby code Hi all! I have now completed two web projects using Ruby On Rails in The Real World and I am very happy about it. Woohoo to me! In RoR all the components have been assigned a location in the project tree and I find this very helpful. I am looking for conventions for how to organize business logic that does not fit easily into the model-view-controller categories. I guess this is code that goes into the "lib" directory, and it should be organized like any Ruby code. The problem is, I have not found any conventions for how to organize regular Ruby code. In Java I am forced to have one class per file, the file must be called the same as the class, and the file should be placed in a directory with the same name as the package of the class. These limitations are of enormous help since it makes finding everything very easy. Is there something similar for Ruby code? Should I use modules where I use packages in Java? Is there a relationship between module names and file location? How many classes per file? How many modules per file? Any tips on how to organize Ruby code is appreciated. I am looking for a common convention, so that if I follow it, the next Ruby programmer that comes into the project immediately knows where to find all the components. Recommendations for books and websites are always welcome, and so are any other good sources for information. On the Ruby/Rails topic I have read the Pickaxe book, Ruby in a Nutshell, and Agile Programming In Ruby On Rails. Any comments on this are appreciated. Uwe Kubosch