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?
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?
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
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.
posted 11 years ago
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....
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.
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.