Skip to main content or search

Why I Love Ruby on Rails

Thursday September 22, 2005 / 40 Comments

In college, all of my classes revolved around Java and C++, and the first few years of my professional career were with ASP.Net which was a huge evolutionary leap in web development, and a joy to work with. It enabled me to spend less time on the tedious plumbing and more time on the important things. I had spent nearly three years learning .Net, Microsoft was due to launch 2.0 in November of this year, and I couldn’t imagine building a web application without it.

With this background and experience, I was definitely hesitant to switch to an open-source and, at the time, unproven platform. As a result, I was fairly cautious and spent a lot of time researching Rails before fully committing to it as my development platform of choice. I’ve been following it for months now and have read almost all of the Agile Web Development with Rails book. (Review coming soon.) And naturally, I’ve installed everything and taken it for a test drive or two. It rocks.

Best Practices

Rails takes all of the things you should be doing, and consolidates it into one very elegant framework. Directory structure, unit testing, functional testing, performance testing, database build scripts, MVC separation, validation, no XML configuration files, and more. It’s all there, and it all plays together nicely. This is my favorite aspect.

While it doesn’t matter to me, another wonderful thing is how easily you can override the defaults. Rails is setup to handle everything one way, but if your legacy data model doesn’t mesh with the standards, it’s not difficult to override things and do it your way. It’s beautiful in it’s guidance towards best practices, but at the same time it’s open-minded to doing things your way.

Less Plumbing

It doesn’t save me from writing code, but it does save me from writing easy code. I don’t have to write SQL for every little query. If I want to use more advanced queries, I can, but all of the tedious stuff is taken care of for me.

With Rails, there’s no need for 3rd party code generation or unit testing tools. That means more seamless integration and less time setting things up. Even though .Net saved me from some of the tedious plumbing, Rails saves me from doing even more. The less time I spend on the plumbing, the more time I have to build a better user interface to empower users to do more and do it with greater ease.

Ruby the Language

This is one of those more technical things, but Ruby is beautifully object-oriented. Everything—and I mean everything—is an object and behaves as such. Additionally, the syntax and language itself are concise and a pleasure to both read and work with.

The Enterprise Discussion

The only “real” argument I’ve managed to find about Rails is about how it’s supposedly not scalable enough for enterprise solutions. That may or may not be the case, and, after reading all of the arguments, I personally don’t find it relevant. I’m not going into the details here. If you’re interested, I suggest checking out What’s all the fuss about Ruby on Rails?. Enough about that.

Summary

I’ve done my research, and decided. I’ve got Programming Ruby and a book on Subversion on the way, and can’t wait to start applying everything to a real project. I never thought I’d be able to describe anything related to programming as elegant or beautiful, but sure enough, Ruby on Rails is all of that and more.

Featured Stuff - Resources: Wireframes & Page Description Diagrames

Omnigraffle and Visio versions of the wireframe templates and stencils I use on all of my projects. There’s even a few examples included for good measure. More about Wireframe & Page Description Diagram Stencils and Templates


My thoughts exactly. Daily I find and am reminded of another aspect of the programming process that rails executes so easily and seamlessly for me, it just makes it such a joy to work with. Oscar Duignan

I come from a qbasic->vb->c->c++->java->php background and all that I have to say is “I agree.” Oh, and the Agile book is great. As the available components and libraries grow, there will be even greater Ruby on Rails support. One key missing feature for ‘enterprise’ use is lack of multi-database transactions, but I digress. Aaron Blohowiak

Very interesting article Garrett. I have not really gotten into RoR but having read your article and seen some examples of RoR in action on other sites I must say it has sparked my interest.

I am looking forward to your review of “Agile Web Development with Rails”.

Peace and God Bless. Yannick

I really like Rails a lot too, impressively easy to get up and running with little to no configuration. I love all the defaults built into RoR and how one typically does not need to override those defaults. I stared into the Agile book, but then I drifted over to getting the Typo CMS running and haven’t had time to complete the book, but I sure to like the agile development process.

