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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s