Blog Post RSS ?

Blogs » PHP » It’s official: Javascript sucks harder than PHP
 

It’s official: Javascript sucks harder than PHP


  • Save to
    Del.icio.us

by Harry Fuecks

The surprise outcome of last nights webtuesday - Javascript sucks harder than PHP. I still can’t quite believe it.

Maarten took the PHP corner against me in the Javascript corner, both of us shamelessly advocating each language under various headings - 1 minute max per topic - no outright lies although often bordering on truthiness. Verdicts provided by the audience, based on who could shout loudest from a choice of “OK - 0 points”, “Annoys - 2 points”, “Sucks - 4 points”, “Sucks hard - 6 points” and “Blows - 8 points”, with help from the Suckometer (thanks to the Net-Policy team for QWizard).

Now this might not sound very scientific. For starters, how can you compare PHP (server-side) to Javascript (client-side) - apples to pears? But it’s not quite so black and white, as you’ll see from the slides - there is server-side Javascript just as there is client-side PHP. And if you ignore that distinction and focus more purely on their respective merits as programming languages, there’s plenty of room for comparison. Meanwhile you might argue that a secret ballot is essential for impartial rating but that misses the opportunity for one angry coder to remind everyone just how bad it all is.

And we had some very experienced hands in the audience (many knowing both languages intimately as well as Java, C, C++, Ruby, Perl etc.) but still stunned by the final verdict: that Javascript sucks harder - I thought I’d clinched it with CSS selectors for dependency injection but by using a negative rating system, hype and buzzwords were quickly slaughtered - it became a process of catharsis in which the “winner” was the one that came out hurting less - this is the new language advocacy! ;)

Many thanks to our hosts Amiado.

