PHP vs. Ruby on Rails. An evolutionary story of a Web Developer and his tools.

by Nathaniel S. H. Brown

A comparison between the #5 language (ranked popularity by Tiobe on Jan/07) and the #1 framework (ranked lovability by me!).

71 Comments

Jon
2007-01-17 04:41:32
It's funny that you say you became a supporter of Rannotate. When you registered railsmanual.org and set up rannotate there, you *forked* the documentation and basically killed any momentum that might have ever built around the rannotate system. The creator of Rannotate asked you not to fork and you ignored his requests. How does that make you a supporter?
Anonymous Coward
2007-01-17 04:51:13
Rails has and will continue to be imitated as it has already been in nearly every language. Whether it's PHP (PHP on Trax), Java (Sails), Perl (Catalyst), Python (Turbo Gears, Django), and even .NET (Castle)

Catalyst is older than Ruby on Rails. Development of Django and Ruby on Rails started roughly in parallel, see the Snakes & Rubies talks, so not everyone is copying RoR just because they use the MVC and ActiveRecord design patterns.


You're also comparing apples and oranges. PHP is a programming language while RoR is a framework for the programming language Ruby. You should've compared RoR to another framework like Symfony, CakePHP, ... you name it.

JeffG
2007-01-17 05:30:36
@Jon: It's also funny that he mentions meeting Rasmus at a PHP conference he helped organize. What he neglects to mention is that he ended up alienating most of the speakers that came because he did not clearly state that the event was for profit and not sponsored by the local user group. Nathan has a long history of alienating people in the Ruby and PHP communities in Vancouver with his attempts to monetize open source.
Danno
2007-01-17 06:18:31
PHP is totally not functional. It's procedural.


Ruby is more functionally oriented than PHP.


2007-01-17 08:44:42
I think the editors at O'Reilly could have done a better job on this piece.
Mark Haliday
2007-01-17 09:02:42
Thanks for the article. Its always interesting to read about other people's experiences. I also like Ruby, but I also like Python. Python has a much richer library (at least for now). Ruby has Rails though.
Jayanth
2007-01-17 10:03:19
I think it is foolishness that people compare frameworks or programming languages, as owners of the software world, we should look at creating frameworks, that my granny can use by typing in English or any other language rather than sing praises of a certain framework or language. Till then we are all seekers, not people of a certain community alone. However nice job on bringing RoR closer to people, to make the dream possible.
pcdinh
2007-01-17 10:07:19
I think that ActiveRecord is good because it is better than DAO when it comes to scripting languages. It is also proved more flexible and easy to use than heavy-weighted ORM solution when it comes to agile languages. However, IMHO, Ruby on Rails becomes cool in its approach to Front Controller and Router convention.


Zend Framework, SolarPHP Framework learns from RoR the Front Controller and Router ideas but the core developer find that ActiveRecord is not perfect as many people think. Almost Ruby on Rails apps are simple CRUD ones with fancy Ajax interface and are hyped by marketing crowd. It says nothing about RoR ability when working with complex solutions.

Nathaniel
2007-01-17 10:26:24
@Jon: I really am at a loss for words if you believe using an open source project such as Rannotate for the general benefit of all can actually hurt the momentum. If you look, you will see yet again that rails.outertrack.com has crashed, and nobody is able to use it. The same reason why I started it in the first place. Ensuring that I can use it when I need to.


@Anonymous Coward: The imitators have taken the some if not all of the same chocies and implemented them in their respective frameworks.


The illustration of Apples and Oranges may not have as clear as needed for you, but that was the point of the article. To point out for those asking the differences between Ruby on Rails and PHP, and that they really can't be compared directly. I did however result in comparing PHP on Trax with Ruby on Rails?


@JeffG: I don't think we need to bring up how I was treated by the board members to result in my taking a stance and refusing to be overpowered by a few finger pointing board members that had to have it their way or else.


