Follow Slashdot blog updates by subscribing to our blog RSS feed

 



Forgot your password?
typodupeerror
×
PHP Programming

PHP vs. Node.js: the Battle For Developer Mind Share 245

snydeq writes: Simplicity vs. closures, speed of coding vs. raw speed — InfoWorld's Peter Wayner takes a look at how PHP and Node.js stack up against each other. "It's a classic Hollywood plot: the battle between two old friends who went separate ways. Often the friction begins when one pal sparks an interest in what had always been the other pal's unspoken domain. In the programming language version of this movie, it's the introduction of Node.js that turns the buddy flick into a grudge match: PHP and JavaScript, two partners who once ruled the Internet together but now duke it out for the mind share of developers."
This discussion has been archived. No new comments can be posted.

PHP vs. Node.js: the Battle For Developer Mind Share

Comments Filter:
  • by Anonymous Coward on Tuesday January 13, 2015 @05:15AM (#48800979)

    This would be the worst movie ever.

  • okay (Score:5, Insightful)

    by Anonymous Coward on Tuesday January 13, 2015 @05:16AM (#48800983)

    I actually RTFA and found it to be completely useless.

    • My brain fell out (Score:4, Interesting)

      by Anonymous Coward on Tuesday January 13, 2015 @06:28AM (#48801271)

      This isn't merely useless, nor just bad, it's completely misleading. For it may look like he's giving the high-level, the author appears to have no depth to draw on to say more than the shallowest things. As such, he's presenting pond scum, not the high points from an expert deep sea fisher.

      And this is pretty bad, given that infoworld says about themselves [infoworld.com]:

      InfoWorld is the destination of choice for technology decision makers and business leaders who seek expert, in-depth analysis of enterprise technology.

      while the TFA says about the author:

      Peter Wayner is contributing editor at InfoWorld and the author of more than 16 books on diverse topics, including open source software, autonomous cars, privacy-enhanced computation, digital transactions, and steganography.

      I'm loath to seek out his writing, in fact fairly convinced to stay well away, while at the same time morbidly curious just how bad his "more than 16 books" will misinform.

    • Re:okay (Score:4, Interesting)

      by mwvdlee ( 775178 ) on Tuesday January 13, 2015 @07:38AM (#48801501) Homepage

      And plain wrong in many places.

      There's nothing about either Node or PHP that forces you to use or not use HTML or service calls.
      Same for separation of concerns (which pretty much boils down to the same thing).
      For instance; both PHP and Node handle SQL equally well, i.e. they can both hook up to most databases and let them deal with SQL.
      Same for JSON. Just because it kinda looks like Javascript and started out loosely based on it, doesn't mean Javascript handles it differently.
      I also don't think these two were ever "old friends who went separate ways". They started out separate.

      • by Shados ( 741919 )

        Its generally a matter of what the community/ecosystem is optimized for. ie: Python is pretty damn good at math stuff. But it has nothing to do with Python itself, its just the community built fantastic math libraries in python, generally because of historical reasons.

        In the same way, an obvious example, if you want to do web sockets, while you can make them in any language, Node is a prime contender there. Examples like that exist for any language.

        • But it has nothing to do with Python itself, its just the community built fantastic math libraries in python, generally because of historical reasons.

          Yes and no. One key strength of Python with regard to math is its built-in support for complex numbers. Without that, Python probably never would have attracted the attention of people who write complex (but not complicated) math libraries.

    • by plopez ( 54068 )

      But nodejs s bad rock star tech!

      https://www.youtube.com/watch?... [youtube.com]

    • Re:okay (Score:5, Funny)

      by TheRaven64 ( 641858 ) on Tuesday January 13, 2015 @09:11AM (#48802075) Journal
      You should improve your reading comprehension. TFS says, right in the first line (before the link):

      InfoWorld

      If you still click on the link after that, then you only have yourself to blame. I bet you click on goatse links too.

  • In the real world (Score:4, Interesting)

    by clickclickdrone ( 964164 ) on Tuesday January 13, 2015 @05:18AM (#48800993)
    I'd have thought most people are just getting on with whatever the preferred toolset is at their company and never give this mythical war a second thought.
    • Unfortunately, because of the network effect, it is actually quite important that you fight for your choice. Let's say you like PHP but no one else does... you will quickly find that tools for writing PHP dry up/don't get updated for new OSes. If you like Windows Phone, you're going to need to "sell" your preference to all your friends or eventually you'll have to switch to Android or iOS because if the Windows Phone platform doesn't get enough mindshare, it goes away.

      Mindshare matters, and your company can

  • by stereoroid ( 234317 ) on Tuesday January 13, 2015 @05:18AM (#48800995) Homepage Journal

    ... JavaScript must die. I expect TFA to concur.

    • by Noughmad ( 1044096 ) <miha.cancula@gmail.com> on Tuesday January 13, 2015 @05:21AM (#48801003) Homepage

      But so does PHP. In this battle, whoever wins, we lose.

      • The only way to win is not to play :)
        • by Kjella ( 173770 )

          In this case wouldn't mutually assured destruction (MAD) be exactly what you're going for?

    • by sanosuke001 ( 640243 ) on Tuesday January 13, 2015 @07:30AM (#48801479)
      Any dynamically typed language that isn't just used for scripting (your perl is probably okay) should be taken out to pasture and shot. JavaScript used to be okay; then application development came and it should go die in a fire.
    • by Torvac ( 691504 )

      ... JavaScript must die. I expect TFA to concur.

      script type="text/python" ... still waiting for it

      • script type="spoken/english" would be more interesting

      • script type="x64"

        I don't want something else that my computer has to interpret. Do all the compiling before it shows up on my computer so that I don't have to deal with this: http://i.imgur.com/b2uUrIL.png [imgur.com]

        Even "JIT" compilers start to suck when you have a few dozen of them running at the same time.

        • So much for cross-platform. So even obscure web sites need to compile for: x86, x64, IA-32, ARM, am I missing any?

          • No, of course not. You just need an x64 virtual machine running in your browser. What could be easier?
            • But of course to make it run faster, you can use a JIT compiler to recompile that to native code....

          • So use it like html5 video and have javascript backup.

            script x64="uselessWidgetJavascript.x64" x32="uselessWidgetJavascript.x86" javascript="uselessWidgetJavascript.js"

            If you lumped 90% of all internet devices on the web they'd probably fall under x86, x64, & ARM.

            Additionally Apple has figured out how to do fat binaries.

            • Oh, that seems much simpler (/sarcasm)! And of course someone's going to want to save time writing 3 versions, so they'll write in JavaScript and cross-compile to x86 and x64 to save time, increase compatibility, and reduce bugs. Should be easy enough to create a compiler, since we already have JIT compilers on most platforms. And wait...now you're just moving from JIT to pre-compiled and not really changing the status quo.

              By the way, fat binaries are great for mobile users on a capped connection.

              • save time writing 3 versions,

                Did I say write 3 versions? Just do all of the JIT compiling NOT on my computer.

                JIT to pre-compiled

                That's the point. Why are we using the battery power of thousands of tiny little ARM devices to compile something that could have been compiled once?

                When you boot your Laptop do you recompile everything just so you can grab the source daily?

                • The point is, the problem isn't the compiling. It's the bloat. When your app is built on top of a monstrous framework (jQuery's not even that bad on its own), it's going to be slow. Bad developers are going to make bad code and compiling it will not fix the problem.

                  • And by the way, would you really run binary code directly from a web site on your computer? There's a reason you're essentially using a JS virtual machine. Makes sandboxing much easier.

        • by SkOink ( 212592 )

          Look, I feel your MATLAB pain too, but isn't it stretching to blame that on Node?

          • When a computational package designed to manipulate massive data sets uses less RAM than facebook I kind of think we're doing something wrong.

        • by fisted ( 2295862 )

          [...] so that I don't have to deal with this: http://i.imgur.com/b2uUrIL.png [imgur.com]

          Yeah, I wouldn't want to have to deal with Windows either. I feel ya.

    • Agreed. I can't open more than a few javascript heavy pages without this happening: http://i.imgur.com/b2uUrIL.png [imgur.com]

      All of those tabs have terrible javascript trying to give me a decent Web 2.0 experience.

  • by lesincompetent ( 2836253 ) on Tuesday January 13, 2015 @05:22AM (#48801005)
    It's all fine and dandy until you remember we're still stuck in a single thread.
    Now cue the apologists.
  • by Rhaban ( 987410 ) on Tuesday January 13, 2015 @05:39AM (#48801071)

    These two languages each have their own use, and to chose between them you should not ask which is better but which is closer to my use case.

    PHP, for all its problems, is still a very useful language for developing web sites, if only for the quantity of tools (frameworks, cmss, etc) available and their quality (far from every php tool is good, but you can easily fond a quality tool for each category: symfony 2 is a very good oo framework, drupal and ez publish are good cms...).

    Node is younger, and does not have such a toolset. Sailsjs is a good framework but far from mature.
    But it does what php can’t: a nodejs application is its own server and runs continuously, instead of being a set of scripts that must reload everything with each request.
    It makes it a very good language for real-time uses, like the back-end of a small multiplayer game.

    • by Richard_at_work ( 517087 ) on Tuesday January 13, 2015 @05:52AM (#48801113)

      Node.js is also seeing a lot of use as a tool set provider for other build environments - see Grunt and Gulp, both need Node.js to function. You don't see PHP as that diverse in use.

    • "But it does what php can’t: a nodejs application is its own server and runs continuously"

      Not true. Because PHP has wrappers to all the underlying C-functions you need to create a socket server. See socket_ functions.

      Also, you can fork new processes with the pctnl_ functions and have IPC with the shmop_ functions.

      Using this functionality you could build a more advanced webserver than node.js which, btw, has some terrible bugs in its socket reading algorithms.

    • Symfony, Drupal, Wordpress, nah. They all forgot to include the most important thing in the base: security. Specially Wordpress, look at its spaghetti code and than look at the Banshee PHP framework [banshee-php.org]. If you understand what that framework does for security, you'll never dare to run Wordpress or the other junk frameworks again.

      • by Rhaban ( 987410 )

        Wordpress is junk, on par with joomla. It assumes a lot of things and as soon as you wander bayond its core functionality (a blog). Seriously, how can disabling in code, with no possibility to override it) unfiltered html in content for everyone except the super admin if and only if the multisite mode is enabled be called a security feature?

        Symfony 2 does most things quite well (the authentication process is a nightmare), drupal does some strange things (and community modules go from "utter crap" to "pretty

    • by gl4ss ( 559668 )

      there's already too many nodejs toolsets.

      ends up with plenty of bloat with everyone on the project losing scope of where stuff happens...

      though, node is pretty nice for plenty of stuff. certainly far better than php for just about everything, unless you're a php only coder... if you're the sort of who just used php, the rails or whatever and autocreated mostly everything then yeah there's that too for node.js. don't know why you would want that though in the modern world. most projects use frameworks for th

  • Missing (Score:5, Interesting)

    by gmuslera ( 3436 ) on Tuesday January 13, 2015 @05:43AM (#48801089) Homepage Journal

    PHP is far more available in cheap hosting solutions. The apps are simpler to deploy (simply put them along your static html files in a web server that supports its extension), and simple apps are simpler in php. The ecosystem around was not touched in the review, Compose vs npm, joyent vs the community behind php, the future of both platforms.

    In the other hand, PHP is (or at least, used to be recently enough) a fractal of bad design [eev.ee]

    • Re: (Score:3, Insightful)

      by ameoba ( 173803 )

      People stuck on "cheap hosting solutions" don't pay good money to developers to develop software for them. Cheap hosting solutions don't even come close to scaling to anything beyond a blog for a local business.

      Unless you've decided to work on a bottom of the barrel open source CMS/Forum system (a market that's pretty much saturated already), the argument that "PHP is the only thing we can run" is just not relevant. Maybe it carried some weight ten years ago but it's a non-issue these days.

      • Exactly. Even if you're on a really tight budget, you can get a VM with 10-20GB of disk space and run whatever you want and enough bandwidth that you probably won't come close to the cap (unless you're serving videos) for a few dollars a month. An hour of developer time will cost more than a year of hosting. Even for a hobby project, it's pretty easy to afford.
    • Can't someone seeking hosting just get an $8/mo WebFaction account and set up PHP and Node sites under it, or get a $10/mo VPS and deploy whatever the expletive he wants?

  • by Anonymous Coward on Tuesday January 13, 2015 @05:55AM (#48801121)

    Man I've read articles where the author didn't know what they were talking about and was just stacking points, but they're made here with such assertiveness and surety that I started doubting reality. +1 great trip, no mushrooms required.

  • Proper systems and apps developers wouldn't touch either of these noddy languages with a sterilised bargepole.

    • Re: (Score:3, Interesting)

      by OzPeter ( 195038 )

      Proper systems and apps developers wouldn't touch either of these noddy languages with a sterilised bargepole.

      So what would these "proper" developers of yours actually use?

      Python - No way in hell .. the language has to bend to my will, not me bending to its will.
      Java - Antiquated and full of perversions, along with the spectre of Oracle hanging over you.
      C/C++ - I know it is done, but would you?
      C#/VBV.Net - Even with MS opening up things .. "It's a trap" /Ackbar
      Perl - Are you sure its actually serving pages and not just a prank obfuscated programming contest entry?
      Go - You and the 3 other people using it should get

      • by Bigbutt ( 65939 )

        Don't feed the trolls.

        [John]

      • Re: (Score:2, Interesting)

        C#/VBV.Net - Even with MS opening up things .. "It's a trap" /Ackbar

        I would love for some Star Wars fixated Slashdot geeks to explain just how the current situation and plans are "a trap"? I've developed on the .Net platform for the past 7 years, I've not been trapped yet - MS hasn't attempted to gain control of my code, hasn't limited where I can deploy, hasn't told me off for deploying MS libraries on non-MS platforms etc etc.

        Today, I have a choice of multiple front end web frameworks competing with the MS offerings on the .Net platform but not one of them has suffered i

        • by OzPeter ( 195038 )

          So where is this trap that Slashdotters have been shouting loudly about for the past decade?

          While my intended use of "its a trap" was a facetious repetition of a meme (and I won't bore you with a whoosh), I believe the trap is not so much the technical aspects of the tools and code (I have always preferred VS over Xcode, and c# over Obj-C), but the morals of the company that you are buying into by using their code. From It's not done until XXX doesn't run and Embrace, Extend, Extinguish to the subversion of the OOXML standards process there are many distasteful things that MS has done as a compan

          • Re: (Score:2, Interesting)

            Firstly, no whoosh needed, I understood the meme but just think its horrifically overused and just plain shit. But then I am tiring of all of the memes that call Slashdot their home these days, people tend to use them for a quick laugh or a "I'm in the group!" stamp rather than putting forward actual enticing arguments for their views.

            Secondly, MS does have a history - so does all large long lived companies. I was on the anti-MS band wagon back in the late 1990s and early 2000s, but then I grew up and wat

      • by Xest ( 935314 ) on Tuesday January 13, 2015 @09:23AM (#48802163)

        "Python - No way in hell .. the language has to bend to my will, not me bending to its will."

        Few languages bend to your will, some learning is always required. I'm not terribly convinced the learning curve for Python is less than for PHP/Javascript given that those two have so many dangerous nuances that it takes years to truly understand them and develop with them without falling victim to their countless pitfalls. If you don't like the syntax of Python that's fine, but it's hardly a compelling technical argument not to use it over PHP and Javascript.

        "Java - Antiquated and full of perversions, along with the spectre of Oracle hanging over you."

        Java is antiquated? It was first released in 1995. That's the same year that both PHP and Javascript turned up you realise?

        As for perversions, what perversions exactly? It's a pure OO language and sticks to that properly. Compared to Javascript that really doesn't know what it is and has functionality that's basically broken like closures because it tried to do away with explicit pass by value and pass by reference meaning you need to do horrible hacks to force creation of a new scope if you want to pass by value into a closure rather than have a variable captured.

        PHP? It's about as perverted as you can get. It started out basically like C for the web, but without the difficult stuff. Then it did exactly like C++ and tried to glue OO on top, only C++ kinda worked because it was done by a competent computer scientist whilst PHP had it's OO tacked on by a mob of wannabes.

        Out of the 3, Java is no older, and is the only one that actually determined and stuck with a consistent and planned design philosophy. Your criticism therefore seems to be wholly nonsensical in the context of comparison against Javascript and PHP. The very fact that Javascript was rushed out with a similar name in the same year as Java to cash in on it's hype should at least tell you something about the quality of Javascript as a language if nothing else.

        "C/C++ - I know it is done, but would you?"

        It really depends what you're doing and how competent you are.

        "C#/VBV.Net - Even with MS opening up things .. "It's a trap" /Ackbar"

        If it's a trap then it's a pretty poor one because they keep on open sourcing more and more of it. First they go and make the language a real actual standard, and then they start open sourcing the framework whilst giving Mono their explicit blessing.

        Microsoft now isn't Microsoft the 90s, it has realised that it needs C# to be runnable in as many places as possible like Java, hence why they opened up the core and plan to open up more and more of it. Nadella knows they lost the smartphone war, and he knows that Windows Server hasn't taken over the server world. He knows that the only way to get a foothold in these areas is to at least take what it does well there - development tools and technologies. The newest version of Visual Studio even supports Android development.

        You seem to have pulled together a list of pretty weak criticisms of each language and pretended that's justification not to use them over PHP and Javascript despite PHP and Javascript both having glaring deficiencies that make the negative considerations you pass off as fact above wholly irrelevant in the grand scheme of things.

        Each technology has it's merits, but saying I'm going to use a technology with 100 deficiencies because the alternative has 1 deficiency seems to me to be a bit short sighted (no zealots, please don't take the 100 to 1 literally, it's intentional hyperbole to make a point).

        At the end of the day we're stuck with Javascript on the client for the foreseeable future and that doesn't bother me too much. But why use it or PHP on the server when there genuinely are just all around better alternatives for that particular case?

        I don't even buy the Javascript on the server because you can share code with the client thing either - your server objects automat

  • Re: (Score:2, Funny)

    Comment removed based on user account deletion
  • by Qbertino ( 265505 ) <moiraNO@SPAMmodparlor.com> on Tuesday January 13, 2015 @06:53AM (#48801355)

    TFA is a bunch of blabbering from someone who has no idea what he's talking about - void of anything useful.

    To get this out of the way:
    Node.js is a serious contender to topple PHP off the server-side, for the simple fact that we would then have one PL less in the entire webstack, which is way to
    complex anyway.

    I myself have been pondering trying out Node for larger non-trivial projects. I'd be the first to switch if it were possible.
    I haven't yet - Node is just not quite ready for prime-time.
    Why?

    1.) The tools don't exist yet and Node seems to gather the same problems Rails has: A bloated, instable and unreliable mumbo-jumbo of countless libs, tools and extensions - various package managers included, each built on a whim and powered by a neat logo and a 6-week fad that sweeps the community and adds to the mess already there. In short: The Rails problem of to much navel-gazing and not enough of solving real world problems.

    2.) Callback hell.
    In fact, its Node/JavaScripts callback hell that made me realise a thing that is so great about PHP: What you see is what has been made, for you, for that specific request. LAMP is such a bizar solution no one in his right mind would suspect it could work, yet most site on the internet run on it. The stack is so vertical it actually makes any Java solution look like an ADHD driven Visual Basic School projekt in comparsion. And I mean vertical right down to the way it actually works!

    Try building anything like Joomla or Wordpress with other solutions such as JS and you'll end up with problems that completely leave the domain of your work. The simple fact that a PHP request is dead and gone when its finished sending its request reply and all the rest it offers is custom built around any strange problem the

    Any concern you have right at the moment when developing for ther server side web PHP has neatly covered ... ok, forget I said neatly, ... but covered and everything else is put aside. PHP is born out of a template engine, and as bizar as it sounds, that's its advantage [slashdot.org]. Any problem the Web domain can come up with puts PHP in a very strong position. Serverside things PHP just shrugs of with some strange custom internal function has JS and Ruby tripping and falling flat on their face with no chance for rescue.

    3.) PHP is 10 years ahead of the game. No joke.
    Try finding a product like Typo3 or Wordpress in Java, Node, Rails or any other backend runtime you fancy. Won't happen. It take me 5 minutes to download Typo3, 2 hours to set up - mostly because configging Apache and setting up T3 is an arcane science unto itself - but then it's there. Everything I would ever want for a web product.
    Joomla, Drupal, Wordpress and co. are even way easyer. The only other contender holding up is Pythons Zope/Plone. All else is a decade behind at least. Rails included.

    Bottom line:
    As soon as Node gets their shit sorted out and offers a serious upside vis-a-vis LAMP, PHP is going to continue to rule. It gets the job done. Node and Rails don't. End of Story.

    • .Net has Sitecore are Sharepoint. Java has AEM (which is what Typo3 tries to be) and several others. These of course are "enterprise" proprietary solutions, but just as easy to install and configure. I could spend hours talking about what a joke Typo3 is. The truth is that web CMS platforms use PHP because it is the defacto standard in shared hosting plans, just like most desktop games are written for Windows with DirectX.

  • Developers dont matter if their deployments crash and burn due to library bugs before they reach first year deployment, and that is a big part of the reason the new frameworks aren't taking over the world just yet, nobody wants of have a fragile platform that need expensive devops to run for things that aren't designed to be replaced/extended every six months.

    And to make it worse there is no attention given to this problem in any of the fad2.0 communities, ie nobody really wants to build the new standard
  • replaced with another shirty language. This like arguing which is worse: bull shit or horse shit -- guess what, they both stink.

    This isn't a battle - they both suck. A developer uses whatever crappy web language there is to get the job done.

    News at 11.

  • I still use Mason.

  • Thats a weird comparison, since they don't target the same audience at all. Rails maybe, as it has a lot in common, but even then.

    What makes node interesting is that its asynchronous-first, single-threaded-by-default model has interesting performance characteristic and lends itself well to specific architectures. Bonus that it also works amazingly well for web sockets. There's also a lesser point that still matters, its JavaScript and some people like that a lot.

    The tradeoffs however are pretty massive. The

  • by sg_oneill ( 159032 ) on Tuesday January 13, 2015 @09:25AM (#48802173)

    Cancer versus AIDS. Which to choose. decisions decisions decisions.

  • So...do any of the PHP bashers do any actual extensive coding in PHP? Have you ever looked at the code in Drupal 7/8?

    Seriously, I am always baffled by everyone who starts ranting on how crappy PHP is. I have done mostly PHP development for 12+ years. I have yet to have a site hacked, or SQL injection exploited. It is a very solid language, it can be made VERY fast (JIT is also coming down the pipe out of the box in 6+). It lends itself to rapid prototyping and easy patching / testing. There is a mod
  • Just write it in C++ with TDD, which will run faster, and after you factor in all the pain from debugging server side untyped dynamic languages, will also be faster to develop.

    Let the flaming commence.

  • "But then some clever kid discovered he could get JavaScript running on the server. "

    Really clever kid. We had this in 1994.

  • But then some clever kid discovered he could get JavaScript running on the server. Suddenly, there was no need to use PHP to build the next generation of server stacks.

    What is this blogspam shit doing here? There's no "need" to use either of them, there have been loads of alternatives to PHP for years and there are still plenty of alternatives for both. The individual points make no sense either, it's like they've just quickly Googled for "PHP advantages" and "Node.JS advantages", bullet-pointed them on a page and stuffed the rest full of ad links.

  • Charlton Heston? I mean if he was still alive, not that PHP is still alive.

Technology is dominated by those who manage what they do not understand.

Working...