Why Ruby on Rails + JRuby over PHP: My Take, Shorter Version

As a Ruby, Java and occasional C/C++ developer who has also written some production code in PHP, I work with and tend to prefer the power and flexibility provided by a JRuby + NetBeans + Glassfish stack over PHP.  Here is my attempt to somewhat briefly describe not only why but also to encourage others to develop in RoR vs. PHP:

Pros

–          Exceptionally high developer productivity with:

  • “Programming through configuration” philosophy
  • Emphasis on rather complete default behaviors
  • Write-once (DRY) orientation
  • Simple ORM (ActiveRecord) means a lot less SQL with minimal fuss
  • Dynamically typed language means a lot less thinking about variable declarations
  • Result:  A lot less grunt work; more focus on “real work”

–          Strongly encourages clean MVC architecture

–          Test frameworks

  • TestUnit is easy to use and effective
  • Enables test driven development (TDD) often omitted in PHP world
  • UI mocking frameworks are available

–          Pre-packaged database migrations feature eases schema creation and changes

  • Helper methods further simplify and aid to avoid writing SQL
  • Roll back or forward to arbitrary versions

–          Significant pre-packaged forms and JavaScript/AJAX UI support

–          Ruby language easy to learn and more versatile

  • Like PHP, Ruby language’s initial learning curve is much easier than Java, C#, etc.
  • Like PHP, Ruby language conducive to scripting as well as slightly better OOP support
  • Ruby language skills can be leveraged for use in environments outside web applications

–          Vendor support by Sun Micro

  • Dedicated team and significant JRuby project
  • Good support in NetBeans IDE
  • Quality Glassfish app server from JEE world
  • Provides integrated NetBeans, Glassfish, JRuby stack in one download

–          Tap JEE power from within Ruby

  • JRuby allows fairly seamless access to Java and JEE libraries and features as well as your own Java code should you desire
  • Result:  You can start simple without being boxed in, and you can later add a lot of enterprise-grade sophistication.

–          Community

  • Contains a lot of talent from JEE world
  • Libraries that implement simpler versions of enterprise-oriented features
  • Community tends to be rather friendly and inclusive

Cons

–          Maturity

  • Despite making huge strides, acceptance remains low at more conservative companies
  • Hosting options limited in comparison to PHP
    • Dedicated server or VPS
    • Amazon EC2
    • Smaller pool of shared hosts
  • The ORM can be a memory hog
  • Fewer jobs open due to fewer projects (job to applicant ratio might be greater though?)
  • Fewer sysadmins and established maintenance procedures
  • Less support, fewer developers to maintain RoR apps

–          LAMP-like scalability limitations for conventional architecture are comparable or more resource intensive than most PHP solutions

–          Of course, if venturing heavily into cross-platform JEE territory the learning curve steepens dramatically

Associated Press going too far?

Recently the widely used wire service has started charging for excerpts using more than 4 words. Under fair use rules and established copyright law authors of editorials and reviews are ordinarily permitted to excerpt from a work without permission from the copyright holder as long as the source is properly identified.

In a NY Times article dated July 23, 2009:

“In an interview, [AP’s chief executive Tom Curley] specifically cited references that include a headline and a link to an article, a standard practice of search engines like Google, Bing and Yahoo, news aggregators and blogs.” —Richard Perez-Pena, NY Times

AP has been on a road to protect its content and revenue stream for a while taking what some see as overreaching measures. Last year, the Drudge Report’s liberal opposite Drudge Retort was at the center of a publicized dispute (about the case) over content posted by its contributors. AP’s legal eagles have been reportedly going after a number of sites and bloggers, and a form of automated DRM (AP’s press release on the subject) is also being rolled out.

In the last couple of days, many are pointing to James Grimmelmann’s experiment where he was charged to license words clearly in the public domain (Grimmelmann’s blog post). Mr. Grimmelmann was refunded his money and the license rescinded having no implications on his use of them given that the words – a quote by Thomas Jefferson – are already in public domain. AP likened the experiment to running an item you’ve already paid for through a self-serve grocery store checkout station.

The iCopyright system which Grimmelmann used to license the content runs on the honor system, and according to others licensees can copy paste text into it that they intend to use. The system is relatively simple and apparently at least in this case did not check the public domain status of the content. Given that we are dealing with a system that already provides the user some discretion about what’s entered, is the Grimmelmann story a minor procedural flaw and not really a big deal?

As AP points out, reporters should be paid for their work. Why should bloggers – especially those few who turn a profit – be freeloading on a hardworking industry that requires real people and real infrastructure on the ground asking questions and going places. Furthermore, in today’s era of sound bytes, sometimes just a few words tell the story.

Traditional media’s revenue sources and business models are on shaky ground with print – a big part of AP’s customer base – in the most precarious position. When content can be syndicated, rehashed or even originated by so many people, will centralized sources large enough to generate real advertising and subscriber revenue survive? Can AP, Reuters, CNN or any other large privately funded news organization survive in the coming climate?

Some say what’s most alarming about the situation is the notion that fair use is per policy being thrown out altogether which could set a dangerous precedent.