@Danno: My point is that the entire PHP library is accessed using functions like "str_replace('here is my string', 'string', 'replacement')", while Ruby's library is accessed using methods of Objects like "'here is a string'.gsub('string', 'replacement')".


@Anonymous: This is a blog. There are no "editors".


@Mark: I have been meaning to get into Python and check out Django. As much as I say that Rails will likely only be replaced by a cousin in the same family, each of the other frameworks I mentioned have very different approaches in some respects. Would be great to see cross polination between all the camps. There are many great concepts which are isolated to each framework's own implementation that would be great to see factored out into new Patterns that can be digested and reimplemented by the other frameworks without having to get dirty learning a new language and mess with the code itself to extract.

Nathaniel
2007-01-17 10:36:51
@Jayanth: You really hit the mark. This was indeed my goal when starting to write the PHP layer I mentioned, and still is. To create simplicity. So much so that it no longer requires "code" to create applications. DabbleDB here in Vancouver did a great job of showing that this is possible to some degree, but needs to take it the next level. The dream is that anyone from all walks of life can create applications without knowing how to program. Ruby on Rails and other frameworks in tune with its principles are one step closer to making this a reality.


@pcdinh: Rails is about removing the much discussed 80% of repetitiveness, and leaving the remaining pieces of true customization to the programmer by having open ports such as Rails's ActiveRecord Model.find_by_sql within the framework. These ports allow you to go your own way when the inherited opinions either need enhancement or differ from your own. Whether you are building a small app or a large one, the same principles and rewards apply.

Walfredo
2007-01-17 11:28:18
People who enjoyed this article will probably also get their kicks with this guy's Cleaning the Air
Kevin Clark
2007-01-17 11:49:53
This might be the longest post with the least substance I've read in a long time. Why would you use this space to tout your history? How did you get post access on the O'Reilly Ruby Blog? What are you contributing to the community?


Oh, and Perl != PERL (you spell it both ways).

Nathaniel
2007-01-17 12:08:14
@Walfredo: History lessons are fun :)


@Kevin: Thanks for sharing.

Josh Susser
2007-01-17 12:09:57
My point is that the entire PHP library is accessed using functions like "str_replace('here is my string', 'string', 'replacement')", while Ruby's library is accessed using methods of Objects like "'here is a string'.gsub('string', 'replacement')".


A functional language isn't a language that has functions. It is a language that has the capability to manipulate functions using higher-order functions, like LISP or Haskell. What you are describing is in fact a procedural API, not a functional one. How can you write an entire post about PHP and not even know the fundamental classification of the language?

Kevin Clark
2007-01-17 12:10:36
@Nathaniel: No really, I'm curious now. How do you justify your place here? What are you doing for the Ruby community?
Nathaniel
2007-01-17 12:21:16
@Josh: You clearly know more about the classification of languages than me. Thanks for clarifying.


@Kevin: I'll leave it up to you to find out for yourself and form your own opinion.

srbaker
2007-01-17 12:35:38
This is Nathaniel's modus operandi. The people who linked me to this described it as a "career suicide note," and they couldn't be more accurate. The O'Reilly Ruby Blog is the only public place he's still welcome: he's no longer welcome in the PHP community; he's alienated himself in the same ways from the Rails community; and he's well known by the geek community in Vancouver for the things he's done.


He does this occasionally, and the effect is usually the same. The problem is: he's a poor programmer, and a worse writer, and he doesn't realize either. Until he realizes that these posts don't *help* his reputation, the rest of us have a source of amusement every few months when he gets hungry and tries to sound important in public.

GI
2007-01-17 12:49:00
I'm wondering the same thing as Kevin. Just what ARE you contributing to the community? I mean, I know you started out with HTML.... but what are you doing with Ruby now?
Nathaniel
2007-01-17 14:16:45
Seeing as I am being interrogated to the 3rd degree. Can I ask one simple question. This was supposed to be a simple story of one developers evolution through programming languages.


What has this turned into? Actually, let me answer that myself.


