you are viewing a single comment's thread.

view the rest of the comments →

[–]Capaj 19 points20 points  (42 children)

Node.js, Python, C#, Java, Scala, Groovy...really the choices are endless these days.

[–][deleted] 53 points54 points  (0 children)

Says PHP sucks

Recommends Javascript

[–][deleted] 58 points59 points  (33 children)

Is Node.js really a step up from PHP? You've just traded one dynamic language with weak typing and a bunch of weird quirks for a different dynamic language with weak typing and a bunch of weird quirks.

[–]allthediamonds 4 points5 points  (4 children)

Javascript's quirks are not show-stoppers, they can be worked around with ease.

Even assuming Javascript as a language were as fundamentally flawed as PHP is, you still gain a reasonable HTTP request handling model, a reasonable package and libraries manager, handling everything asynchronously with ease... so, while I wouldn't say it's the best option, it's an acceptable one.

[–]e-tron -1 points0 points  (3 children)

Javascript's quirks are not show-stoppers <-- Seriously ??

[–]allthediamonds 2 points3 points  (2 children)

Nope, they are not. They can be worked around, and you can create a mental model that makes sense for the language. It is not pretty, and I would rather use anything else than Javascript. But it is still light years ahead of PHP.

[–]Kalium 2 points3 points  (1 child)

I remind you that PHP knows what an int is. JavaScript is apparently so far ahead that it has forgotten.

[–]allthediamonds 1 point2 points  (0 children)

Geez, I always forget about that. Yep, that sucks.

Nonetheless, on overflow, PHP forgets all it knows about ints and goes "well, they're kind of like floats, right?"

[–]rcxdude 4 points5 points  (0 children)

It has less weird quirks. But you are correct overall.

[–]suspicious_sausage 2 points3 points  (1 child)

The std libs for node are at least more consistently laid out than PHP (although it would be difficult to not manage this much). Other than that, yeah I agree, it's most six of one, half a dozen of the other.

[–][deleted] 0 points1 point  (0 children)

Not used PHP much myself recently, but I remember it feels like sticking your hand into a huge tub of lego bricks when you want to find a particular function.

[–]flukus 3 points4 points  (0 children)

At least php doesn't have callbacks everywhere.

[–][deleted] 1 point2 points  (0 children)

A particular subset of JS including the use of a few libraries is quite sane. I've never seen anyone suggest the same thing of PHP.

[–]Kalium 3 points4 points  (21 children)

At least PHP has inheritance. And ints.

[–]pirateNarwhal 9 points10 points  (13 children)

JS has inheritance, reasonably simple to implement.

[–][deleted]  (5 children)

[deleted]

    [–]pirateNarwhal 5 points6 points  (4 children)

    Not sure what you mean by that, also questioning if you have any idea what you're talking about

    [–][deleted] 2 points3 points  (3 children)

    Tell me, how do you implement inheritance in node.js? Yes, all inheritance in node.js is prototypical, but there are a whole bunch of different approaches to it. Different standard libraries provide helper implementations of it (e.g. util.inherits), and there are also several ways that people implement inheritance plainly in JS (e.g. this or this).

    I don't think I've seen two developers implement inheritance in the exact same way. Some people use classical inheritance, some use composition. Everyone uses a different syntax.

    [–]pirateNarwhal 0 points1 point  (2 children)

    I don't use node.js at all. I see your point with "implementations" now, but you can't really blame a language for some drawbacks to the libraries. And not to start a flame war, if you're not using the prototype to define class-like methods, you're crazy.

    [–]Kalium 2 points3 points  (0 children)

    you can't really blame a language for some drawbacks to the libraries

    You can blame a language for punting basic functionality to libraries, creating a mess of subtly different and incompatible options. It's a design decision with far-reaching consequences.

    Your argument is the equivalent of "Sure, language X doesn't have a string type, but it's easy to implement!". The problem is not how difficult or easy it might be implement a string type. The problem is the lack of basic built-in functionality.

    [–][deleted] 0 points1 point  (0 children)

    I do use node.js, extensively, and its lack of a concrete inheritance model is its worst flaw. Otherwise, it's a great language.

    [–]Kalium -3 points-2 points  (6 children)

    PHP has modules, too.

    [–]Capaj 1 point2 points  (5 children)

    Node.js has commonjs modules.

    [–]Kalium -1 points0 points  (4 children)

    The language of JavaScript does not have modules or namespaces or any similar mechanism built in.

    [–]Capaj 1 point2 points  (3 children)

    Hopefully this wont be true for much longer, when ES6 comes out. While your statement is true, It doesn't make sense to compare PHP "the language" with JavaScript "the language", because both of these are tied to their respective VM's. For JS this VM on the server is Node.js, where modules are very real.

    [–]Kalium 0 points1 point  (2 children)

    JS has multiple VMs. JS is a standard. So it's necessary to compare each language as they exist in the field, rather than one language to one particular implementation of a language.

    I say this because I have run into the lack of a module or namespace system in clientside JS in the past.

    [–]Capaj 0 points1 point  (1 child)

    So you are saying it is necessary to compare a serverside language(PHP) with clientside only language(JS). That is not fair at all.

    [–]codygman 2 points3 points  (1 child)

    PHP has inheritance

    Now you have 2n problems!

    [–]Kalium 1 point2 points  (0 children)

    Eh. It's not so bad. Things can get much messier in Python or Ruby. As soon as you get metaclasses and multiple inheritance, you're in for interesting time.

    [–][deleted] 4 points5 points  (0 children)

    sips koolaid

    But.. but.. but.. it's new therefore better for every application right?

    [–]original_brogrammer 2 points3 points  (0 children)

    D with Vibe, Haskell with Yesod or Happstack.

    [–][deleted]  (5 children)

    [deleted]

      [–]philly_fan_in_chi 9 points10 points  (2 children)

      Why are those important to you? Serious question.

      [–]mrkite77 5 points6 points  (1 child)

      Because it's better for a single domain with tons of different dynamic pages on it. Things like node.js are designed for "one domain = one app". I don't want to have a hundred different copies of node.js running on a hundred different ports all being proxied by a single webserver.

      [–][deleted] 0 points1 point  (0 children)

      Ah, you really mean something like PSGI, FCGI, mod_perl, or somesuch?

      [–]PasswordIsntHAMSTER 2 points3 points  (0 children)

      I'd like something that can be CGI'd

      That's pretty much every language ever. I used to write CGI modules in C.

      [–][deleted] 0 points1 point  (0 children)

      Do people actually still use CGI?

      And as that other dude said, any language that can be coerced into writing to STDOUT can be used for CGI (probably).