I have some experience with asp.net. When the business logic gets complicated, you want to keep the repositories and other business class separated from the main ui project. You don’t want to change the ui project if you need to change the business logic.
In .net I would create a library project and push the business logic in there, this way I can change the library without affecting the ui project.
Where should I put my business logic? If I keep it with my models, it seems to get very messy very fast because there are a lot of classes.
How do you structure rails application that require many classes with business logic ?
The common wisdom when developing rails application is to put classes and modules that are not directly related to the views, models or controllers in the
libdirectory.Note that rails 3 doesn’t autoload it by default, you will have to put the following in
config/application.rb:Creating a gem could be another option if you want to share your business logic between multiple apps, but it is more involved than simply putting everything into
lib.This answer would be a good start if you’d like to know more about that.