File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Languages and the fly likes use of object oriented scripting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "use of object oriented scripting" Watch "use of object oriented scripting" New topic

use of object oriented scripting

Mohit Sinha
Ranch Hand

Joined: Nov 29, 2004
Posts: 125
Hi there,

This is a very general question. I have over 5 years of experience working on java j2ee apps. I see a lot of Ruby on Rails and Groovy Grails articles on popular java sites but have not fully understood what problem areas do they resolve.
What advantages does object oriented scripting introduce.
My question may sound naive but what I am trying to ask does object oriented scripting language like RoR and Groovy Grails complement java j2ee development or provide a superior alternative.
For example say if I take a traditional J2EE project how do I visualize the usage of such object oriented scripting languages. How can it make life more easier from a development maintenance perspective of an application.

Rusty Shackleford
Ranch Hand

Joined: Jan 03, 2006
Posts: 490
Ruby on Rails is not a language. Ruby is the language. Rails is the framework.

Rails solves the problem of making something that should be easy but often easy, easy almost all of the time. Servlets and JSP is a very complex solution to building web sites. It really shows the ugly side of Java, IMO. I can give you lots of examples, but consider that 4 lines of code + 1 small line in each controller, if you need fine tuned control, is all it takes to block people who are not logged in from accessing your web pages.

Most of the 'P' languages in LAMP often produced messy code with model stuff in the view and controller stuff all over the place.

Rails abstracts the model so transparently that it usually takes 1 line to switch databases. It also keeps the M, V, and C nicely separated, and actually enforces MVC.

It also has a built in CVS-like system of creating, maintaining and changing tables.

It has a ton of built in helpers that turn that messy 50 line JSP code into 1 or 2 simple lines of ruby.

It has great AJAX support, often allowing for a simple 2 or 3 lines to do some really cool stuff in this area.

In short, it allows you to have a functional website up and running in the time it takes to edit a XML file in JSP. AKA, it makes it easy to actually create something.

It is not perfect, and probably not even close to make it into the enterprise ring, but it solves the problem of taking care of all the mundane details so you can do something interesting. And as easy as it is to create something in Rails it is not easy to deploy it, but honestly it isn't that much more difficult then setting up Tomcat for production. If you need to break convention, sometimes it is a bit tough, but not always.

I don't know much about groovy/grails, and honestly am not interested. Ruby is a much cleaner language then just about anything else out there.

Give it a spin and see what you think: It takes less then 10 minutes to download and install ruby, gems and rails. You also get an awesome built in testing web server. Then click on get better and see what you can build in 15-20. Most people are stunned at how quickly they can bring up a basic web site.
[ October 21, 2007: Message edited by: Rusty Shackleford ]

"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
I agree. Here's the link:
subject: use of object oriented scripting
jQuery in Action, 3rd edition