The Source for Java Technology Collaboration
User: Password:



Bruce Tate

Bruce Tate's Blog

The toy?

Posted by batate on February 25, 2005 at 12:57 PM | Comments (30)

It’s way too early in the morning, but the kids are tearing down the stairs, and making more noise than my aching head should tolerate. But it’s Christmas, so I do. They are drawn to the biggest, flashiest, plastic toys first, but my wife and I share a knowing smile. That will change.

I’ve got a little kid inside me, but not when it comes to Java tools and frameworks. It takes a lot to get me to adopt a new framework. But sometimes, when friends that I trust are playing with something, I’ll pick it up too. Erik Hatcher, Stuart Halloway and Dave Thomas are very good at distilling the buzz, and separating out what’s important. So I decided to give Ruby on Rails a try. Rails founder David Heinemeier Hansson claims gaudy, plastic-like 10x productivity gains over Java. I’ve been skeptical, and I’m not alone.

Around 1:00 PM, the first toy breaks, and the joyous laughter turns into heart-wrenching doom. After a little comfort and a lot of psychology, we get the kids to move onto something else. In truth, not many toys will survive the first couple of months after Christmas.

David Geary summed up the feelings of the Java community nicely. Rails may be productive out of the gate. But it’s sure to wither under the load of enterprise development. After all, Rails has a few obvious flaws: domain objects must inherit from a common persistent base class, the templating technology does look a whole like the embedded Java that failed for this community, and Ruby is probably not as fast as Java. Further, early in the Rails development process, developers rely heavily on scaffolding to get things off of the ground quickly. That might lead to immediate productivity, but the gains will surely dwindle over time as the scaffolding is replaced.

After a couple of months beyond Christmas, the best toys emerge. They are built to last, and have enough flexibility to keep up with the active and fickle imagination of a kid.

But I love Ruby. And I think Rails has potential. The experience starts when I want to download Rails and add it to my Ruby installation. I type “gem install rails.” And that’s it. Ruby goes and gets the latest installation, and also pulls down the dependencies that I need. Very slick. Next, I want to get plugged into Rails best practices. I want to use the right directory structure, and build the first sample applications in the right way. I read a little bit, and then type “rails messages” to create my application structure. Similarly, I can generate and scaffold a basic application, with model, view and controller layers, to do the basic CRUD operations on a database. The process takes 15 minutes. There’s no setup for the web server. I don’t need to live with the scaffolding until the end of time, but I generally find that I’ll use some of the scaffolding methods with very little change. I’ve not used Rails for a production application yet, but I can imagine that it would let me get a simple user interface flow in front of my customer in a hurry. For that reason, I used to build “ugly pages” which could later be customized by a designer. So, immediately, there’s a lot to like. But is it a toy?

Invariably, a relative will give a movie or toy to my kids that I just don’t want in the house. I don’t like Barney, or Barbie, and never have. My girls have quit asking for them. Won’t work. So I’m a jerk, but a happy jerk.

So here’s the rub. Is Ruby a toy? And if not, is it fundamentally sound? Many rapid development environments break down because they might provide more productivity than their basic languages, but they also limit the power of the language. VisualBasic is famous for letting you build the first 80% of an application quickly. It’s that last 20% that will kill you.

I don’t think Rails will suffer from this problem, to the same degree. You can completely replace the view, controller and model layers for Rails. The difference between Rails and alternatives is that you can live within the scaffolding in the mean time, and then iteratively adopt it for your use. There are things that will keep me from using Rails on some projects. Most of them have to do with limiting technology for a given problem, like the lack of OR mapping for an existing schema. (I think Hibernate and Kodo JDO both kill ActiveRecord if the schema doesn’t match the model, or if the two are expected to evolve independently.) I don’t think that the Rails developers have completely thought through the visual component architecture, in a way that say Tapestry developers have for layered user interfaces.

In fact, the best “toys” often turn out not to be, well, toys. One kid loves her necklace, and the other loves her mountain bike. Big and beautiful books are often hits. To survive the first couple of months, a toy must be good. It usually is beautiful, simple, and has a little bit of magic to it.

Which brings me back to Ruby on Rails. It’s got that magic. I’ll just give you a little taste. When you’re mapping a Java class to a schema, you must often type the name of a property five times. !!!FIVE TIMES!!! Count them. Three in the bean: the getter, the setter, the instance variable. One in the schema: the field. Two in the mapping: the property, and the column. In Ruby, you type it once. Reflection and inspection of the database handle the rest. You use intelligent defaults and naming conventions to handle the rest. You can always override differences, but you don’t have to. Or take the mark up tags. They look like Ruby. Heck, they are ruby. That beats the scripting that we usually put into HTML, in the form of JSP tags.