Of the huundreds of great things about Rails, what impresses me the most is ActiveRecord. I love that I can create a table, then create a model that extends ActiveRecord (with virtually no code). All the table interaction is already built into ActiveRecord, so there is really nothing more you have to do (other than add validation, which is amazingly simple). Coming from ASP.NET, I never thought such a thing was possible. Justin P.

I’m probably the newest member of the bandwagon. I had heard a bunch about it—hadn’t tried it. Picked up some reading, and started yesterday. Did a tutorial on a “cookbook”—I’m sold. Very beautiful language and integration. Chris Mewhort

I’m still wondering what ‘the fuss’ is about but at the same time I’m interested. I come from a java / php background and from what I can see now is that Ruby seems to be yet another programming language and Rails seems to be yet another framework. The demo’s and tutorial articles on Rails look impressive to say the least but being thoroughly skilled in java and php I wonder whether it’s useful to dive into a completely new language or not. Also nice to note, apparently there’s a Rails look-alike for PHP in the works which makes it even less viable for PHP coders to abandon PHP and dive into Ruby.

As said, I’m still interested in RoR but I’m not quite ready to dump PHP in favour of it. Marco

I don’t think it’s a matter of dumping one for the other. Rather it’s a nice, new tool that you can use when it fits (better than PHP/Java/Cobol/etc). Just like with everything else. Samo Korosec

Samo, in a larger company it’s great to have multiple solutions at hand. However if you’re a freelance web developer or you’re working in a very small company it’s often better to focus on one solution than to use many different ones. After all let’s be honest about it: There’s little or nothing you CAN do with Ruby that you CAN’T do with PHP and vice versa the same is probably true. If you work on your own or in a small team and you focus on one technology instead of multiple you can build a reusable components along the way making development easier and quicker with every new client. Using two or three comparable development routes doubles or triples the effort needed to build up your own library of reusable components. Marco

Great post, Garrett.

I too am getting on board with RoR, and have just accepted my first job(14 month contract) developing in it.

As someone who went from front-end standards based development, and skipped right past PHP to J2EE development building custom CMS’, I’m more than happy to switch to RoR.

These days, I’m primarily interested in building my skills in front-end dev, I/A and interface design. Given that ruby is such an elegant and expressive language, it just makes more sense naturally for me, and I honestly can’t imagine going back to Java for the kind domain based applications I’m building. Plus, I’ve always felt comfortable working in small teams, and RoR allows me to do so and still be very efficient.

Oh, and it’s nice to hear someone experienced in .Net praise RoR. The developers at my last gig nearly worshipped .Net, and wouldn’t think of using anything else.

Does this mean Bright Corners is going to look to use RoR on projects where it makes sense? :-)

p.s. Not sure if it’s just Firefox on my W2K machine, but the tab index on the comments, while it appears correct, is skipping from the http:// label, and takes me to the top of the page. Kyle

Kyle – Bright Corner still has every intention of being a .Net shop as most of our projects are more enterprise-oriented and that’s the stack our clients prefer.

However, we are starting to consider Rails for some internal projects and other client projects where the platform doesn’t have to be .Net and it’s appropriate.

As for the tabindex, I believe that’s a pleasant little issue with Textpattern. I had hacked my previous install to make the form fields more correct, but unfortunately, when upgrading to 4.0, I lost those improvements. I’m hoping to either get the hang of subversion and submit my changes, or just wait for it to get fixed. Garrett

as someone who purchased Agile web dev (the book), and has been curious about this whole business (programming that is), what would you all recommend as a starting point? Do you think RoR is a simple enough place to start or would PHP be easier to grapple? brian breslin

Haven’t started with RoR yet. Want to, but lack of time right now. I have been building a large list of links thanks to Lisa McMillan’s del.icio.us. Brad Chmielewski

Brian – I don’t know that I’d recommend Rails to somebody without a background in object-oriented programming.

If you’re really interested in Rails, I would suggest checking out some books on the concepts of OOP before trying to dive into Rails. I can’t imagine trying to tackle it w/o having gone to school for it, but I imagine it’s possible if you really set your mind to it. Garrett

