Ask HN: PHP or RoR?

13 points by hansy ↗ HN
I'm a brand new web programmer trying to create my own social networking site and I've been learning PHP and the Drupal CMS these past few days to build my website.

I ran into a developer the other day and he suggested I work with RoR instead.

As I have minimal starting experience with C++, the OOP side of PHP is what drew me (and the fact Facebook also uses it) in the first place.

Now I understand different project needs translates to different languages, but I was just curious what the HN community thinks about the two?

14 comments

[ 3.7 ms ] story [ 47.0 ms ] thread
Try both out and see what you think. Some big sites use PHP like Facebook and Flickr. Here are some sites that use Ruby on Rails: http://rubyonrails.org/applications. That list lists Twitter but I thought they changed so I am not sure how up to date it is.

I personally like Ruby and I like Rails. To me Ruby looks cleaner than PHP and as a result, it gets less messy with lots of code.

Rails is the framework. I love the MVC concept even just for separating my files logically.

RoR is clearly a better language than php from a prgramming standpoint. BUT PHP is perhaps the best supported language on the web. By support I mean platform choices, documentation, discussion, number of programmers, libraries and plugins and stability.

Even though it's the ugly child, you won't go wrong with PHP. It scales, look at facebook. It's where the jobs are.

I hope one day ruby overtakes it, but until then I would vote for PHP.

RoR is clearly a better language

I'm not sure if you made a mistake here, but RoR is a framework. Ruby is a language. RoR shouldn't be compared to PHP. If anything, it should be compared to one of the many PHP frameworks out there.

I agree that there are a great deal of jobs for PHP, but I disagree that "It's where the jobs are." There are a great deal of jobs around for RoR.

Hey, I just replied to what the poster submitted. Sure rails is a platform and ruby is the languge. My arguement still holds, PHP has far more support and ruby is a better language. Same goes for platforms, PHP has far more options and ruby has few. IMO PHP wins because it has more resources. But as a languge i like ruby better. As for jobs, I didn't say there were none for rails/ruby, just that there are far more for php.
I wasn't disagreeing with your argument. I mainly just wanted to clarify a few things for the OP.
To be fair, where I am from PHP jobs outnumber Ruby jobs at a 10 to 1.
I'm not sure that PHP still has the best support. It's true that there are lots of PHP books, but the number is overwhelming and confusing.

RoR has got few resources but they are well done. There are good tutorials and books about RoR. There are good add-ons. And also not a large % of its' developers are just 2 month programmers.

I don't see how the quantity in PHP helps.

Proposing to you a third option: django+pinax. Pinax is a ready to use social networking application using django. Take a look: http://pinaxproject.com/.
"Now I understand different project needs translates to different languages"

This is much less true than you'd think when you're talking about languages of the same class, like Ruby and PHP. (Sorry, Ruby; I didn't mean it that way.) And when your goals are vague ("social networking site.")

The ease of setting up PHP will retard your progress towards understanding the web stack in greater depth, Which is something you'll need to do if you want to become a good web developer. Setting up Python or Ruby with Apache isn't as difficult as you would think it is, given how often the ease of setting up PHP is cited as a reason to use it.

You'll learn better habits and practices from the Ruby or Python communities than the PHP community.

Build a prototype with a few features in both and see which feels natural to you. I like to bang out small, silly projects in PHP with CodeIgniter or FUEL because I can move fast with those. But I find Ruby and RoR more methodological and RoR will handle more intricate stuff for me that the PHP frameworks won’t and will use that combo for bigger apps.
I recommend PHP for what it's worth. Ruby is great but PHP is fast, easy to deploy and common enough that you never need to look far for an answer to your problem or a module to help you out. Rails has gems which are amazing but there are far more PHP programmers.

If you're looking for a framework for PHP I'd recommend CakePHP assuming you're not rolling your own for this.

It is ruby that has the gems - and they are great. You're right on the speed but language speed is rarely a bottleneck for a website.

CakePHP was modeled and inspired by Rails.

Thanks for the clarification. I phrased it that way because OP really is comparing Rails to PHP (ie: he won't pick Ruby w/out Rails over PHP).

CakePHP is an MVC framework similar to Rails but they're pretty different now (details wise, structurally still similar). I prefer Rails to CakePHP in most respects but I still code with cake because I like PHP.

I did PHP and liked CakePHP when I started out. After I did that I looked into both Ruby/RoR and Python/Django. I ended up liking Django much more than RoR. I do a lot of Javascript at one point and the intriguing thing is, somehow Python felt more natural to me. I DID try Ruby and looked at Rails though. I would recommend just testing things out yourself and see what comes more naturally to you.

One can do a lot of goods with PHP, Ruby and Python and any other languages/frameworks. It's not really the language but what you choose to do with it as well as your experience using it that will make your project. The only way to gain more experience is to start using it.

My feeling is, you want to pick something that will solve all your present problems and future proof. That's going to be difficult. Big solutions are usually a combination of different efforts because there are many different parts of the web development process. I've seen a company that use PHP for ALL their flow including the cron jobs' scripts. Some might say, that's crazy, why not use python or faster languages for backend jobs? But it worked for them up until they hit their bottleneck then they reiterate and revised.

The path toward the "holy grail" for the perfect "solution" is long. Crowd sourcing for this answer will also be difficult because many people have already took that journey and fought their holy war with themselves so they will generally give you their preferences up front.

Sorry for the round about way of saying: I think if you are at a point of asking question of what's out there other than PHP? Then you're at a good transitional stage. Congrats. Now your two (popular) choices are: Ruby/RoR and Python/Django. Go test out two sample projects and make it work from setting up to making it run. See which process you like the most and pick one. I don't think you will go wrong with either choices.

Oh, is there a site that you really like or look up to? Perhaps you can learn about their technology stack and give that a try :P

Again, sorry for the convoluted answer and good luck with your journey toward Web Dev nirvana :)