I was reading some of the latest stuff on Sam Clarks blog the other day and this post stuck out at me. He was talking (in the latter part of the posting) about a Rails vs. PHP comparison he saw recently.
It seems there is a lot of bigotry towards PHP from the new generation languages and frameworks. Sure badly written and conceived PHP is bad and potentially dangerous. But that could be said of all languages.
Thing is he’s damn right, the RoR people a quick to shout down how archaic PHP is (or can be). Trouble is I suspect those that have the loudest voices ALSO haven’t used PHP for a long long time.
Ok so I admit I am a PHP evangelist and no better (till today) than the Ruby lot; before a couple of hours ago I had never ever even touched Ruby, thought about Ruby or considered it worth my while checking Ruby’s site out (well not THAT Ruby anyway). So today I had a wander over to see what all the fuss was about.
First impressions, hmmmm
The first thing that struck me is thatÂ Â I don’t like their site – I know that’s a stupid thing to say but it all counts . For something that is supposed to be fresh, new, cutting edge or whatever it should have a nice looking site! (maybe it’s because I am using Opera..)
The second problem (after I spent a couple of minutes figuring out how to access the API then giving up and switching to IE – no better looking it seems!) was that the syntax looks very similar to Python (yay good) but with more words. Why do we need an end statement? Why is indentation (ala Python) alone not good enough! *grumble*
The other thing I noticed was a seeming hatred of brackets. It seems to me one of the big gripes RoR’s people have with PHP is how unclean the syntax is: I’m sorry but Iike brackets. Brackets are good, they’re clean, they break up code nicely without havingÂ to use a word (which is just confusing).
So.. a hello world tutorial? Nope – I have to create a Ruby installation first (it seems to involve eating Pizza) or something. Fairly standard ok. But then the rest of the tut goes on about a prebuilt application – what’s the use of that! Give me some code!
Digging a bit deeper I do like how the code actually works. Models do rock much (as it were)!. But I still don’t like the syntax. Then the tutorial waffles off into some HTML and I lost interest.
The Harsh truth
I have been extremely harsh to Ruby here I admit – I did go looking for problems. But I think my point is fair. Ruby does have some good new standards going for it (that they like to go on about plenty) but I CAN get that with Kohana (as Sam mentioned too). So, for me at least, functionality wise Ruby and PHP are on a par. It really should be a case of each to our own: if the end result is achieved who cares quite how (within reason) it was achieved.
Then we get down to syntax – I just dont get this “PHP looks horrible, is complicated and long winded”. It really isn’t. It has great potential to look crap if your a poor code writer but, generally, I think it looks quite nice. As mentioned above I think a proper use of brackets is essential in a web language. Because it is missing them in crucial places Ruby just looks bland and dull. Couple PHP with Kohana and I can create sexy looking code! Honest!
I’m certainly not saying PHP IS better than Ruby or the rest, but certainly they are all as bad as each other. Some languages have advantages in certain areas, others in different one; as yet there is no real perfect web-language.
What would be REALLY nice was for the infighting to stop, for everyone to share innovation (instead of snide remarks about *stealing* coding practices) and push web development to the next level
Incidentally, I know I keep going on about it but, this is one of the reasons I am becoming a bigger and bigger fan of Kohana and it’s ilk. They aren’t scared of innovation and pushing the boundaries. Even previous innovators like WordPress etc. (random example) are falling behind – we need modern apps and frameworks for the future.
A beer to that!
(PPS this post is a bit of a mess – sorry, I spent the best part of 3 days bit-writing it and it got a little rambling )