Brian: Making really simple things is probably easier with PHP. However, if you want to do anything more sophisticated, I’d say you’re better off learning Ruby and Rails from the start. When you have read and grasped the Rails book, you’re already pretty proficient working with RoR. I’d still consider getting the PickAxe book as a companion, though. Jarkko

Brian – Following up on Garrett’s last post, if you’re interested in a good beginners book on Object Oriented programming and concepts, I’d recommend the following;

Object Oriented Thought Process

I can’t speak to the second edition of the book, which according to Amazon seems to approach Java and .Net(my first edition only covers OOP as it relates to Java).

Still, it’s a nice, gentle indroduction to OOP concepts, and it looks like you can pick up a used copy for $15. Pretty cheap. I know it helped me getting started in Java a few years back. Kyle

I am primarily a php developer. Over the last 2 years, I have been slowly but surely adopting the MVC (Model View Controller) methods out of natural instinct and have made my own (decent) homegrown php MVC framework. Now I am dying to be working with AJAX much more and I don’t have any AJAX functions built into my framwework, yet. With that said, Rails just seems like the perfect solution for me. Plus, I have a few projects coming up that would be a good match.

Now, I have read some of the Pickaxe book and just about all of the Agile Rails book and I still have a serious fear of the learning curve that is ahead in developing these new projects with Rails. I could easily swing out php and have the product I need in a regular amount of time. But I really want to try Rails. I feel the Rails vibe. But Rails is still so young, with limited support… if I get stuck somewhere and it takes a day to find my way out, I will be screwed and will likely miss deadline.

My instinct tells me to wait to adopt Rails as a reliable solution for my clients. Anyone have a similar scenario? or advice? Ben Hirsch

I am in total agreement. Rail makes programming fun again. I haven’t said that in a long time. It also helps put a lot more of your creative juice on business logic and user experience instead of figuring out the complexities of plumbing and dealing with data. For the record, I just spent 13 hours attempting to drive the usually short trip from Houston to Austin and was able to re-read Agile Web Development with Rails. If you are learning and using Rails and don’t already have this book – Get it! Kelsey Ruger

Kelsey,

Yikes! Remind me to stay off the road when you’re driving a car and reading books at the same time. Geof Harries

Kelsey – My friend took 21 hours to get from Houston to Huntsville. For those of you that don’t know, that’s normally about a 2 hour trip. Garrett

Some reactions here really do get me itching to get started with RoR. However there are still things holding me back. First of all (at least in Holland) it’s not really easy to find hosting companies that have RoR. This is a serious problem when developing sites for customers who don’t have their own servers. Then there’s the risk you might get ‘stuck’ because RoR is still young and you might find issues that just can’t be done with it. Finally there’s the hype factor. What if you’ve spend months in setting up a lot of generic code in Rails to find out it’s obsolete next year because there’s another language coming up that’s even bigger, better and faster? PHP is just out of the ‘hype’ phase. It hasn’t died but grown into a more professional direction. Will this also happen with RoR? I hope so for those who are involved but at the moment we can’t possibly tell.

Like I said, still very much wanting to get going but hesitating because of the risks involved. Marco

Geof, I’m pretty sure Kelsey read the book while sitting in standstill traffic (since everybody is leaving Houston right now), sounds safe to me :) Justin P.

Marco – Considering the community around Rails, combined with the fact that the lead developer depends on the platform for all of his professional work, (Basecamp, Backpack, Tada Lists, and more coming down the pipeline.) I think you’re pretty safe for a while. Rails isn’t going anywhere anytime soon. Garrett

A PHP programmer is currently developing the software for my site. The application will be forum software specifically tailored for an very limited target audience. Central to the design is that we use a tree to navigate in the forum. Now a lot of people are telling me that PHP in the long run won’t “scale” and that I should see the PHP solution as a temporary one and that it should be used as a pilot to determine what I really need, and that once I’m sure that we have most of the functionality covered I should replace it with something better ie. Java/JSP.