This post has 29 responses so far

  1. I still believe the result is wrong. ;-)

     
  2. I am not surprised by the result. I would like to see other comparisons too:
    Ruby vs. Java
    Perl vs. PHP

     
  3. JS is better but I just couldn’t lose! Forgive me! :)

     
  4. I would like to see other comparisons too:
    Ruby vs. Java
    Perl vs. PHP

    Yeah well we may just be headed in that direction of almost endless possibility, should we fail to find other more relevant topics.

     
  5. Languages comparison sucks even harder than JavaScript. Choose what works for you.

     
  6. How do you “choose what works for you” though? I realize it’s an apples to pears things, as mentioned, but is there really even comparing the two? I mean, the choice is obvious. When’s the last time you saw a bulletin board system done in JavaScript? A form processor? A shopping cart? You get the point.

    Then again, I guess the article was done to showcase the language itself, e.g. the syntax. While we’re at it, let’s compare tables to table-less designs *rolleyes*

     
  7. LOLOLOL Javascript sucks harder because nothing sucks in PHP. BOOM! Take that silly javascript.

     
  8. I was going to click a link to learn more about this, but which link? For the love of god…which link….
    :)

     
  9. What ever…
    You need javscript to access your html and CSS on the client-site, you can’t do that with PHP. That’s why this comparsion is useless, I think the best case is to use them together!

     
  10. Consume with a pinch of salt I think.

    I code in PHP all the time. All day long at the moment, 12 hours days. I dabble in JS a bit, although I have read a book on it pretty much cover to cover.

    I believe PHP is a good (not great) language and probably the best programming platform ever. JavaScript is not far at all from being a great language but very poor platform indeed albeit with great potential. Now that these browser abstracting JavaScript libraries are becoming popular the JS platforms are improving. I think that turns the table some what.

    JavaScript is probably the most important
    language in the world today.

    — Shockingly I find myself partly agreeing with this and I should think more so as JS’s user base increases, the language matures and all those hundreds of great XML based technologies the W3C has on the drawing board start to appear inside browsers. I’ve got my eyes on SVG and XForms.

    Yeah well we may just be headed in that direction of almost endless possibility, should we fail to find other more relevant topics.

    Heh, can’t wait!

     
  11. What exactly is it that they suck? Or blow? If it’s what I think it is perhaps we could have a better analogy? Although i’m not entirely against that.

     
  12. Javascript is alot harder than PHP especially when it involves AJAX

     
  13. Javascript is better because you can get the user’s input with it both when the ‘program’ starts and while it is running.

     
  14. @Sjoerd,

    but you still need the server side since everyone can unable and manipulate the client side…

     
  15. @olaf2,

    But the same checks you make with Javascript on the client side before sending data back to the server, can be used on the server side with JScript, so you don’t have to create each function twice. :)

     
  16. Sjoerd, what if you’re using a non windows platform?

    I remember a lot of asp.net programmers which never use javascript on the serverside…

    but this is goeing in the wrong direction it was about php and JS

     
  17. But MochiKit makes javascript suck less. So that should even the scores.

     
  18. Ya no. The problems with Javascript are predomenantly the the interpreter written by the various implementors. The language spec itself is weird but good. PHP is rotten to the core. Both the language and the interpreter are complete crap.

     
  19. PHP is rotten to the core.

    funny, most of the websites and applications are using this “rotten” language (also this blog)

     
  20. Great experiment I think? Is there anyone out there willing to teach me how to upload a preloaded php site onto my server? I am just starting to learn about php and I want to buy a script and I can’t figure out how to go about making it live and how to change pages, etc. I am a newbie with NO idea what to do. Is there a tutorials anywhere on the net with newbie instructions? Thanks for ANY help what so ever. I hope that this is the place I was supposed to ask questions about php and if not please forgive me and set me straight. Thanks again Mrs. or Mr. Moderator! Jim

     
  21. @martin2001

    this is not the place for that kind of questions (you will never get an answer, perhaps).

    Try the support forums here at sitepoint or somwhere, if you’re looking for php tutorials search google for “PHP beginner tutorials”.

     
  22. considering JS is a functional language and so much more powerful compared to php…

     
  23. They’re both good languages. Period.

     
  24. i know this for years. that is the real evidence. thank you :-)

     
  25. Nice way to compare stuff that you can’t really compare hehe. Anyway the more I have worked with real programming languages for webdevelopment –Java in the form of JSP and c# in the form of ASP (.net ofcourse)–, and the more PHP is becoming a two faced monster with their somewhat (excuse the phrase) half-arsed implementation of object oriented programming –a good example would be the whole type-hinting facade– the more I tend to go towards jsp and asp…

    I used to be a fanatic PHP scripter even though I did plenty of programming in other languages (not for web purposes) and sure it’s alot easier than anything out there, just due to the un-intuitive (to me) implementation of OO in php 5 there isn’t really any IDE that actually knows what to do with those objects that just ’somehow’ arrive in your included php files.

    javascript is finally advancing into something real and not a could-have-been language. A few years ago noone wanted to even really touch javascript –mostly due to microsoft’s implementation of jscript. Now with the AJAX-hype things have been looking up though.

     
  26. I’m using php / mysql to store over 15.000 articles and it works better togheder.

     
  27. I’m not intending to be argumentative - just want to hear some opinions. What are the gripes people have with PHP? You can be quick and lazy, or super structured. You can make your scripts object oriented, or choose not too. Just about everything concerning form is entirely up to the designer. And the API is pretty great.

    The only potential disadvantage I can think of is the fact that variables don’t have to be declared, causing a larger chance of semantic errors (variable typos that aren’t caught). But then again you can make PHP catch this stuff on almost any server configuration. So what are the disadvantages you all have? I’d love to hear input. Thanks!

     
  28. Disclaimer: my day job is PHP and JS and I know them in and out in every way. I honestly think that both JS and PHP suck hardcore as languages and I defend neither one. However, they have their place.

    What are the gripes people have with PHP?

    Where to begin? (Random order of my gripes about PHP that I can think of off the top of my head.)

    First, you have to escape HTML with <?php tag. This not only clouds business logic with display but it encourages mixing them.

    Second, PHP’s weak typing means you can easily run into issues because the language does not let you declare your intent. Perl’s == vs. eq is in the right direction.

    Third, PHP has no namespaces and, my last count a week-or-so ago, has 5,312 functions thanks to all the modules/extensions.

    Fourth, PHP has no naming consistency. strpos vs. str_replace.

    Fifth, PHP has no argument order consistency. in_array($needle, $haystack) vs. strpos($haystack, $needle).

    Sixth, unknown tokens are assumed strings. Consider define("MY_FOO_DEFINE", 10). If you accidentally use MY_FOO_DFEINE it will assume you want the string “MY_FOO_DFEINE” and continue on.

    Seventh, it has forking (pcntl) but absolutely no locking ability. (I write off-line PHP scripts that utilize my app’s classes.)

    Eighth, single inheritance on classes.

    Ninth, lack of operator overload.

    Tenth, references/aliases. They blow. Especially prior to, I forget exactly which version, 5.1 where objects were copied which made it insanely tedious to make sure all of your aliasing (adding & everywhere) were done right. If you miss a single one then you get a copy. Without pointers and a good debugger, this because nigh impossible to track down.

    Eleventh, magic quotes. They promote laziness. Glad to see its slated to be removed in PHP6.

    Twelfth, no one needs native unicode. Right?

    Thirteenth, PHP has no official spec. It’s just whatever the developers feel like doing and adding (which I assume is the root for naming inconsistency and many other gripes of mine).

    Fourteenth, PHP lacks good debugging and profiling support. I’ve attempting to use a couple debuggers including Zend’s debugger but they all lack or didn’t work. Introduce AJAX into your app and things get worse.

    Fifteenth, complete and utter lack of objects for dates, strings, arrays, etc. No operator overloading exacerbates this. It would be very helpful to have $arr->in('foo') or $date->incrementDays(7);. Heck $file->write('flooby'); for files would be nice too.

    Sixteenth, the arrays make combining lists and hashes into one data type but it becomes a chore if you specifically need one and its respective semantics.

    Seventeenth, functions aren’t objects which means you can’t pass functions around. Creating an anonymous function with create_function is a joke and a hack to get around this problem….kind of.

    Eighteenth, no late static binding (google it). Still.

    Nineteenth, all of my interactions with the development group have been the opposite of stellar. The common response is a quick, terse, copy/pastes response and goes something like “that’s not a bug, it’s a feature.”

    That’s about enough I think. For what it’s worth, I do have a list of things I like about PHP but you didn’t ask. :) In particular is the breadth of database support. I had trouble finding mysql support for Python and when I did (mysqldb module) I found out that it forces cursors for every query and it breaks when trying to do something (sarcasm) complex like joins.

    PHP has its place and I hope it stays there! :)

     
  29. Good Lord, please fix those javascript tickers that websites love to use, that my computer hates to be subjected to. Fans and processors overloading until I turn the darn javascript off in the preferences. Then everything returns to cool, quiet, and normal. You really need to address this problem.

     

Sponsored Links

Leave a response

You are not logged in, log in with your SitePoint Forum username and password.

-OR- Post Anonymously

* Make sure any code samples are escaped (i.e. ‘<b>’ becomes ‘&lt;b&gt;’).

If not logged in, your comments will be placed in a moderation queue. This means your comment may not appear until one of our moderators approves it.

SitePoint Marketplace

Buy and sell Websites, templates, domain names, hosting, graphics and more.

Logo Design, Web page Design and more!

99designs

  • Custom logo designs created ‘just for you’.
  • Pick the design you like best.
  • Only pay if you’re satisfied with the result.

Want More Traffic?

Get up to five quotes from qualified SEO specialists, with no obligation!

Get A Free SEO Quote Now!