Me proving that I have contributed enough to even be heard, and tell a story. This wasn't a scientific evaluation of Ruby on Rails compared to PHP and it's frameworks. It was an article written on my pure overall experiences with the languages, and what has become of it.


This intense negativity I am feeling from liars such as Steven Baker (srbaker) who are ready to crticise everyone from his boss, to other speakers (which I described in detail in my previous post that Walfredo mentioned above) at one of the events I organized, his words should not and actually do not mean much to me. But that is not to say others won't believe in his destructive attitude he carry's with him.


What have I contributed? Nothing at all it seems by Kevin's measure. But hey, that's not going to keep me from trying :)


Now please. I beg of you. Stop with the negativity already. This world has enough war going without the public tearing apart an honest story of one man's path.

Kevin Clark
2007-01-17 14:32:27
I understand your defensiveness, but realize you still haven't answered any of my questions. *shrugs*
Paul Annesley
2007-01-17 14:53:30
Thanks for the article. I think some commenters need to remember that they're not being forced to read anything.


In your first syntax comparison, you've used the (much nicer) Ruby array literal syntax in your PHP snippet. It actually made me stop and wonder if PHP had quietly slipped support for this syntax in a recent release... alas no.

Nathaniel
2007-01-17 14:58:33
Really not sure why I am doing this. It serves no purpose what so ever. But for the sake of people that may find this post and benifit from the projects... here we go:


http://svn.toolbocks.com - Complete repository of all my open source projects I have created or co-created
http://slidewheel.com - Slideshows from some of the presentations I have done
http://datebocks.inimit.com - Intuitive Date Input
http://railsmanual.org - Sponsoring the hosting overhead and time required to maintain and secure it
http://canadaonrails.com - Put on the first conference for Ruby on Rails (this is a business venture, but still requires effort)


This is by no means a list of achievements. I am still trying to contribute something which I personally consider of paramount importance to Open Source. I continue to do what I can, as I report on my blog, and am pleased when not torn apart, to be able to share some of my experiences doing such here.

GT
2007-01-17 15:34:34
So... you created active_merchant? After all, it's in your repo. Whose the liar again?


P.S. - It's benefit, not benifit.

Anon E. Mouse
2007-01-17 15:35:06
Just to clarify, just about nothing in that repo is Nathaniel's creation or "co-creation." Maybe all his OSS contributions are in there, but most of what is in there is not his. It's the classic square-rectangle issue (a square is a rectangle but a rectangle is not necessarily a square).


The only thing that appears to be actually his is DateBocks.

Mike C
2007-01-17 15:39:10
Man, I can't believe people are so vicious. I followed a similar path in learning to code, and reaping the benefits of new tools in small little leaps and bounds. I have almost no public-blogging material to share with anyone but I make tons of money off of coding Rails solutions for businesses, and I enjoy reading anything that people (like Nathan or not) have to say about their experiences. Lighten up guys. Not all blog entries have to be perfectly written essays by 'community contributers'.
Anon E. Mouse
2007-01-17 15:42:15
It's not about whether it's poorly written or he has little experience, Mike C, but rather that Nathaniel is a community leech. He takes others work and takes credit for it, messes with user groups, and other sleazy-if-not-downright-wrong behavior.


So whenever he pops his nasty little head up, there are those of us ready with the Whack-a-mole hammers.


The Rails and Ruby communities have embraced the contributions, however small, of many, many newbies -- who act like honest people.

Mike C
2007-01-17 15:50:49
>>Anon E Mouse:


Thats hysterical. It'd probably be a waste of time to dig any deeper, but, if thats true, then kudos to your diligence. The Whack-o-mole comment made me spit out my Mountain Dew in mirth.

Nathaniel
2007-01-17 16:26:14
@GT: It is there as a mirror. I did not claim that I created it, nor is anything at all altered in the README within the file.


To reiterate, the SVN url I posted contains a "complete repository of all my open source projects I have created or co-created". Do your research. Check the README's before you start assuming my false claims of creation.


@Anonymous Coward: Read above. And no, there is more than DateBocks in there if you opened your eyes and actaully took a look ;)

Walfredo
2007-01-17 18:28:29
These two recent posts from comp.lang.ruby


an apology


and


the recognition of the apology


epitomize the best of an open source community at work. Thanks for showing us the opposite, Nate!

Anon E. Mouse
2007-01-17 18:55:12
Pointing out a bug, and/or hacking on your own branch, is not "creating or co-creating." It's at best a derivative work.


You did not create ActiveMerchant nor, for example, the Flickr plugin for Mephisto. Nor did you "co-create" them. I'm sure the authors of both these two example OSS projects would find it very intriguing to see you claiming such credit. Leaving a post on someone's blog saying "Hey I made a bunch of changes" is not "co-creation" either.


But, to your thinking, that's probably just a by-product of the very open MIT license. Right?

Nick
2007-01-17 21:11:32
Nathaniel,


After working with Ruby on Rails for about 4 months, I have found railsmanual.org very helpful and it has always been one of the first places that I look when I am trying to figure out why a form helper isn't working the way it should be. Thank you for your efforts! It can be hard to get the specifics of what can and cannot be done with rails helper functions. railsmanual helps but there are a lot of times that I wish there was more reference material about the Rails framework. I'm looking forward to Rails in a Nutshell, which is probably the book I need the most for my day to day development with RoR.


I didn't even know that the site was generated by Rannotate, but I don't see anything wrong with forking a project when it creates something that is beneficial to the Ruby on Rails community. There needs to be a much greater emphasis on easily accessible documentation and in my opinion it really shouldn't be about putting out your ego as much as it should be about actually producing helpful information. Looking at the caboo.se page that gives out props to everyone who has contributed towards such a noble cause is great, but it doesn't mean very much if caboo.se can't figure out how to make that money useful with regards to producing solid documentation.

Nathaniel
2007-01-17 23:26:11
@Walfredo: Trust me, I would apologize if I felt I was in error. Steven Baker unfortunately did not tell the truth about what happened. I gave every _single_ speaker what was promised, and hopefully more. Simply ask each one of them. Why would I treat Steven of all people, the guy I was having doing a workshop with, less equal than those who were only presenting at the event? Doesn't make sense to any extent. Any it simply isn't true. He lied about me promising him compensation, and continues to avoid showing any evidence which he claims are within chat logs of me promising anything different than what was delivered.


When it comes to RailsManual.org, it is a public resource, one which I should, and actually will credit the source code which generated it. I in no way claim credit for the project, nor have forked it in any way shape or form. It's simply a tribute, a testiment, nahh.. a monument to the work that has been done on the code. In a simple analogy which I see as the reason why I now have decided to give credit back. I see a link to rannotate as something of a plaque at the bottom of a structure which was built in it's honor. The purpose does not change in the least. It's a tool for me to continue to reference and learn the Rails library.


@Anonymous Coward: Again, before you go assuming away, do your research. Email Paul, ask him if I put up my modified version of the code up there so he could merge it into his own project. Purely so that there was no fork.


And as I said before, my copy of ActiveMerchant within the repository is simply a mirror. I have not claimed any credit, and simply want to be able to access it when I need to for future projects. When I checked in the code, there were issues with the original SVN otherwise I wouldn't have done it in the first place.


@Nick: Thanks for your kind words in a clout of disgust. I will do my best to continue ensuring that railsmanual.org stays up as and be as stable as possible. BTW, I haven't forked it either. I am using the same code that is in trunk right now. I may have modified the theme a bit, but nothing functional has changed :)

Inglesh Speelar
2007-01-18 00:04:02
Wow. I hope you were very drunk when you wrote this. There is not a single paragraph without a multitude of spelling and/or grammatical errors. Not one. Posting without proofreading, or at least using a spell checker, doesn't do much to improve the apparently horrible reputation you have in the community.


Then, of course, there is the lack of congruency, the factual errors, the veiled whining. Remove those and all that's left is a jumble of merit-less fluff that has no actual meaning or worth.


Come on, a LOC comparison? How 2004. We get it already. RAILS SI LESSAR LIINEZ!!111 Big deal. If you're going to go on at length and bore us with the inanities of how you became a PHP haxx0r, at least compare something real. Give us some sustenance with which to fill our brains after demolishing them with triteness.

Philippe Lachaise
2007-01-18 02:30:39
Your story sounds familiar to me :


When PHP semmed to be the only game in town as far as Web dev was concerned I did develop my own PHP framework (RefleXiveCMS).


Fighting with the language, I did my best to remove naming clashes, #include madness and many other PHP's irks.


This went to the point that I couldn't bear the idea of using PHP outside my framework. Not very useful when the user community is reduced to oneself !


"When you can't beat them join them" was my instant feeling when I stumbled on RoR.


Throwing away something you've created and worked on for one year is hard but, all the same, no looking back.


As for the clones, I believe we must look forward to stable JRuby or RubyCLR implementaions but I agree Ruby is what makes RoR what it is and clones will never gather a signifcant community.

Manuzhai
2007-01-18 03:49:24
Your PHP code, above, is wrong. PHP has no syntax for specifying an array as [1, 6, 9], instead you have to call the array() function (I was very surprised to see this code, thinking that I had missed some very nice PHP syntax, but I tested it on my PHP 5.1.6-enabled webserver and it didn't work).
Greg
2007-01-18 08:44:42
Nathaniel,


Comparisons are only helpful when they teach us something, rather than simply show the contrast of one thing from another.


Also, this article would have much less noise if you cut down on the personal back story. As it stands, this is more of an opinion piece than an article, which is okay, but please file it that way.


JB
2007-01-18 08:56:45

# Ruby:
array = ['my list', 'of', 'items']
array.each { |item| p item }


# PHP:
$array = array('my list', 'of', 'items');
foreach ($array as $item) echo $item;


Ruby wouldn't look so impressive if you didn't write PHP like a retard.

Michael
2007-01-18 09:09:43
as others have mentioned your php code is a little bit screwed up... Maybe this would be a nicer comparison (that actually works):



$array = array('my list', 'of', 'items');
foreach ($array as $item) {
echo $item;
}

Nathaniel
2007-01-18 09:57:17
@Philippe Lachaise: Sounds like more details of the same story :) Although, I do find myself in the same situation now with Rails. At least with respect to the ActiveRecord gem.


@Manuzhai: My apologies. I have updated it accordingly.


@Greg: I remember looking at both categories and flipping a coin which resulted in classifying it as an Article. In hindsight, this does feel more like an opinion piece than an article. Thanks.


@JB: Looking at the alternate version I put up just for you. Ruby still seems nicer. Maybe not by the magnitude originally portrayed, but still nicer none-the-less :)


@Michael: Thanks! Reminds me again just how much I love objects such as Array.

Walfredo
2007-01-18 09:59:20
>Trust me, I would apologize if I felt I was in error.


I'm not sure what you're talking about, but it sounds like the back story behind this article and the other one is perfect for the O'Reilly ruby blog.

srbaker
2007-01-18 10:34:05
I keep getting accused of being a liar, and it's really unfortunate. What's interesting is that no matter how many times Nathaniel says it, I haven't noticed his accusations affect my ability to find work or support my family. This is nothing but a big source of amusement for me.


I'm not the only person in the Rails community that won't work with him. Wait until the CoR Toronto speaker list comes out, and see how many repeat visits he books with speakers from CoR Vancouver. And I'm sure it's more than just a coincidence when we were looking for a place to host our Vancouver Ruby Brigade meetings, two venues asked us "You're not affiliated with Nathaniel Brown, are you? Because if you are, the answer is no."


It's been brought up here by others, but Nathan keeps side-stepping the facts: He's no longer welcome in the PHP community, he's no longer a welcome figure in the Ruby community. He should know why, he keeps getting asked nicely to stop exploiting people. He keeps continuing to cash in heavily on the sweat of others. Every ecosystem has its parasites, I suppose.

srbaker
2007-01-18 10:39:58
Walfredo: the back story is, he's hungry, and he's tryng to sound profound and drum up some attention again. Unfortunately for him, he (once again) drummed up the wrong kind of attention.
Simon Willison
2007-01-18 10:57:29
Minor correction: Django is not an imitation of Rails - it started development (in a closed source environment) in late 2003, but was not open-sourceed until some time after Rails had been released. That's not to say that there aren't some features now in Django that were inspired by Rails, but it certainly isn't Just Another Rails Clone.
Nathaniel
2007-01-18 11:03:14
@Walfredo: I was speaking of my character. Ironically enough, you can see even in the comment above me apologizing in error. Those who know me, know that I am an honest person and simply do not respect those that lie.


@Steven: Regardless of your position, I am actually very happy I have not hurt you or your family. My words are meant to enlighten others of your character, and allow them to tread with caution when dealing with you, if they do choose to do so.


And regardless to what you may have heard, all of the speakers from the original Canada on Rails conference I have asked have expressed interest in returning to Toronto this fall. David may not be able to make it out as he continues to turn down speaking at other engagements, but it will provide the void needed for other speakers to step up and shine.


I am suprised to hear your interpretation from the venues in Vancouver. You can't please everyone all the time, but the venues I have worked with in the past I continue to work with on a good standing and will continue to do so. So it must have been something personal and likely trivial for them to say something like that, if you are in fact telling the truth.


The few within the PHP community that you may speak with, have their reasons. And I have mine for not dealing with them. This is a mutual separation, and as unfortunate as any separation, I am thankful that it happened. Otherwise I wouldn't have opened my eyes to see Rails when I did.


As for the Ruby community, and for everyone elses sake. Speak for yourself and stop forcing words out of peoples mouths.

Greg
2007-01-18 11:11:20
Nathaniel,srbaker is right in saying your reputation in the Ruby community is not exactly stellar.


Rather than continuing to be so defensive, perhaps you can listen to what people are saying and if you do care about what the community thinks of you, try to learn from these experiences.


It does seem like some folks here are just stirring up bad blood, but why not take the high road and *show* your worth to the community, rather than just telling us how much you've done for us.

Anon E. Mouse
2007-01-18 11:19:40
Speaking of conferences... Nathaniel has perpetrated one of the most classless "tech event" behaviors I've ever seen. He hired "actresses" (escorts? straight-up hookers?) to handle the event registration and trounce up and down the aisles with the contest prizes.


It wasn't only those of us in the front row who could see your hungry eyes, Nathan. And it was disgusting.

Jon
2007-01-18 15:42:02
>@Jon: I really am at a loss for words if you believe using an open >source project such as Rannotate for the general benefit of all can >actually hurt the momentum. If you look, you will see yet again >that rails.outertrack.com has crashed, and nobody is able to use >it. The same reason why I started it in the first place. Ensuring >that I can use it when I need to.


It's not just SOFTWARE you took, Nathaniel. The point of the outertrack site was to be THE place for annotated rails docs. If you split and create another place for them, you're diffusing the effort.


I'm sure the outertrack site is down and unstable now because the effort has been all but ruined by your fork.


I don't really have to explain this to you, though. You knew what you were doing. The purpose of railsmanual.org is to link to your commercial web sites in an effort to make money. It has NOTHING to do with supporting the community.


You truly are a community cancer. What would it take to get you to move on to Java or .NET (or COBOL or something)?

Teh Hrepe
2007-01-18 16:17:26
@Jon, I'd say he's more like a wart on the genitals of open source. He's not really killing us, but he's painful and makes chicks not want to sleep with us.
Miscellanious Silly Person
2007-01-18 17:36:40
Hurray! A flame war! Now we are all being professional!
Inglesh Speelar
2007-01-18 17:41:46
Uh, that's miscellanEous, bro. Is that you, NHBS?