Before I start looking at RoR as an alternative, assuming PHP really does not scale, can you tell me if I would able to build forum software with a tree as the “navigator” of choice using RoR?

Thanks Johannes

Johannes – Unless you’re planning a huge marketing campaign, say super bowl ads or something equivalent, scalability should be the last thing on your mind, and since you’re saying it’s for a very limited target audience, you should be even less concerned about scalability up front.

That being said, Flickr was built on PHP and look where they are. I’m pretty sure it scaled just fine for them.

All that being said, you should definitely make sure your application is built so that it can scale in the future. That’s more of a function of how it’s built, not the platform it uses. Garrett

Thanks Garrett, for another awesome post! I agree with you 100%....

RoR is actually FUN to program in. I’ve spent the last week or so learning the basics and really enjoy the process. I feel like all the little mistakes I used to make with conventions in PHP are taken care of, and I actually think that it’s teaching me how to be a better organized programmer. It’s weird.

I also love the fact that Rails isn’t even a level 1 release yet and it’s already so action packed. For the non-believers: give it time. With a few years and some solid community growth, I think you’ll find that it’ll really catch up to the rest of the industry in terms of scalability and security. Ruby has been around for AGES, so I think it’s just a matter of the framework solidifying itself a little…

And Brad – that’s so cool that you’ve benefited from all my del.icio.us RoR bookmarks. :-) As I learn, I’m sure there’ll be more coming. LOL Lisa McMillan

Great article. RoR almost makes me want to be a web developer. I am an SA by trade buy have done alot in perl/Mason, python, and now ruby. RoR by far is the best web framework. Python has too many frameworks that are just aggregations of other products. The glue there is very light. RoR seems to be thought of with every piece in mind. Plus there’s no need for a templating language which other frameworks desire. Ruby seems to be picking up steam because of Rails. Why have some many Rails wannabe’s when you can have the one and only? Sonny B

I have been a PHP developer for the last 6 years. I just made my first actual RoR app. It is a pleasure to develop with it. In the past I have made a similar app in PHP, and it took about two months. Doing the same thing in Rails took about two weeks. I think if I were to do something of this size/scope again, it would be around 3-4 days. Jeremy P

Ok ok I’m convinced. I’m going to go freelance in a couple of months and it definitely seems RoR could save me valuable time compared to my current main language (PHP). I’ll get the book and hack around soon!

And eh.. Johannes, it’s funny how everyone always seems to think Java is ‘better’ than PHP. I’ve seen many collegues in the field struggle with horrible implementation problems and performance troubles with dinosaur-sized J2EE frameworks. The marketing in the Java area is definitely extremely strong but I hear nothing but horror stories from those who actually work with it. I myself only know Java from the J2SE side though. I love Java as a language but even with simple J2SE servlet containers I’ve always encountered sluggish performance compared to PHP. Marco

Hi, I’m very new to Ruby. THe only thing I’ve done is intall RoR and created a “hello world” application so forgive me if anything I say does not make sense.

I’m a .NET developer and one of the main reasons I enjoy programming in .NET is the fact that there’s a very nice development environment that “comes with the package”. It’s called Visual Studio.

