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.
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.
Ah, right, I was talking about "Agile Web Development with Rails" from the Pragmatic Programmers, which you can find online as a pdf:
http://www.pragmaticprogrammer.com/titles/rails/
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:
http://www.ruby-doc.org/core/
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):
http://api.rubyonrails.com/
and occasionally I've found some good help on the wiki:
http://wiki.rubyonrails.org/
Hope that helps! Have fun!
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.
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 http://joelmoss.info/switchboard/blog//2035:Developing_faster_with_Rails and let me know what you think.
Should I switch?
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.
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.
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.
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.
Hey,
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 :)
Hii,
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?
@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.
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?
@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.
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.
@Dicky
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.
@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!
Hi,
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.
@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:
http://www.pragprog.com/titles/rails2
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.
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 ?
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...
Jesse,
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
liquidplanner.com 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!
Thanks!
Jim