Coding with Jesse

Switching from PHP to Ruby on Rails

November 30th, 2006

Normally, I try to avoid server-side programming topics. But this time, I thought I'd share my story to perhaps inspire some of you to try something new.

I switched to working in Ruby on Rails this month. Lots of people have done the switch, and even more have written about how Ruby on Rails makes coding web sites a lot more fun and easy (it's true!). But that's not what this story is about.

Until I switched, I was a PHP programmer. It's not just that I did a lot of work in PHP, it's that this is what clients expected of me, or so I thought.

Unfortunately, I was getting really bored of doing PHP programming. I've never been passionate about PHP, it's just something I know that I use to get the job done. Code Igniter had gotten me excited about coding in PHP again, but it just wasn't enough.

I've had a lustful eye on Ruby on Rails since I first heard about it a year or two ago. Yet it stayed on my long-term To Do List, never quite becoming a reality. "When I have more time, I'll figure it out and start using it," I thought. "One of these days I'll do a small project for myself in Rails so I can learn it," I told myself for months.

I felt like I was stuck. PHP was what I knew, what I had used for years, and what I was best at. I had never used Rails, so I certainly didn't feel qualified enough to sell myself as a Rails developer. On top of this, I had three major projects coming up that were all supposed to be done in PHP.

Then one day, I asked myself why I was so willing and excited to work in JavaScript but not PHP. Why is one fun and the other painful? I had always thought of the difference as just client versus server, but then I figured out it might just be the language itself. So I decided the only way to keep my sanity was to switch. There was no way I would keep doing this PHP thing.

So, I got in touch with my clients and asked if they'd be willing to build the projects with Ruby on Rails instead of PHP. They couldn't care less. All they wanted was the finished project, and it didn't matter to them how it was done. One client even said the only reason she had mentioned PHP was because it seemed like the most common, but really didn't care. They didn't even mind that I was just starting to learn, because they knew it would make the project more fun for me, and they trusted me.

So I did it. I've been coding in Rails since the start of the month, and it's been a great time. Sure, there was a learning curve. It took me some time to figure out how to do the simplest of things. But I read through the book, I experimented, I searched the web for answers, and now I'm cruising. I'm about 80% as good in Rails as I am in PHP, except with Rails everything takes half the time so in the end it's actually faster.

So what's the moral of the story? If there's something new you want to start doing, or if you're getting bored, just go change things. Today. Create your own opportunities. And stop finding excuses in those around you for your inability to change, because there's a good chance they will totally support you.


1 . Joel Birch on November 30th, 2006

Joel Birch

Very interesting - I'm trying to do the switch too. When you mention that you 'read the book', which book are you referring to? The pickaxe book? If so, isn't that book about the Ruby language itself and not Rails so much? Do you have any other tutorial or resource recommendations?

Thanks for this post, I am so close to following your lead.

2 . Jesse Skinner on November 30th, 2006

Jesse Skinner

Ah, right, I was talking about "Agile Web Development with Rails" from the Pragmatic Programmers, which you can find online as a pdf:

I haven't read a book about Ruby (although this book has an Appendix on Ruby), but I have read over the documentation a lot at:

And once you're really working with Rails, you will certainly want to reference the API documentation (terrible for learning Rails, but excellent for looking up functions you already know about):

and occasionally I've found some good help on the wiki:

Hope that helps! Have fun!

3 . Joel Birch on November 30th, 2006

Joel Birch

Fantastic! Thanks for the links and such a quick response. "Agile Web Development with Rails" does look good.
I found your site via Emil's recent blog post and I'm loving your content. Cheers.

4 . Joel Moss on December 1st, 2006

Joel Moss

Great article Jesse. I have been debating the switch for ages now, but I still can't see why Rails is better, and why I can't achieve the same thing in PHP.

Please read my blog post at and let me know what you think.

Should I switch?

5 . Anand on January 3rd, 2007


Great post! You have taken the words right out of my mind. I'm in a similar situation as you. And I also found Code Igniter to be excellent, but not that comprehensive and somewhat lacking in features. Right now, I'm mainating a CI based application as well as moving toward learning Rails.

6 . Chris on January 18th, 2007


Jesse, thanks for your insight. I am just getting ready to pick a framework and, like you, have had my eye on Rails for a while, but am a PHP/Lasso programmer. As such, I have been looking at Code Ignitor, PHPCake and Symfony. So far Cake has my attention.

I am wondering if you have further insight into what it is about Rails that won you over? Specifically what does it do that others (Cake, CI, etc ) don't?

Thanks again.

7 . Jesse Skinner on January 18th, 2007

Jesse Skinner

There's a lot of overlapping functionality and features between Rails, Cake, Code Igniter, Symfony and any MVC framework. I'm not very familiar with Cake or Symfony, so I'm not sure what they offer. I do really like features in Rails like migrations, Active Record, generators, development/test/production modes, plus some of the features in the libraries like built-in validation in models.

But I think what really sold me is the Ruby language itself. Ruby is an infinitely better language than PHP in the way it handles OOP, closures, regular expressions, as well as the syntax and data type functions.

I've started to realise that PHP still has a place in the world. I'd never build a simple web site in Rails. It would be overkill. Rails is great when you have a complex database, but for a simple site with limited functionality (ie. contact form, guestbook), PHP is much easier.

8 . Anil Philip on March 9th, 2007

Anil Philip

If there's something new you want to start doing, or if you're getting bored, just go change things. Today. Create your own opportunities. And stop finding excuses in those around you for your inability to change...

this was the takeaway for me. Thank you for an insightful comment.

9 . Jeff on September 9th, 2007



I found this blog post on a google search. Thanks for the writing it - it was informative to me and also inspirational. I've been apprehensive about trying RoR for the same reasons you mention. I think it's time for me to take the plunge :)