Independent of the language you choose to develop an application (be it C# or Ruby) or the framework you choose (.NET Framework or RoR), the development environment is crucial in determining the developer productivity (in my opinion).

For example, it would take me a lot longer to develop a .NET application using Notepad (or VI, or EMACS) than using Visual Studio.

There are 2 features that makes Visual Studio a tool I’m not willing to give up until someone else provides the same funcionality:

1. Intelisense: That’s the fancy Microsoft name for “code completion”. If you type the name of the class plus a ”.”, the environment shows you all the available methods and properties for that class and the parameters they take. This saves a lot of time with trying to remember a function/method name and all the valid parameters for it.

2. Real time debugging: Visual Studio allows you to create breakpoints in your application and then debug it in real time. You are able to check the value of anything related to the execution, be it a varibale, a property, a class, etc. In the past I had to write the value of things I wanted to debug to the output (web page) to be able to debug it. It was slow and painfull and I’m not willing to go back to that method.

So, my question to you all: what are you using as your development environment for creating RoR applications? Is there anything out there that provides the funtionality described above?

Thanks,
Fernando

PS: To be fair, Visual Studio has a really bad HTML designer/editor. I use Dreamweaver to create my pages and then plug then into my Visual Studio projects. Fernando

Fernando – its important not to get tied to a development environment – one of the advantages of both Ruby/Rails and PHP is that it is possible to do a lot without an IDE.

However, if you really prefer the comfort of an IDE, there are options out there. Eclipse is a good IDE framework and there is a plugin for Ruby though its a bit buggy right now – the project went stale and is only just being picked up again.

I use jEdit, which has a very good Ruby plugin that offers intellisense like functionality for Ruby, but not Rails. It also has an embedded console. jEdit is primarily an editor but has a wealth of plugins that let you turn it into something like an IDE. Ruby has its on debugger with breakpoints which can be operated from the console (so you could use jEdit’s internal console for example). Take a look here:

http://wiki.rubyonrails.com/rails/pages/HowtoDebugWithBreakpoint Luke Redpath

Thanks Garreth & Marco. I’m sticking with the PHP direction we chose but I think I’ll give RoR a spin just for fun as soon as I have time :) Johannes

Ive just started using php about 2 years ago, and istarted to like it a lot but reading into ruby it seems more dynamic and powerfull. Just a bit bored i bought hosting with no ruby support :( malbolgia

I originally came across Ruby when I was trying to use an unsigned int as part of a little playing-around with encryption, using PHP. It turns out that there is no way to simulate this functionality in PHP. So I looked at Ruby, and sure enough, Ruby does it.

To my pleasant surprise, Ruby was also a lot more fun to code in “for some reason”. And then I discovered Rails.

If there is just a single language feature that one language has but not the other, you’re always going to be a little more limited ;) Peter

I originally came across Ruby when I was trying to use an unsigned int as part of a little playing-around with encryption, using PHP. It turns out that there is no way to simulate this functionality in PHP. So I looked at Ruby, and sure enough, Ruby does it.

To my pleasant surprise, Ruby was also a lot more fun to code in “for some reason”. And then I discovered Rails.

Last week I moved my main dev host to TextDrive… which has Ruby/Rails support.

If there is just a single language feature that one language has but not the other, you’re always going to be a little more limited ;) Peter

Garrett, something that came to mind when we choose Rails over ASP.NET for an upcoming project was components. One of the reasons that I have enjoyed working with ASP.NET in the past is because there are thousands of UI components and widgets that you can buy/share as well as a very well developed IDE. I have even spend a little time the last couple of weeks working on creating a framework that will allow my developers work on their Rails applications using Dreamweaver 8. Nothing speeds up development like having an IDE that helps reduce common errors(code completion, code hints, etc.) and components that help you “not re-invent the wheel”. I think perhaps a new section on the wiki that focuses on creating componentized widgets ala companies like component art would be a great addtion to the Rails community. Thoughts? Kelsey Ruger

Kelsey – I understand the value of those components, but unfortunately, I’d have to disagree on their overall value. In my experience, I spent a significant amount of time setting up those components, licenses, etc.

In the end, they just generated some horrible code that made the projects a mess. Naturally, when it came time to make enhancements or fix bugs, the resulting mish-mash of 3rd party components made things messier than I would have personally liked.

This gets back to one of the reasons I like Rails. Everything is so seamlessly integrated, you can just build. You don’t have to worry about integrating parts from other vendors. Unfortunately, many of those vendors don’t follow all of the best practices regarding JavaScript, CSS, and Images, and things just get out of control on the front end.

All that being said, when using .Net, I can’t imagine not having those components, but when given the choice, I’d just rather not use .Net at all. Garrett

I have used rubbyonrails very little. So far, I find it quite interesting. I use it with eclipse, the same ide i use for writting php and jsp.

It is a marvel that you can develop little db driven applications withour writting a single sql. This is not enough for most applications, but there are certain cases where scaffolding will be enough (eg a certain section of an admin interface)

mike

Ruby will never replace C# in my books. With Rails, while it’s nice that it does so much legwork for you, at times I feel the same way as when I’m driving a sportscar with an automatic transmission – deflated. It does the trick, but I have to argue it doesn’t do it how I want most of the time and it is simply not that easy to bend it in more advanced ways.

Object Oriented, yes, but missing a lot of features I’ve come to love. The most notable problem with Ruby is that it’s not strongly typed – I loathe this, it begs for strong typing at the very least.

Just like an automatic transmission, Rails just doesn’t shift gears exactly how I want the majority of the time. I guess I simply don’t like too much declarative hippy stuff taking over. :P

Binary Jay

Binary Jay: Ruby (and Rails) is strongly typed. It’s just dynamically typed instead of statically typed. This gives you more flexibility. I would argue that instead of getting stuck with a 5-speed transmission, you can have an n-speed transmission.

Victor Cosby

Warning – Very long post

Let me preface this by saying that I love open source and linux. My business is setup with Ubuntu on the desktop where possible (those people that only need to access web apps and don’t need windows specific things). I run an asterisk PBX from switchvox. I use subversion and TRAC for my projects. My companies first real CRM was SugarCRM. I love OSS, but serious web dev is one place the propriety guys take over.

The power of RoR lies in ActiveRecord, but all you need is a good O/R mapper for .Net and you’ve got that covered (LLBLGen Pro anyone?).

I have a core set of components built in .Net that allow me to share my functionality across multiple web AND desktop applications. Which is built on top of LLBLGen Pro generated entities from the DB.

I have 3 front end facing websites, 1 intranet site, 1 customer portal, 2 desktop apps, and a service that runs on a special server all using the same component libraries, in .Net. They all use the same library and the UI Code is minimal. I even hire people in Romania to write my UI Code and backend code (I give them a series of unit tests that must pass). These applications run my manufacturing business that employes hundreds of people (even payroll, CRM, QA, etc.).

So by myself setting up the hardware, developing the software, and with the help of 1 full time and 1 part time developer in Romania I’ve built an entire software framework in .Net to run a multi-million dollar business, in a little over a year. It’s not like I do dev all the time too, I have a business to run and can maybe get 4-5 hours of development in a week, if I’m lucky.

RoR was definitley a consideration for this. I bought the agile book, read it, did the samples, and was not impressed when it came to handling complex business logic, integrating with Shipping API’s or COM API’s for some applications we use. Plus the speed was so slow compared to .Net I couldn’t handle it. (This is anecdotal, but our apps in RoR test apps were noticeably slower). ActiveRecord amazed me, until I found LLBLGen Pro. RoR just felt like a nicer ASP 3.0 or PHP, but still behind .Net/Java.

Make change

refresh web page

oops, still didn’t work

repeat

That process is ASP 3.0 development.

This past weekend we did an complete overhaul of our backend to handle our larger file sizes and our new e-mail system. We also added Ajax support with prototype.js and magicajax. The upgrade took about 4 hours to run(2 months of developing/testing behind it).

When everyone came in on Monday they had an instantly reponsive Ajax application that they “Ooohhed” and “Aaahed” over, along with a new UI (which is all the employees really care about).

And it’s all written in .Net 1.1 so I could switch over to Mono and run it there for my web stuff. It’s actually something that stops me from moving to 2.0 because I want the option to cut back on licensing fees if I have to.

Could I have done it in RoR? Of course, but why? I work with multiple developers and compile time checking of everything is essential to speed development. I can do complex unit testing with mock objects/interfaces. I can even do complex multi-step UI testing. All with an incredible IDE to make things go even faster.

RoR is fun for the .Net/Java guys because it’s different and they’ve most likely never taken on a serious project in a scripting language (like PHP, ASP, or Ruby) where multiple developers must work together. It’s hell.

Chuck

Comments are closed for this entry.