5 ms·
Why PHP is better than Ruby
- petercooper 16y agoPHP allows me to practice my typing skills, ruby doesn't. As a touch-typing enthusiast, I like to practice typing. The problem with ruby is that it allows me to do the same things that I can do in PHP, but with much less typing. [..] If I could create classes with public getters/setters that easily in my day-job, my fingers would atrophe and I'd get no exercise at all. I want my keyboard smoking after typing out a class definition, and a paltry three lines of ruby fails to satisfy. This is certainly the best designed troll blog post I've seen but far from the most subtle..
- bad_user 16y agoWhen the sarcasm is so clear, you can't call it a "troll". Real trolling is an art :)
- petercooper 16y agoYou're right - I guess that's what I was trying to get at with the lack of subtlety. Or my standards have slipped.. ;-)
- dexen 16y ago[[off-topic warning]] ``trolling is a art'' ;-)
- djhworld 16y agoHe's played this one well, I'd imagine 90% of the readers would read the first paragraph and then run to HN/Reddit to lambast such a post.
- jessedhillon 16y agoAwesome. I think he could have picked some better criticisms of PHP though -- there's a truckload of them: http://www.quora.com/What-are-the-crawling-horrors-of-PHP http://www.quora.com/What-are-the-crawling-horrors-of-PHP It really is the worst of all the in-demand languages these days.
- kenver 16y agoRead the article and there are a few times he compares php to rails - I didn't realise php was a web framework. There are certainly things to dislike about PHP. but I think he's trying too hard in a few of the ones he cites.
- callumjones 16y agoI'm all for hating on PHP, but this article really does a lot to help the popular view that Ruby programmers are arrogant language elitists.
- kayoone 16y agoI am a long-time PHP programmer. I have first dabbled with PHP in 2000 when making a Page for my Quake2 gaming clans and i still love it. (yeah boo-hoo) That said, the syntax and language inconsistencies that are already described in this post (which come from its origin as a website toolkit) are really laughable. However, i got used to it over time. I can still produce results much faster than say with Java. Also PHP has matured alot. I use the symfony framework for all the projects i do and its awesome, i think in some respects its even better than ROR and the upcoming 2.0 version will raise the bar even further. If this awesome framework wouldnt exist i would probably have switched to Python and Django by now, but as things are now i have never really felt the need to.
- bad_user 16y agoThings you don't have when working with PHP: http://www.nltk.org/ http://www.scipy.org/ http://www.pygame.org/ :-) I also worked with Symfony on a project. IMHO it's far, far away from being a match to ROR. Though at the end of the day, you're most productive with the tools you know.
- lukifer 16y agoSymfony is a labyrinthine nightmare. CodeIgniter and CakePHP are much closer to Rails in usefulness and ease.
- kayoone 16y agoDepends, its much cleaner and more flexible than CakePHP for example. But it has quite a steep learning curve, i give you that.
- xiongchiamiov 16y agoWhen have you needed to use PyGame in a web application? Different tools for different things. Use 'em when appropriate. As a sidenote: from my extremely limited experience with PyGame and (Lua) Love, Love kicks PyGame's ass all over the map.
- gurraman 16y ago2005 called; they want their blog post back.
- code177 16y agoI am tired of the never ceasing language wars. It's true that some languages are more elegant than others, but at the end of the day the only thing that really matters to any person other than the programmer is whether or not they create something inspiring and/or useful. All this time railing against other languages could be spent making awesome things, rather getting the proverbial tape measure out (yet again).
- yuvadam 16y agoTrolling or not, I cannot read these "my language is better" posts anymore.
- izendejas 16y agoI agree. The article I link below (and which I believe I first saw here on HN) should be closer to the model of what I would hope to see more of around here. It gives you easy to read data which I believe is often more helpful than any opinions because at the end of the day you want to know, what are the trade-offs between performance and development time*, among other things. And it's also careful to point out many relevant caveats. http://faves.eapen.in/performance-comparison-c-java-python-ruby-jyt http://faves.eapen.in/performance-comparison-c-java-python-r...
- dexen 16y agoThe points the blogger touches are mostly three-fold: * backward compatibility: a valid issue. Some of the APIs PHP exposes come from different backgrounds than others, and to serve the (un)holy cow of the backward compatibility, argument order is preserved. Regretably the PHP lang designers did not choose to deal with the issue, and instead fell for the trap of backward compatibility :-( * syntax: conventions were carried from C and derivatives. Not a valid issue -- the syntax is perfectly OK for a language without macro capability. (should there be macro facilities like in LISP, complex syntax would be a no-no, but that's not the case in PHP). * Java-isms like countless getter/setter methods: not a valid issue; nothing in PHP suggests that way of use. Merely bad habits on the part of the blogger. Get over it :-) For the once-in-a-blue-moon need of real getter/setter, use __get(), __set(), _call() etc. methods. [EDIT: style]
- masklinn 16y ago> For the once-in-a-blue-moon need of real getter/setter, use __get(), __set() Unless I am mistaken, __get and __set in PHP are similar to Python's __getattr__ and __setattr__: they are global to the instance and the dispatching has to be performed manually. It can be used for properties, but it looks like shit, it feels like shit and you'll likely fail to match the language's own semantics when it's invoked with the "wrong" field name. As far as I can see, the PHP convention on "static" getter and setters follows that of Java indeed, just as PHP's object system was lifted from Java.
- dexen 16y agoYes and no :) Indeed, PHP's __get()/__set() behave the way you describe. And if you have numerous getter/setters, it will feel and look like shit indeed -- in any language, no matter how terse the syntax. However, in that case the problem is with program design, not with the language itself. Ask your co-workers kindly not to carry over Java thinking into PHP world. Really, each language performs best when used in its default way. Second, the PHP's ``own semantics when it's invoked with the "wrong" field name'' is simple: issue a warning with E_NOTICE level on read access. You implement that exactly with trigger_error("some msg", E_NOTICE). Same semantics, end of the story. Will be reported, or not reported, depending on error_reporting configuration. Also, you have __call() in similar vein, which lets you do pretty neat results: http://scriptor.github.com/pharen/index.html http://scriptor.github.com/pharen/index.html
- mkramlich 16y agoMany of the positive points he cited for Ruby are true of Python as well. Except you don't have to type end end end end end end end end everywhere. Now I'll get myself-self-self-self-self off to bed...
- kingofspain 16y agoI long ago gave up trying to justify why I still use PHP as there will always be a counterargument (usually a long one) about how wrong I am. Once you get to that stage, there's a kind of serenity to be achieved :)
- robryan 16y agoOne I think is libraries for API's, sure this might not be the case among the latest breed of startups but I think overall your most likely to come across a PHP library and example code than Ruby.
- xiongchiamiov 16y agoThe only issue is that at least 80% of PHP code you'll find on the net is utter crap.
- smokestack 16y ago"Oh, look! An opinion that goes against the mainstream on the news.yc frontpage." "Oh, got baited into another anti-PHP rant." I know that PHP has tons of suckage but it's a point that's been made ad nauseum. No need to point out that Hitler wasn't that nice of a guy. We all know.
- whacker 16y agoDamn. I was hoping I would learn something new. Instead its just another round of circlejerk.
- tintin 16y agoDid he never hear about CTRL + Space? Anyway. If you don't like PHP just don't use it.
- Newky 16y agoI use php in my part time work every day, and I can honestly say this hilarious post made me consider using ruby. Unfortunately, I am the sole developer/maintainer on a huge project which languages don't stretch beyond php. I came to this project in this state and I must say that clean code like demonstrated in this post, would have made the cleanup job I've attempted a heck of a lot easier. Php is easy, but messy php code is not only extremely unsecure but also extremely hard for a new developer to adapt to.
- robryan 16y agoMy own PHP work where I have been the sole developer for most is great for me to work with. Having to mod a zen cart over the past week though makes me agree with you, that thing most be the kind of messy and obscure PHP open source projects.
- deleted 16y ago[deleted]
- eik3_de 16y agoEven more reasons: http://www.bitcetera.com/en/techblog/2009/04/07/10-reasons-why-php-is-still-better-than-ruby--/ http://www.bitcetera.com/en/techblog/2009/04/07/10-reasons-w... My favorite: DRY won’t Pay your Bills
- baggachipz 16y agoI see what you did there.