I am a .NET developer and I just had the chance to play with Ruby on Rails this weekend.

In .NET we separate layers of the application by creating separate class library projects. From the design pattern standpoint, do we have to do that in Rails too or is it just one whole project with everything in it?

  • 1
    +1, I can find loads of coding tutorials but there isn't anything on "how do I manage the layout of this semi complex project" that I can find for most languages. Mar 5, 2013 at 21:12
  • I haven't read the Pragmatic Press' Ruby book, but if it's anything like Erlang, they do a good job at teaching you not just the syntax of the language but also the idioms. Perhaps someone else can comment on that. Mar 5, 2013 at 21:19

1 Answer 1


You'll find that Rails apps start as single repos. The more successful ones (Twitter, Square, many others) split into multiple codebases as they grow into that requirement. Those additional codebases can be daemons, services, gems, Rails Engines, or something else.

This refactoring into multiple projects isn't done until it proves necessary, because YAGNI. Bifurcating your project on day 1 slows prototyping time, and prototyping speed is a key strength of Ruby and of Rails. You'll want to keep in mind that creating or a class in Ruby costs almost nothing, as does breaking apart a well-desined class. Your pure Ruby code will live mostly under /app/ (app/models, app/views app/controllers, app/helpers) and /lib/. Your static assets, layered JS/Coffee includes, and CSS/Sass/etc includes are going to be in /app/assets.

Understanding why breaking apart a Ruby class is so easy requires a bit of reading on duck typing and the understanding that Ruby's interfaces aren't as ironclad as you might be used to in a less dynamic environment.

Here are a few links that might interest you:

Good luck with your projects!


Not the answer you're looking for? Browse other questions tagged or ask your own question.