Tuesday, June 14, 2011

Rails vs Force.com: Web App Smackdown

I've had my head buried pretty deeply in both the Ruby on Rails framework and the Force.com platform lately. I'm going to take a breather an try to gain some perspective on how the two fit together. At first glance, most would dismiss the two as completely different beasts. I know I did. Upon closer inspection, I've found the two to be much more similar than I first expected.



First things first. What's a framework? A framework is a piece of software that eliminates the busy work from creating an application. Ruby on Rails is a framework for creating web apps. By leveraging a framework like Rails, a developer can develop and deploy applications much faster than they would be able to otherwise. A framework like Rails contains hundreds of thousands of lines of code (my rough estimate.) This is all code that the developer doesn't have to rewrite when they are making their application.

There is a subtle distinction between a framework and a platform. Both exist in pursuit of the same goal, but each accomplishes it in a different manner. A platform, in the case of Force.com, is a whole package deal. This means that the creators of Force.com provide everything from the tools to develop applications to the hosting of the applications themselves. Force.com applications exist solely on the Force.com infrastructure. In contrast, a Rails app could be hosted on Heroku (owned by the same company as Force.com), Amazon Web Services, or even a personal laptop. These differences mean that each is optimized for a certain application, but first I'll talk about the similarities.



The glaring similarity between the two methods is the model-view-controller architecture. Roughly, the model defines the structure of the data, the view describes how the data is shown to the user, and the controller handles all of the logic the connects the two. Although MVC is a powerful paradigm, not all frameworks implement it... not by a long shot. The fact that both Rails and Force.com both follow the MVC architecture is a huge similarity that cannot be ignored.

Both Force.com and Rails make getting up and running with a simple database backed application almost trivial. The Rails scaffold generator literally requires one line of code to create an entire application (two if you count the initialization of the app.) Not to be outdone, Force.com allows semi-technical users to do the same thing with point and click configuration--requiring just slightly more time. Data backed applications are a pervasive reality, and both of these tools have completely solved the problem of their creation.

I know exactly the state that I've put you in, and I apologize. Right now you're wringing your hands and wiping sweat off your forehead because you're trying to decide whether you're going to use Rails or Force.com's platform. I've gone to some effort to highlight the similarities, but the fact remains that they are very different tools and should each be used in different circumstances.

Rails gives the developer a much finer level of control over their application--for starters, you can host it with someone other than its creator. Rails is by far more flexible. In fact, you could change any part of Rails because it is an open source project i.e. the source code can be obtained for free. This makes Rails ideal for creating web apps that might not be like anything created ever before. Of course, this flexibility comes at a price.

Force.com excels in some areas that Rails isn't meant to optimize--especially in business applications. Data backed business applications follow a fairly uniform pattern. The objects in question and the relationships between them are easy to describe. Force.com has done an incredible job of standardizing the process of business application creation. I think of Force.com as a specialized set of LEGOs. It certainly isn't the best solution for every problem, but if it's the right set of LEGOs for the job, you aren't going to find an easier or better tool. Thankfully for the creators of Force.com, there is no shortage of businesses that need software for which the platform is well suited.

I've developed with Rails for some time now, and I've grown to love the framework. Ruby is one of my favorite languages, gems couldn't be easier, and it's one of the New and Interesting frameworks that everyone is talking about. When I first started developing for Force.com, I had a negative visceral reaction to the circa 2001 styling and copious links. How could anyone prefer this clunky, plodding platform to the flashy, agile Rails? While I haven't yet started worshiping at the Force.com altar (and I have no plans to), it's grown on me to the point that I no longer have an alergic reaction the minute I log on.

2 comments:

  1. Interesting read. I'm a Rails dev and I've been asked to look into Force.com - how does the latter compare to Rails for building a complex user-facing website that does things like sell tickets and have a user forum?

    ReplyDelete
  2. In general, the Force.com platform is a very powerful platform. It excels at viewing and analyzing data once you have collected it. However, it does have some limitations on what you can do on the user-facing side. Rails gives you much finer control over the user interface.
    If you want to get up and running quickly, I would suggest Force.com, but if you need to do complex customization on your user facing site, I would go with Rails.

    ReplyDelete