So I’m not completely convinced, but I do think there’s something here. I’ll certainly try to get paid to do Ruby in the near future. But I do think that Ruby has the magic that great solutions have. And I think that part of that magic will never translate to Java.

My kid looks into the toy box. Will she reach for the toy that she got a few short months ago, over Christmas? I really don’t care. It depends purely on the game that she wants to play.

And that’s where Java developers often come up short. We’ve got a golden hammer. It’s the ultimate golden hammer. It’s the programming language itself. I’m not going to pretend that anyone would ever use Rails for everything. But think of the number of applications that you build that do nothing but put a big web front end on top of a persistent model. That’s a huge part of what we do. If Ruby and Rails can make you that much more productive, and if it solves the problem, why wouldn’t you?


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Interesting points Bruce. I've just found the RoR stuff and am starting my own analysis now. I too think there is some interesting stuff there.
    As far as duplication in Java, done correctly, a property name really only needs to be specified once, using Hibernate/XDoclet/Ant.


    private String firstName;

    Using IDEA, [Alt-Insert], Generate Getters/Setters.

    Mark properties as persistant using XDoclet.

    /**
    * @hibernate.property
    * @return
    */
    public String getFirstName() { return firstName; }


    Then run ant schema-export to generate the database. Proper tools close the gap quite a bit.

    Posted by: ppeak on February 25, 2005 at 01:23 PM

  • Not sure what happened there.

    Should have said

    class User > ActiveRecord::Base
    end

    Posted by: batate on February 25, 2005 at 02:02 PM

  • David Geary != The Java Community :)

    Check out other 'views' too (sorry about the pun)

    Rails is no toy
    http://www.almaer.com/blog/archives/000735.html

    Rails for Struts-ters, Part 2: The Views:
    http://kasparov.skife.org/blog/src/java/rails-for-strutters-2.html

    Dion

    Posted by: dionalmaer on February 25, 2005 at 03:50 PM

  • David Geary != The Java Community :)

    Check out other 'views' too (sorry about the pun)

    Rails is no toy

    Rails for Struts-ters, Part 2: The Views


    Dion

    Posted by: dionalmaer on February 25, 2005 at 03:53 PM

  • What's with the formatting on this blog? It goes way off the end of my 15" screen. I have to use the horizontal scrollbar a lot to read this thing. Bruce - get your host to fix the CSS!! The content is great, but it is ruined by the presentation.

    Posted by: jonathanaquino on February 26, 2005 at 09:09 AM

  • ppeak - won't people still be looking at the code? The complexity is still there, it was just generated for you.

    Why should it be necessary to use an automated tool for such a simple thing?

    Posted by: applebanana8 on February 27, 2005 at 09:26 AM

  • It would be interesting if RoR ran on top of JRuby
    To be honest,before Ruby, I'd never found a dynamic language that I actually liked working with.

    I would much prefer JSR 223 to be using Ruby as a core example for the JSR than PHP

    Posted by: calum on March 01, 2005 at 01:53 AM

  • applebanana8 - I understand your concerns about complexity, but I don

    Posted by: ppeak on March 01, 2005 at 07:01 AM

  • Frown. Last post got cut off for some reason. Here's what I meant to link to Java vs Ruby Persistence

    Posted by: ppeak on March 01, 2005 at 09:42 AM

  • Well, I just usually write the mapping file and have the schema and source (base classes) generated from it... so I really deal with the properties just one time (two, if I need a different name for the column).
    As a benefit, I can code with code completion instead of trying to remember the column names... all I need is in the java source, I don't have to try and remember the database column names (besides the fact that the column name may be bad looking due to naming constraints).

    Anyway, I'm looking forward to trying Rails... sometimes I do small CRUD apps and in fact it seems very productive

    Posted by: aaime on March 30, 2005 at 11:44 PM

  • Про Яву можете почитать еще здесь новости дня, компьютеры. Про спорт здесь спорт, новости спорта, а про футбол здесь футбол, новости футбола. теннис.

    Posted by: kolenchits on May 17, 2005 at 06:39 AM

  • There is an even easier way, again using the great Ruby language. Use Og (ObjectGraph) an alternative ORM library for Ruby. Using Og you don't even have to write the schema! And you still have access to powerfull features like join relations, dynamic field injection, polymorhpic relations and more. For more details check out: http://www.nitrohq.com

    Posted by: gmosx on July 29, 2005 at 10:46 AM

  • "When you’re mapping a Java class to a schema, you must often type the name of a property five times. !!!FIVE TIMES!!! Count them.
    Three in the bean: the getter, the setter, the instance variable.
    One in the schema: the field.
    Two in the mapping: the property, and the column."

    That's six, isn't it? Even worse than you originally thought. :-)

    Posted by: trejkaz on September 14, 2005 at 07:51 PM

  • I'm a long-time Java developer just now checking on RoR, but even in my nube-ness and Java-centric view, your arguments against RoR don't ring true:
    "Rails has a few obvious flaws: domain objects must inherit from a common persistent base class, the templating technology does look a whole like the embedded Java that failed for this community, and Ruby is probably not as fast as Java. Further, early in the Rails development process, developers rely heavily on scaffolding to get things off of the ground quickly. That might lead to immediate productivity, but the gains will surely dwindle over time as the scaffolding is replaced."

    Losing your one shot at inheritance matters a lot less in Ruby than Java, because you have mixins via Modules. And I know that a lot of Java ORM tools have fallen from fashion for committing this same crime, but when I look at the work I do every day, and how little it would matter if my domain objects weren't pure, I really wouldn't mind having to inherit from a Hibernate base class if it would save me all the work of writing the mapping files, queries, DAO interface and implemention and so on.

    Embedded code is bad? Well, it can be. But it's a matter of discipline. Just because you can abuse the capability doesn't mean you have to. So instead we end up with something like JSF that has god-awful syntax with an incredible amount of typing so we can be saved from ourselves.

    Whether Ruby is or isn't as fast (read: scalable) as Java remains to be seen and is open for debate, hardly a fait accompli. And more to the point, the level of performance that can be achieved by Ruby is probably more than adequate for 90% of the projects out there. I see all the capabilities of "enterprise level" applications go unused more often than not.

    And finally, you are complaining that scaffolding doesn't increase productivity throughout the life of the project? So you would rather have an approach that gave you a consistently low level of productivity instead of trailing off?

    Posted by: pinchworm on November 13, 2005 at 12:29 PM

  • You have an interesting blog.If you want to find out some information about Health and safety - you are welcome to mine.
    Health and safety

    Posted by: blindb on September 02, 2006 at 04:07 PM

  • silkscreen
    Every day, a new star is born. I turned my head, blushed, fluttered my hand up to my collarbone prettily, and gulped the last of my champagne. I know when I’ve been beaten.

    Posted by: blindb on September 06, 2006 at 05:06 PM

  • What's with the formatting on this blog? It goes way off the end of my 15" screen. I have to use the horizontal scrollbar a lot to read this thing. Bruce - get your host to fix the CSS!! The content is great, but it is ruined by the presentation. avandia

    Posted by: blindb on September 18, 2006 at 01:16 AM

  • Java cool tehnology. If you need make international call use my phone card, and else I know how pass a drug test

    Posted by: sergwm on October 07, 2006 at 01:51 PM

  • java people can use calling cards from
    shop calling cards and phone cards

    I use java, and I like it very much!

    Posted by: vikleo on March 10, 2007 at 04:17 AM

  • Not sure what happened there. Should have said class User > ActiveRecord:: calling cards else cellphone card Base end

    Posted by: sergv on March 22, 2007 at 08:59 AM

  • посмотрите java в таких известных каталогах как dirgate directory и dirozo directory

    Posted by: dirgate on March 29, 2007 at 04:17 PM

  • This phone cards shop uses java! It's very powerful language!

    Posted by: rider85 on April 21, 2007 at 01:24 PM

  • нихрена java на ваших сайтах не найдешь, гы )) ищите здесь drug testing

    Posted by: vikleo on April 29, 2007 at 02:54 PM

  • So here’s the rub. Is Ruby a toy? купить книгу und cool news

    Posted by: buy_viagra_online on July 02, 2007 at 02:11 PM

  • So here’s the rub. Is Ruby a toy? a href http://www.bookmap.ru купить книгу /a und a href="http://www.uzle.com cool news /a

    Posted by: buy_viagra_online on July 02, 2007 at 02:12 PM

  • I look at the work I do every day, private first Name the level of performance that can be achieved by Ruby is probably more than adequate for 90% of the projects out there.

    Posted by: byonline on July 08, 2007 at 02:35 PM

  • phone cardsppeak - won't people still be looking at the code? The complexity is still there, it was just generated for you. Why should it be necessary to use an automated tool for such a simple thing?

    Posted by: lamahpl on September 02, 2007 at 02:05 AM

  • To be great Java developer you need to stop smoking RIGHT NOW! and you can use nicocure for it as I did.

    Posted by: alexlazarev on October 05, 2007 at 04:09 AM

  • Really you need to concentrate on some great smelling Perfume. Maybe try some Paris Hilton Perfume for women.

    Posted by: perfume_deals on October 11, 2007 at 06:05 PM

  • This page become pretty funny =) I can offer for Java developers to buy Provillus for Women or Men. This is great hair loss treatment!

    Posted by: alexlazarev on November 21, 2007 at 05:26 AM





Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds