开发者

Groovy/Grails :: Ruby/Rails :: 2011 State of the framework

Yes, several similar threads exist, but we're now in 2011, and much has changed.

Grails 1.3.6 has improved hugely compared to v1.3 when I initially tried to learn the framework (and gave up to slow compile times and other groan inducing events).

Having spent a couple months with the latest release, I am impressed, protyping an app is an absolute breeze (GORM is great!). In development mode one no longer needs to restart, barring changes to domain classes. Groovy.lang is fantastic (bare in mind, this is compared to my day job life in PHP).

Now, on the flip side there is Ruby/Rails, which I have little experience with beyond perusing Ruby docs and exploring Active Record (to compare to GORM). Coming from PHP/Jquery, groovy syntax is cake, ruby not so much, although accessible.

Ruby/Rails is all the rage, while Groovy/Grails seems to be picking up speed in its own right.

I'd like to hear what both camps have to say (flame inducing lang war welcome) re: pros/cons of both langs/frameworks now in 2011. When choosing a fra开发者_如何学Gomework it's important to know what you're getting into, so have at it, newbies will benefit, and experts can vent ;--)


Rails and Grails are both excellent frameworks with their current releases. You really can't go wrong with either. Here are some things I find interesting about them though:

Rails

  • Rails (Ruby) does not scale as well as Grails (Groovy). You will need more horsepower to run your application. This isn't a big deal at all with PaaS options like EngineYard (and hopefully a AWS BeanStalk Rails option in the future), but it might just cost a little more to run a Rails app vs a Grails app (obviously JRuby is also an option to though).
  • Rails is slightly better with NoSQL alternatives currently, but Grails is catching up quickly
  • Rails has many more plugins, but this can lead to trouble if you use some that aren't maintained (a lot of them don't currently work with Rails 3 yet either).
  • Rails is more mature and has more features at this point in time because it's been around longer
  • Rails REST support is amazing
  • There are many more "big" Rails websites than Grails
  • Ruby is much more popular than Groovy - TIOBE
  • No dependence on Oracle, ha! (Grails obviously needs the JVM)

Grails

  • Grails integrates with the JVM better than JRuby
  • Grails GORM is better than ActiveRecord (IMHO), although Rails 3 opened the door a little bit for other persistence options, but all the books, tutorials, etc all use ActiveRecord
  • Grails View taglibs are better than <=%...%> in view
  • Grails plugins are well documented and clearly state whether they are supported by SpringSource or not
  • SpringSource is investing heavily in Grails
  • There will be many more corporate jobs for Grails than Rails in the future, but more startups use Rails (where do you want to work?)

My perspective

  • I used Rails a couple years ago, I'm working on a Grails project now
  • I like them both better than Django (Python) or Zend Framework (PHP)
  • I plan to learn Lift (Scala) next

My Recommendation

  • If you have never done Java development and are working on a side project for a small to medium website, go with Rails
  • If you are working at a big company that uses Java, try pitching Grails to your management as the "next Java framework" they should invest in
  • If you are working on "the next twitter or foursquare," well then you are smart enough to answer this question yourself! :)


First time I begun a project with Rails I was really surprised:

  • How can I separate "repository" from "Service"? Oh my God: I have to put business logic on controllers... I can't imagine a real big project with Ruby on Rails: Is there Someone on 37signals remembering the basics of separating Business and Domain/Repository. The Rails folders/classes structure doesn't take care about this.

  • Second sock: "Active Record". Try to design a real complex Object Oriented Business layer and map it using the Rails Models (Active Record)... really: don't.

  • 6 months later, with our project running: R&R is consuming 80% CPU (and memory...) using apache + passanger on a quad core server... and the Postgresql Database is in holidays (3-4% of CPU)... Oh my god (newly)

    My old ASP/VB6 applications where capable of serve pages to 300 concurrent users in a real backoffice context with real complex databases and complex business installed on a standalone machine (a year 2001 1 CPU core server).

Of course, conventions and Ruby syntax are lovely... and no one needs a compiler (well... unit tests are used for this porpouses 90% of the time... just for solving the dissapeared typing each time I change some code... "Please, programming god, take care about my fingers mistakes" )

First impession with Grails:

  • A "Cool" stack inspired on Rails with professional power based on Spring framework (IoC, Hibernate, ...)

And YES!!!

  • There is a clean Domain/Service separation. NICE!!!
  • You can, eventually, forget Java.


Rails is fairly mature, has a HUGE ecosystem to go with it. I'm not familiar with Grails or it's support online, but the red flag I see in your post is that you've admitted Grails is playing catch up to Rails.

Ruby is an absolute joy to work with (and this coming from an old C++ hack... why, back in the day I used to program with just a hex keypad, young whippersnapper... now GET OFF MY LAWN!).

There are things about ruby that make it hard to follow at times (method_missing I'm looking at YOU) but I'm sure that can be said about any language.

Me? I'd go with ruby and rails.


Well for grails, i still think that even catching up, it has 2 main things that rails won't have in a easy way:

  • scaling up
  • tons of mature java libraries at your fingertips (personally geotools among others)


Ruby on Rails is outstanding - like the Pink Floyd of web dev.

Groovy on Grails is a decent copy of it - kind of like the Australian Pink Floyd show...

BTW - We have both at work - and I have seen many Grails developers eventually learn Rails and stick with it.

I have also seen Rails developers learn Grails, but NONE of them have preferred it.

About half of the time, our Java developers learn Grails and simply stay away from Ruby.

IMHO - If you truly know both fairly well, you will almost always prefer Ruby and Rails.


You also have to consider your IDE. When I started out with rails, it was quite painful. Rubymine was super slow and crashing, everyone I know were using textmate. Grails has STS (eclipse based) and gives you all the features you need.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