10 . Mike on October 15th, 2007



I've been using PHP for almost 4 years now and just a month ago I took a look at RoR and followed both the blog and flickr tutorial and really liked what I saw. Now I've read somewhere that all RoR web apps that are build by beginners usually contains a lot of garbage code. Is this just a myth? because I have a big project coming up and I can't wait to build it in RoR. What do you think?

11 . Jesse Skinner on October 15th, 2007

Jesse Skinner

@Mike - I found that there are a lot of really cool, slick, fast ways of doing things with Rails, most of which are totally not obvious. Probably the best way to learn these techniques is by reading books about Rails before you start programming. But of course, those who have more experience with Rails are going to write better, smarter code that takes advantage of all that Rails and Ruby have to offer.

12 . Alec on December 17th, 2007


Three questions:

1. How hard is it to switch to RoR if

- You don't know Ruby
- You don't know OO

I've written very complex stuff in PHP, but mostly procedural.

2. Does RoR mean you don't have to work in JavaScript since it generates that?

3. ORM or ActiveRecord is not as efficient performance-wise as a database proc. Can one continue to use those database proc's?

13 . Jesse Skinner on December 17th, 2007

Jesse Skinner

@Alec -

1a. You'll have to learn a whole new language. It's not a very hard language, but some concepts can be very tricky to understand at first.. and like learning any language, you'll have to look up basic functions, like how to work with strings and arrays, for the first few months at least.

1b. Ruby on Rails is entirely OO based, so you'll need to understand the basics of OO, at least constructors, instance variables, inheritance, parent objects, methods, etc. This stuff isn't that difficult really, but it isn't obvious either.

2. You can get away with not writing JavaScript if you want to do some simple things, but it won't do everything for you of course. And personally I'd rather do my own JavaScript than have it generated for me (but JavaScript is my expertise).

3. I believe you can write direct SQL as much as you want, though I'm not sure how much extra work this would be.

14 . dicky on March 3rd, 2008


Hi, i had go through a lot of article comparing RoR and PHP. I just want to ask 3 very simple questions. If i am a newbie to web programming (knowing little bit about PHP, HTML, CSS, and Javascript, but not RoR), which language should i choose?

The second question is, i want to create a simple web application for user to share something with simple login/database, which language is most suitable to do so?

The third question: I had go through the introduction of "Agile Web Development with Rails", but is it suitable for beginner? Or at least i need to know the basic of Ruby language?

Thats all my question, hope someone can answer me...Thanks.

15 . Jesse Skinner on March 3rd, 2008

Jesse Skinner


