• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why should I choose Ruby?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well,I've learned and used Java for about 2 years.And now Ruby is very popular.Many people say Ruby on Rails can quickly develop a web application.
But Ruby is very different from Java.And Groovy on Grails can also quickly develop a web application.
So I want to know ,Should I choose Ruby?Dose it better than GOG?
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To add to what Ivan has asked, if I am already proficient in Java, and Groovy enables me to retain the Java skills that I have already learned, why would I want to learn Ruby? What are the unique features of Ruby that would make it worth learning?

In addition, each language tends to require a certain way of thinking about a problem. One aspect of learning a new language is retraining oneself to think in that way. This is usually a good thing because it expands the ways that one can look at problems, thus make one a better developer or designer. What are the unique ways about thinking in Ruby that would add to a developer's body of knowledge?
 
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Think Different. Some examples:

Try/Rescue in place of if/then/else
||= (evaluates the right hand side if the left hand side is nil)
Ducktyping and Metaprogramming
Everything is an object. 1 is an object. So is false. So is nil.

DSL (domain specific languages) are big in dynamic languages like Ruby.
The Rails framework makes for an interesting comparison against Java frameworks like Struts/Struts2/JSF/Tapestry/etc
Memoize and MemeCaching
Rack, and Metal
Modules and Mixins

Default method parameters, hashes as parameters, variable length argument lists
code blocks as parameters, code blocks passed to the method



Thanks!
 
Author
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Meta-programming is big. You don't realize how much time you spend maintaining unnecessary code until you go down the path of meta-programming. You're letting the code do more work for you.

Behavior Driven-Development. In some languages, writing tests is painful, feels like punishment. Ruby makes testing so much easier, so it's easier to develop applications tests first, easier to refactor the code, since you have tests that can tell you when something goes wrong. It's easier to keep the code clean and without smell. And the next step, writing the design of the application, the behavior, as part of the application itself.

Duck typing, in fact the whole approach to OO, means my Ruby code has very shallow class hierarchy, and less classes than the Java equivalent, which by itself gets rid of a lot of complexity.

Scripting. I'm surprised every time I see people clicking through menus, upload wizards, admin panels to deploy a new version of the application. Can't you just automate it with a simple script? Not all scripting languages are actually good for automating your workload, though. You can do a lot of that with Ruby, not so much with JavaScript.
 
Ivan Wang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually,Ruby isn't exciting me and Groovy isn't too.But when I see Grails,I'm very exciting.
It makes me do less to do more things.Now I'm learning Grails.So I want to know does Rails has something better than Grails?Not Ruby.
Grails use Spring and Hibernate,which has been very popular!And Grails can use the web server which Java uses.

I am sorry .English is not my mother language.So....
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Simple:

Try this in other psuedo-object oriented languages/scripting:

2.next --> produces {3}

Ruby treats everything as a true object even integer literals.
Teaching beginning students and adults is made so much easier, IMHO.

Nanouk
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Nanouk Nanouk " please see your private messages for an administrative PM.
 
Assaf Arkin
Author
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Grails was originally called "Groovy on Rails", and from what I understand copied all the good ideas behind Rails to the Groovy language. I think it did a good job copying Rails, but also Rails is still far ahead.

 
Bartender
Posts: 2407
36
Scala Python Oracle Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can really recommend Grails. I'm no Java expert, but I've been working occasionally with Java for several years, and I've always found J2EE a real pain (too much XML Configuration Hell for one thing). Grails takes the pain away and it's great.

Like Ruby, it's based on "convention over configuration" i.e. if you work with the conventions of Grails (naming, file locations, design patterns etc), then it is incredibly easy to get a real 3-tier J2EE database app running and deployed onto e.g. Tomcat.

But one big advantage over Ruby/Rails is the easy and complete integration with Java out of the box. Grails includes masses of standard enterprise Java libraries like Spring and Hibernate (partly because it's actually built on top of those libraries). But it's also easy to mix in your own Java code and other libraries as you need them. It is also very flexible e.g. you can opt out of the conventions if you want, set up your own URL mappings (for REST), use different object-relational mapping tools, map your objects to legacy DB tables, or whatever you want. So you get all the power of enterprise Java, plus great flexibility, but none of the pain.

If anybody wants to try it out, I suggest downloading the free PDF book Getting Started With Grails by Jason Rudolph, which will do exactly what it says: you'll have your first Grails app running in minutes, seriously. There's also a video presentation by the same guy to give you a quick intro to what Grails is about.

Then you could progress to the Mastering Grails series by Scott Davis on IBM Developer Works, which includes some extra ideas like Google Maps mash-ups, for example, as well as looking at Grails support for things like unit testing (JUnit is built into Grails of course).

Then if you want to get serious about Grails, get The Definitive Guide to Grails (2nd Edition) by Graeme Rocher and Jeff Brown.

And remember, Grails actually makes enterprise Java fun, so give it a try!
 
Ivan Wang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much.
I'll learn grails first
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic