| «« Canada, Pearson and Peacekeeping | Somtum Thai »» |
|
About
I'm Ryan Lowe, a Software Engineering graduate living in Ottawa, Canada. I like agile software development and Ruby on Rails.
I write this blog in Canadian English and don't use a spell checker. Typos happen.
Projects
» Full-time Ruby on Rails freelancer
» Full-time with Rails since May 2005 » Former committer for RadRails (now Aptana) » I also have a few Rails side-projects in development: 1. wheretogoinTO.com Toronto nightlife 2. Hey Heads Up! TODO list and sharing 3. Layered Genealogy family history research 4. foos for foosball scoring 5. fanconcert for music fans (on hold) Hiring Rails developers? I can telecommute by the hour from Ottawa, Canada »» Email: rails AT ryanlowe DOT ca
BulletBlog
Now hosted on Hey! Heads Up -- check it out!
Syndication
Pings
Recent
blog@ryanlowe.ca no more
Forging Email Headers: Good, Bad or Ugly? Sarcastic Dictionary (Part 1 of Many) Tags Hierarchies Twisting Rails is Risky Business Risky Business? My Take on Early Alphas Whoa, it's August 2007 Closing Comments A Postscript to "Growth at the grassroots" An Abuse Trifecta »» All Blog Posts
Linkage
del.icio.us/ryanlowe
technorati/ryanlowe.ca/blog Aurora Roy Jim Andrew Trasker Travis Kibbee Karen Dr. Unk Ayana Van Bloggers Joel Spolsky Robert Scoble Tim Bray Dave Winer Raymond Chen James Robertson Ruby/Rails Bloggers rubyonrails.org weblog David Heinemeier Hansson Dave Thomas James Duncan Davidson Mike Clark Jamis Buck Signal vs. Noise Tobias Luetke Amy Hoy: (24)slash7 Jeremy Voorhis Eclipse Bloggers Planet Eclipse EclipseZone Luis de la Rosa Eclipse Foundation Kim Horne Billy Biggs Ian Skerrett Mike Milinkovich Bjorn Freeman-Benson Denis Roy
Archives
|
Why PHP vs Rails?
Tim Bray's report of the Zend/PHP Conference & Expo is revealing for a few reasons:
I'll just go on the record as saying that during my Software Engineering undergrad degree I saw computer science classes as a kind of necessary evil. I didn't love 'em. The pure CS classes were like math classes. That's not to say the information isn't useful to me now, it was just dry and seemingly impractical at the time. During school I was more interested in where the rubber hit the road: the software engineering of it. To me, Ruby on Rails is directed more towards pragmatic and software-engineering-loving people than computer-science-loving people. I actually don't have a problem with the things that Tim observes about the PHP crowd. Why? Well without trying to sound too "snotty" myself, I think Rails should be used by people that buy into the Rails ideology: The Rails Way. Otherwise you're just dooming yourself to failure, loathing and ignorance. Learning Rails is not just about learning the technology, it's about changing your practises and process too. Some of those practises aren't ingrained in the PHP community like they are in the Rails community. Engineering is all about using the right tool for the job. Sometimes that's a language like PHP, sometimes it's a framework like Rails. That's what it's all about. The fact that the PHP crowd doesn't see ActiveRecord as useful is a great indicator of their priorities ... and there are many, many people who share these priorities. Rails certainly isn't going to solve all of your web application problems. In fact, it's best for small part of the web application problem set right now. Bottom line: If Rails remains a niche framework that's alright with me, so long as the ideology doesn't change. I don't think DHH will ever allow that, so I'm happy. ...and what of Rails performance? Yes, Ruby is an intepreted language. So is PHP. PHP is probably faster. Yes, the Rails framework is young, changing often and unoptimized but it is changing rapidly. It is agile. This is simply a reflection of the different priorities of the PHP crowd and the Rails crowd. One of those priorities is that man hours are more important than extreme performance optimization. It seems to me like Rails is optimizing itself to save man hours at the expense of performance and it's something I agree with. Rails can be to PHP as Smalltalk is to Visual Basic or as Java is to C. Update Monday 1:44pm I know PHP and Ruby are programming languages (and libraries) and that Rails is a framework (and extends the Ruby libraries). So why compare apples to oranges? Because people are doing it and I get asked the question all of the time... so it's a question worth asking to my blog audience. Like I mentioned in the comments, the question itself is revealing. People don't ask about PHP vs Ruby when making a web application because Ruby means Rails every single time. The Ruby crowd has unified around one framework, one ideology. The PHP crowd is splintered into a bunch of frameworks, some of which are inspired by Rails or have similar features to Rails. But here's the real kicker... Rail's framework conventions -- the naming conventions, the file layout -- allow developers to hop into a project and quickly understand it. If you're a PHP developer hopping into a project you could be dealing with any one of many (dozens?) of different frameworks ...or maybe even a completely custom framework. This isn't just a PITA for the developers, it's also risky for the business that owns the code. When hiring new people, the company needs to find a PHP guy that knows framework X or is competent enough to understand the custom PHP framework. If the same business built the product on Rails, any Rails guy could hop into it because every Rails project looks the same. IMO, it's a really underrated software engineering advantage. As for Ruby vs PHP, I'll take object-oriented every single time. Yes, the new version(s?) of PHP are OO now -- but I want a language that was OO from the start, thanks. Not one that has OO bolted on after 10-odd years. Maybe that's just the "computer-science-loving" guy in me. Advantage: Ruby. The PHP libraries are richer than Ruby/Rails because PHP has been around longer and has more developers. Both Ruby and Rails are closing the gap here. Ruby and PHP have shitty Unicode support, apparently. Advantage: PHP. Web application development is going through a renaissance. It's being taken seriously again and for good reason: the languages and frameworks like PHP and Rails are getting good from a software engineering perspective. Really good. Posted at November 05, 2006 at 08:41 PM ESTLast updated November 05, 2006 at 08:41 PM EST Comments
Let me just start by saying that there's nothing wrong with Visual Basic. I use VB.Net to fill my wallet, and I have to say it's very nice to work with. VS.Net is one of the best IDE's I've ever used, and the .Net framework is really nice, and what sets VB.Net apart from VB6. And if you're using .Net, you could be using C# or VB.Net and it doesn't really make much of a difference in what you can achieve.I also don't get that quote about PHP being VB for the web, because VB has been on the web for many years, both as VBScript in old ASP, and currently in VB.Net in ASP.Net. Anyway, I can see where they're coming from. PHP is a big mishmash of stuff. It started out as being non-object oriented like C, and has now moved on to being object oriented. So, only a small subset of the available tools object oriented, and the rest isn't. Some libraries such as mysqli come in both OO and non-OO flavours. This kind of reflects the current state of VB, where you have the well thought out .Net framework, with a bunch of stuff left over from VB 6 that seems like it will never go away. I really like using the "newer" languages like VB.Net and Java, because the Framework/API is just so well laid out. Everything seems to make sense, and all the fuctions are in the right place, and documented well. I think that this is where PHP is lacking. Although everything is really well documented (complete with user annotations), I find that it's very unorganized, and there is a whole bunch of duplication with many libraries providing the same functionality. PHP as a language isn't bad, althought I think that is would be nice to have a better thought out API like Java or .Net. » Posted by: Kibbee at November 5, 2006 10:18 PMNice comments, Kibbee. I agree that PHP seems to be a little less consistent and organized than the vendor-sponsored frameworks BUT it's probably a product of being an open source language/framework/library and an attempt to be agile. I'll trade language/framework agility for consistency any day, so long as I have unit tests to make sure my project stays working. My guess is that when he said "PHP is the Visual Basic of the Web" he meant that it's easy to use and not-object oriented, referring to the old VB. Otherwise they may have said VB.NET -- which I consider to be a completely different language -- instead. I seem to remember reading that the old VBers don't like VB.NET... I can't speak for the intentions of the quote though, so I don't know. Maybe PHPers see being non-object oriented as an advantage of usability? It makes sense, not all "web programmers" know the object-oriented paradigm ... and it's simpler to think of web pages programmed linearly and self-contained/atomic (besides includes). They seem to dump on Rails for being too computer-science-ish, so maybe being OO/MVC is what they mean? It's hard to say. » Posted by: Ryan at November 5, 2006 10:34 PMI don't get it. Why compare PHP with Rails? PHP is a language. Rails is a framework. If anything has to be compared with each other, it should be a language against another language, or a framework against another framework. Ruby vs PHP. Rails vs Symfony/CakePHP/CodeIgniter/Prado/etc. But for the love of God, not PHP vs Rails. It's just a wrong way of comparing things. » Posted by: Evan at November 6, 2006 02:34 AMEvan: that's part of the problem, yes. I talked about it because that's what people compare. But in general I agree: compare a framework against a framework. That's part of the reason why my subject is "Why PHP vs Rails?". Parts of Rails, like ActiveRecord, can be used outside of a web framework entirely ... which is why they might be suitable for a language library like PHP if they were "translated" into PHP. The most interesting implication of the PHP vs Rails question is: why is the Ruby side unified by Rails and the PHP side is splintered into so many framework choices? What does that say about PHP ...or open source web development? Why hasn't a "unified" framework for PHP been made by the PHP guys themselves? But the real question is: How do these PHP frameworks compare against themselves and to Rails? Maybe the PHP vs Rails question is really just all of the PHP frameworks vs Rails. » Posted by: Ryan at November 6, 2006 02:45 AMI guess we could call PHP, VB for the web, if we were talking about VB6. I think it would be more accurate to call it "open source ASP" (not .Net). That's pretty much exactly what it is. They are pretty much the same, and only differ by the syntax used to actually program. I would say that having a unified framework can be a good thing for many reasons. with a unified framework, there's much less overlap, and code could be integrated a lot easier. You'd probably have a lot of problems for instance, if you wanted to combine 2 projects, one using CakePHP, the other using Symfony. Although I've never used either, so I really can't say. Also, most PHP programmers, from what I've seen, use no framework at all. This can make for some pretty hard to read code, since each programmer will do things in a completely different way. Even with a good framework, you will get a lot of people that don't use it, simply because they don't feel that it fits their needs. Looking at ASP.Net, there's the framework, and the API. Even though most people lump them all into one, I like to consider them seperately. The framework for me, is that drag-and-drop RAD form designer, using web controls, and other things of that nature. I find that a lot of people use ASP.Net, without using those tools, and they all have their own reasons for doing this. On the other hand, everybody uses the API, which is basically the big function/class library. For those who are familiar with Java, it's like Struts being the framework which uses the Java API. You can do JSP without using Struts. Which leads to PHP. Since their is no set framework there's a better chance you will find one that will suit your needs, without having to write your own. Although writing your onw is probably the best idea if you have a major project resting on it. It can be much more specialized and do exactly what you require it to do. Having no set framework really leads to some interesting tools. SimpleXML comes to mind. Load up your xml doc, and you immediately have an object that maps to it. Visit the docs page [http://ca.php.net/manual/en/ref.simplexml.php] to see what I mean. I've never seen anything like that in any other language, and I'm not sure if you'd ever really see it included in something like .Net (if it's even possible, because I think it's necessary that the language is dynamic for this to be possible). » Posted by: Kibbee at November 6, 2006 10:39 AMYou can not compare Rail to PHP. You can only compare Ruby language to PHP language. At that perspective, PHP has certainly a much bigger advantage over Ruby, which explicitly loses all its power without Ruby on Rails. So dont make you bet on Ruby or Rails. Ruby on Rails is about a good idea for simple things. Therefore, Rails can be forked very easily in any language. Java has Trails. PHP has had CakePHP one year ago and now Rails lessons reproduced in Zend Framework and SolarPHP framework are even far better. Why Ruby when we have a much more powerful PHP? Why Rails when we have Zend Framework and SolarPHP much more elegant? » Posted by: pcdinh at November 6, 2006 11:31 AMHow is PHP more "powerful" than Ruby? How are the PHP frameworks more "elegant"? » Posted by: Ryan at November 6, 2006 01:39 PMAfter reading Update Monday 1:44pm: It seems, from my understanding, that in Ruby, everybody has decided to go with Rails, because without it, you can't program anything for the web. However, in PHP, without any framework, you can produce something, that will work, and maybe fulfill all your needs. You can pick a framework if you find one that works, or make your own framework also. This may create extra work, and make it hard for companies to find programmers who can understand the framework, however, I don't think that's really a big issue. The framework should be the easiest part of joining a new team. If it isn't, then your framework is probably too complicated. Learning the business rules that apply, becoming familiar with the data you're dealing with, and becoming familiar with the actual code, that's set up around the framework, will take much longer than learning the framework itself. Before working at my current Job, I hadn't programmed that much in VB.Net. However, it didn't take long to pick up the framework, because the framework is simple. That's the entire point of the framework. To be simple. Saying you can just jump into a Rails project and quickly understand it probably a bit of a stretch. Your learning curve may be reduced a little, because you already know the framework, but each company you work for may go at things in a slightly different way. Maybe the decided to go against the framework, and something some other way, because they found it worked better for them. Then the new guy has the new way, which may be even harder, because he has to unlearn what he has learned. So, while it may help things a little to already be familiar with the framework, I still think there is a lot to understand apart from the framework. The framework is only the tip of the iceberg. » Posted by: Kibbee at November 6, 2006 02:23 PM |