1. Well, you can learn anything you want really. If this is just something you're learning in your own time, then I'd suggest sticking with whatever you are most excited about. Explore PHP, explore Ruby on Rails, and use whichever one you enjoy working with more.

2. I'd personally go with PHP and Code Igniter over Ruby on Rails for anything considerably simple.

3. The Agile Web Development book(s) are aimed at people with little-to-no experience with Ruby or Rails. They assume you'll learn the Ruby language as you go (which you will). If you're new to programming this might be harder of course, but if you already know a few other languages it's not that hard to learn another new one.

16 . dicky on March 3rd, 2008


@Jesse: Thanks for your comments. I am a .NET programmer and now i am looking chances to got for web programming. Hope i can enjoy learning CodeIgniter. Thanks again!

17 . Summer A. Munir on March 4th, 2008

Summer A. Munir


My question is very simple and i think may be a very common one. Lately i had to leave my job and since then i am virtually doing nothing. Thought it would be better to learn programming. I got NO previous programming experience. Although i am roughly familiar with certain programming concepts: i don't know CSS, PHP, VB, C# or any such thing. All i know to some extent is that logic prevails in computer sciences. However, at the same time i got sufficient user level exposure to state of the art softwares used in the banking sector. Question is: how long should it take for me to reach from point 0 to a professional programmer. Would it be months or years. I just want to earn some money and pretty desperate about it. Lately i've figured out that i am a kind of person who would prefer to sit alone and get his job done in front of a speecless computer:). Can you give me the timeline please and the best way to learn RoR? Thanks.

18 . Jesse Skinner on March 5th, 2008

Jesse Skinner

@Summer - It's impossible to say how long it will take you to become a professional programmer, and even amongst professionals there is a wide range of skill and experience. It all depends on how quickly you learn and how much time you devote to it. That said, I don't think it would be unreasonable for someone to go from 0 to professional within a year if they really worked hard at it.

As for learning RoR - the best way I know of is to work through the Agile Web Development book:

19 . Summer A. Munir on March 6th, 2008

Summer A. Munir

Thanks for your kind support. I think i should start with 4 hours a day. Let see where it goes. I will definitely go through the book suggested by you- it definitely seems good to begin with. Thanks once again.

20 . Aurelijus on March 17th, 2008


Why are you comparing programming language and framework ?

By the way, what can you do with Ruby (programming language, not RoR framework) that you can't do with PHP ?

21 . kertz on May 25th, 2008


you're right... its stupid to compare PHP with RoR. PHP is powerful enough to do anything on web if you know it well... Tell me one good RoR application that works...

22 . Jim on July 17th, 2008


I have been in the networking world for some time (mcse) and moving to the ROR dev world. I have an app I would like to develop and market, I found various online video tutorials etc, it looks great.
The question I have, which may be slightly ignorant, is this:
I see how all the code works, querying the DB and displaying results etc, but how do you make it pretty? lol is a good example, all ROR, and looks great... Am I going to have to learn another IDE or CSS to get the overall feel of the site I am developing!


23 . Ravi Sagar on September 16th, 2008

Ravi Sagar


I am also learning RoR. The book you mentioned doesn't go along with RoR v2.

Can you also suggest some projects to work to grasp most of the useful features of RoR?

24 . nice designer on October 2nd, 2009

nice designer

Hi Jesse,

now after almost 3 years, I guess you're programming with RoR. Just wanted to ask you do you still like it? How did it help you? Did you learn the guts of Rails? I was looking for a good tutorial about the guts of the guts, so I was thrown here :) Fell free to email. Tnanx!

25 . Jesse Skinner on October 6th, 2009

Jesse Skinner

@nice designer - actually I haven't personally used RoR for over a year. Ended up using PHP with CodeIgniter as my platform of choice. More on that here:

26 . Salil on January 18th, 2010


If your goal is better programming, you will learn far more from reading high-quality code bases in your current languages than from a new language. Go read top-notch code in the languages you know already; it’ll teach you techniques and style quickly, plus different ways of thinking about problems, with the added bonus that you can actually use what you learn. You can also understand a lot about programming languages in general (issues like typing, scoping, functional vs. imperative) by reading a good book.


27 . Yogesh on January 21st, 2010


