Home > Ruby on Rails > Ruby on Rails – Could it Replace my PHP Java Mixture?

Ruby on Rails – Could it Replace my PHP Java Mixture?

November 3rd, 2005 Tony Leave a comment Go to comments

It must have been the code God trying to tell me something this week. First Brian on Tuesday and then Mike on Thursday asked me if I had looked into into the Ruby on Rails yet. I had read a few articles about the framework… well, to be honest I only scanned them. My first impression was that it was a lot of hype over a glorified hack to a version of perl. But now that I’ve actually spent a bit of time reading over the beautiful site and and watching the 15 minute intro video I’m very entrigued.

A few months ago I forced myself to spend some time with Python because I had read one too many blogs agreeing that Python cuts development time by 75% over Java. The thing that turned me away from Python was the lack of a good web application (like JSP for Java).

I’m still very wary of switching to Ruby for reasons such as a lack of pre-configured webhosts. My current dedicated host ships all servers configured for php. Thats not such a big one because I already have to install Resin. I’m still not convinced that I could give up the power of Java for a scripting language. For instance, I currently use PHP extensively for quick, simple, dynamic interaction with the end user. It is extremely fast, its quick to develop, it runs on every platform, and it scales big time. However I recently spent a few days trying out the PHP port of Jakarta Torque known as Propel. (Torque and Propel are a object database mapper persistence layer). While Torque performs extremely well, Propel does not. The problem is that the code generated by the Propel generator is quite large. Most classes are 800+ lines. This is no problem for a language like Java that is compiled into bytecode but for a script language like PHP the overhead of simply including one class file is 400 milliseconds. Ugg.

Will Ruby suffer the same constraints? Will Ruby be difficult to adapt to SEO practices? I doubt it. The simple fact that it plays nicely with Apache tells me that mod_rewrite should be no problem.

Categories: Ruby on Rails Tags:
  1. Maury
    November 5th, 2005 at 02:18 | #1

    Did you try the other PHP ORM solutions listed here: http://en.wikipedia.org/wiki/Object-relational_mapping? There’s other one that produce more lightweight code than propel. Try POG http://www.phpobjectgenerator.com for instance.

  2. Tony Spencer
    November 5th, 2005 at 11:24 | #2

    Hi Maury,
    No, I didn’t investigate into any other ORM solutions for PHP. My hope was that I could share my XML definitions file that I use with my Torque app with my PHP Propel version. It works but its too slow for my taste.

  3. Manuel Lemos
    December 15th, 2005 at 15:54 | #3
  4. Guest
    April 16th, 2006 at 08:14 | #4

    I would recommend using Doctrine. Doctrine is a ActiveRecord implementation and its as easy to use as RoR ActiveRecord. Doctrine doesn’t rely on code generation rather it has a compact runtime library (only about 200 kb).

    Doctrine has many features missing from other solutions such as batch fetching, mixing of fetching strategies and full object query language API.

    You can grab the latest version of Doctrine from:

    homepage: http://www.phpdoctrine.com

  5. April 18th, 2007 at 08:23 | #5

    Also, Doctrine is being slowly adopted by symfony. http://www.symfony-project.com

    And Doctrine is participating in the google summer of code, so it should be pushed a long nicely over the summer.

    If you are a php guy, I would check out php + symfony + doctrine. It is all you will ever need.