Hi Jesse,
I hav worked in J2EE for almost ! yera.
Now I want to switch to Ruby, but before that I want to be assure that there is future in Ruby.
hat you think about the future of this technology

28 . sakhunzai on February 24th, 2010


Good to hear !

The problem with php is that non of the frameworks(php) provides a complete and consistent set of tools and techniques which could be re-used in other programming sphere.
ROR is good choice , it gives what u need and it mature , it has great help and docs .
I ask myself , if I learn that framework, will I able to use that knowledge in some other domain ? Non of the php frameworks provide satisfactory answer .

29 . SalmanK on March 19th, 2010


Wonderful article, thanks for inspiration. Ive just started learning JS and cant wait to move up to Ruby on Rails. Goodluck.

30 . Dan on May 31st, 2010


This was a great article, thank you for writing it, this is actually the first time I have wanted to express my opinion in a forum so congratulations and sorry for any bad spelling.

I will mainly talk about Ruby vs PHP and then give my personal recommendation, for web development, PHP or RoR. Sorry for the length of this comment and I hope this will be useful for other web developers, I guess this is as long as the article itself.

First off and probably a little socking to some people is that PHP, JAVA and C++ are not actually object orientated languages, or at least not purely.

A purely object orientated language must not contain primitive data types, like "int" in Java, C++. Also multiple inheritance must be able to be performed, on classes and interfaces, which in most apparently object orientated languages this cannot occur.

Ruby is one of the only programming languages that is truely object orientated, everything is an object, even basic data types.

Ruby is a more expressive and more of an agile programming language, and was created from the start for this purpose, such that less comments and even documentation need to be created in order to explain the code or concepts within the code.

From a hackers perspective PHP is the most security flawed main stream web scripting language due to the inherent flaws of the language. Attacks such as SQL injections are nutorisiously easy to do in PHP, even if sanity checking has been done, which is partly due to how magic quotes work and how statements are created.

I can't remember the name of the group that did it, if anyone would like to know, I would try to find out, but there was one stage not too long ago, maybe a year and a half where one group got fed up of the flaws in the PHP language and for one month they released a new hack a day for the PHP language, which finally after years of scrutiny got PHP developers working on trying to fix the language.

One show of PHP developers trying to fix these issues (such as SQL injections) is the introduction of the PDO objects, which should be used when compared to mysql_ methods. PHP developers only started really fixing the language properly when they were embarrased by the hacks done by this group.

Any method which is prefixed with mysql_ in the PHP library should be avoided where possible to avoid possible attacks.

Though I like the PHP language and have used it for years in some cases, If I was to create a complex application with a lot of database transactions it would not be an ideal choice as databases usually contain alot of sensitive data, though the language is improving day by day now, unless you use the right libraries, you application will have many security flaws.

Ruby is a language I have just began to use, but I can see the expressive power in the language, If you are a single developer, who creates their own web applications then ok PHP is fine to program in (forgetting it's security flaws), but if you program in an Agile way in PHP in a team, the code can become very hard to understand for new and existing developers, since PHP isn't very expressive.

My recommendation would be to avoid PHP if you are working on a site which requires good security (or be very careful of the libraries you use) or if working in an Agile manner in a development team. If the site is going to be basic, then PHP is the better choice of language, but if many database transactions are to occur then RoR would be a faster and more secure route to take, since validation is always done for both server and client side operations, and SQL injections are alot less common, though not unheard of in RoR.

The only downfall is the extra hardware which is required to keep a RoR application running compared with compilable languages (not PHP), but this is helped by the fact that less development resouces are needed so extra money can be spent on hardware anyway.

31 . Rishi Ghan on September 24th, 2010

Rishi Ghan

Hey Jesse,

I am in the exact position that you were (PHP, contemplating RoR)
I desperately want to make the switch and market myself as a RoR programmer. I also keep reading about how the future looks cloudy for RoR and it demotivates me to some extent.
But after reading this, I am making the switch.

Thanks for the article.

32 . Bryan Strader on September 12nd, 2011

Bryan Strader

Nice article, i too just made the switch, but from .Net. Been a week and I am just starting to get warmed up! :)

Comments are closed, but I'd still love to hear your thoughts.