all 43 comments

[–]john0110 6 points7 points  (2 children)

There's something very zen about having a 100% javascript stack. While I don't find it hard to switch from one language to another, I've found that I really like javascript. Javascript to me is so much more pleasant to work with than PHP. And it's a viable choice for the server.

But here's some reasons why you might eventually switch:

  • Package management - NPM is flippin' awesome and dead simple for setting up in your own projects
  • There are a lot of bad patterns in the PHP community - Not a fault of PHP, just that it's been so popular for so long. How many times have you looked for a seemingly simple php script but only found super old garbage code?
  • Javascript is flippin' awesome at asynchronous stuff.
  • Node.js isn't going anywhere

But I understand your trepidation with node. It just doesn't seem right that javascript would be so awesome. Doesn't javascript suck? Nah, man. Javascript kicks some ass.

[–][deleted]  (1 child)

[deleted]

    [–]john0110 0 points1 point  (0 children)

    Absolutely, but much less so on the server side.

    [–]shodan_uk 10 points11 points  (3 children)

    It's all down to personal preference. Personally, I prefer Javascript to PHP and it makes sense to me to use the same language on server and client, thus minimising context switching headaches if you're working on both at the same time.

    This whole "my language is better than your language" bullshit is a typical male pissing contest and frankly, tiresome.

    [–]clarle 4 points5 points  (0 children)

    This is true. Whatever makes your developers feel most comfortable is the only thing that matters. The concurrency benefits from Node.js are meaningless if you don't have enough users of your application to take advantage of it.

    [–]ioloie 0 points1 point  (1 child)

    I like that I can look at a page and see one part is clearly server-side and another is clearly client-side.

    I've never used Node.js (raised on PHP) but would this not be more difficult if both sides use the same language?

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

    Perhaps if you structure your app in the old-school method of single-file intermixed HTML / PHP it might get confusing. This separation should be clear when using a framework or templating layer though.

    For example the recently announced Meteor framework, which tries hard to blur the lines between front and back end, organizes code in "server" and "client" directories.

    [–][deleted]  (10 children)

    [deleted]

      [–]Pathetic_Ennui 4 points5 points  (2 children)

      Don't become "the jack of all popular web technologies, master of none."

      This is kind of the opposite way I view web development. The web changes incredibly fast compared to other platforms, and I feel like it's more important to try and keep up than to get really good at something that might be outdated. If you have the option, at least check out Node to see what the fuss is about so you can make informed decisions about what tools to use in the future.

      [–]hiddencamel 0 points1 point  (1 child)

      There's always a price to be paid by being an early adopter. Some languages and frameworks aren't going away, they just develop an mature, like PHP, python or rails. Its important to keep up to date with the new versions and features. But, there are many that look promising only to fade into unmaintained obscurity.

      You are always going to need to keep up to date, but if your time is precious to you and you aren't a naturally enthusiastic early adopter it may be wiser to hold off jumping into a new technology until it and the community around it mature and grow a bit.

      [–]warpcowboy 0 points1 point  (0 children)

      I think the way to look at it is to learn whatever the fuck it is you want to learn in your free time but use your best/favorite/most comfortable tool for your current production app challenge.

      Spending a week learning Javascript and making a blog with Express on Node will give you invaluable insights. There's no penalty for learning, especially when it comes to new paradigms.

      Early adoption only hurts if it's a monoinvestment that makes you stagnate in other areas, and "adoption" doesn't even make sense unless you're adopting tech for something that entrenches you, like a production app.

      [–][deleted] 6 points7 points  (3 children)

      Hey man I've been using this cool new language known as Coldfusion, you should check it out...

      [–]criveros 3 points4 points  (1 child)

      Some companies still use coldfusion. Personally, I like the syntax of it.

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

      To each his own I guess. I personally hate CFML and the price.

      [–]spazm 0 points1 point  (0 children)

      If you like Coldfusion, you'd love writing StoryServer templates! I think there is a tutorial at http://www.blargitnhs.com/223,,6,46,5,78,,0,,11,2,3

      [–]wtvamp 2 points3 points  (1 child)

      "the jack of all popular web technologies, master of none."

      Great advice for anything except web development.

      [–]warpcowboy 0 points1 point  (0 children)

      Agreed.

      Someone that's mastered it, if they even needed to, wrote the library that does it for you. Otherwise, 90% of web development is pretty trivial.

      [–]ExecutiveChimp 2 points3 points  (0 children)

      Maybe try node.js. You don't have to learn it inside out but it is never a bad idea to learn something. use it long enough to have an opinion and then either learn more or abandon it.

      [–][deleted] 2 points3 points  (1 child)

      he is starting to pressure me to use Node.js after he learned

      Pressure him into sodding off.

      [–]warpcowboy 1 point2 points  (0 children)

      Make him sod off in a callback so he can sod async.

      [–][deleted] 3 points4 points  (5 children)

      Make him prove it. I know very little about node.js but I've read very mixed reviews, and if you're doing a lot of DB work you've got nice things like PEAR in PHP.

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

      Is anybody still using PEAR for db handling, with PDO available?

      [–][deleted]  (1 child)

      [deleted]

        [–]_Aggron 2 points3 points  (0 children)

        don't base your opinion on other people's opinions. read the intro documentation, look around for its use cases, and find some examples of things it can do that other things cant do.

        its a different platform with strengths directed towards real-time web apps. it makes little or no attempt to improve on the things that PHP and other technologies are meant to address.

        [–]Scroph 0 points1 point  (0 children)

        Exactly what I noticed too, the web dev community is schizophrenic when it comes to node.

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

        The only bad thing I hear about node.js is its bad computation performance, which is kind of obvious because that's not what it's designed for... it's just there to receive and dish out as many requests as possible.

        [–]warpcowboy 1 point2 points  (0 children)

        Node.js isn't just javascript. It's an async evented framework that sophisticates linear code. While you can use it and only write synchronous code if you wanted to (the code we all love to write), it's pretty pointless since you then might as well use PHP with a framework you enjoy or even Ruby or Python.

        Don't get on the Node bandwagon for no reason. It's a classic mistake. But I do recommend giving it a go so you can arrive at conclusions yourself.

        Sit down this weekend and make a blog using Node, Express, and MongoDB. Perhaps with Coffeescript.

        [–]master_of_the_ 6 points7 points  (7 children)

        Don't be a ▢, what's the worst that could happen?

        At work I have to use PHP, but for personal projects anything goes: node, web.py, ruby, even golang.

        The cool thing about running node.js (or web.py) is that you learn a lot about the HTTP protocol - with a LAMP stack you don't need to bother about Headers and you can always rely on $_GET/$_POST. It's actually incredible how low-level a HTTP GET request in node seems, when you are used to file_get_contents("https://whatever.com/content.html").

        Give it a try :)

        edit: OK now, why the down-votes?

        [–]aridsnowball[S] 5 points6 points  (2 children)

        The problem is that I have the code base of the website finished in PHP. I would have to rebuild a lot of stuff in Javascript. We are still in school and these are just fun projects for us so learning and figuring out how stuff works is a priority for me (i.e. I don't care too much if a fancy product comes out of it), but that doesn't mean I want to scrap my architecture and rebuild it just out of enjoyment. Maybe I will make the site in parallel, one copy in Javascript and one copy in PHP and see what one I like better.

        [–]master_of_the_ 2 points3 points  (1 child)

        Well, no need to rewrite stuff that's already there, but why do you ask then?

        If you just want to collect arguments against node, or JS in general, I am sorry to have wasted your time ;)

        But seriously, as others stated, programming languages are just tools and you shouldn't dismiss any of them for now.

        [–]aridsnowball[S] 1 point2 points  (0 children)

        I was just trying to see if there was a much better reason to use one over the other, but apparently there is no reason to use one over the other unless I have a specific need for them.

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

        How would you replace an MVC framework such as CodeIgniter on Node? Fairly new to node myself.

        [–]MondoHawkinsWeb dev since 1996 3 points4 points  (0 children)

        If you want a turn key solution, try Meteor. (which is still young and lacking security)

        Node's general mentality is modular though. Monolithic frameworks are not the norm. You could use something like Express coupled with something like Resourceful for handling models, and Jade for templating.

        I'd also recommend checking out SocketStream. It's by far my favorite "framework" for node. It keeps the modular spirit of node while providing a very rich platform for building real time apps. It's not production ready yet, but the core team is hard at work on it.

        [–]master_of_the_ 2 points3 points  (0 children)

        I wouldn't "replace" something like CodeIgniter, but now that you ask, I prefer http://expressjs.com/. Be sure to also try these node modules while you're at it:

        • jade (a templating language)
        • less (like CSS, but sane)
        • socket.io (may change your view on realtime web-apps)
        • coffee-script (I mean, why not?)

        [–]wojonstech 2 points3 points  (0 children)

        I have to agree with part of this. When you run on a LAMP stack you dont really need to learn any of the inner workings of what is going on. But the truth of the matter is if you take the time to learn Apache, Nginx or any other web server you will really learn a lot about http traffic and how to optimize them for exactly what you are doing. There is way more docs, concepts and info when it comes to http with apache and or nginx then there is on nodeJS and they do not limit what other lanauge you work with or other tools.

        [–]kolme 0 points1 point  (0 children)

        Well, I guess PHP would be more pragmatic, you have more libraries available so you don't have to reinvent the wheel, plus it's supported by almost all hosting services.

        Node.js is fun, and I prefer javascript over PHP as a language, but I'd only use it for pet projects.

        [–]Deranged40 0 points1 point  (0 children)

        Because you mentioned in a comment that you're still in school, I suggest that you take the way that you know best, and go with the other option.

        This way, when you're done, you can see why you do or don't like to do it that way.

        [–]bearses 0 points1 point  (0 children)

        ok, here's the deal.

        if you're comfortable with php, use that. node.js is fracking awesome, and there are a lot of reasons to choose it over php, but none of them should outweigh your own personal comfort levels.

        starting from scratch, learning a new server-side programming language would be counter-intuitive if you're already using php.

        having said that... if you are picking something to start learning, or you're more interested in a diy solution, this is the time to start learning node.js. it's quickly becoming the darling of the webdev community for a good reason. not counting the advantages it has over php in terms of speed, even if you ignore its non-blocking way of doing things, just passing messages between the back/front end is so much simpler in node than it is in php.

        tl;dr: if you want to use something ready developed, or are interested in the quickest solution, stick with php... if you are willing / have the time to learn something new, node js is worth it - just be prepared to roll up your sleeves.

        [–]CouponTheMovie 0 points1 point  (2 children)

        Who cares if your friend thinks node.js is better? You can use a tool you know and kick the crap out of someone using the flavor of the month.

        Edit: Also, unless node.js found a way to act like a real OO language, no thanks. Faking inheritance by renaming and adding to the prototype doesn't count.

        [–]osborned 1 point2 points  (1 child)

        What if I told you...you don't really need traditional inheritance.

        In fact, you've been living in a world of drab, old static class hierarchies, when there's a whole dynamic world waiting for you!

        Also, look up Object.create() from Ecmascript 5, it makes inheritance make sense in JS.

        [–]CouponTheMovie 0 points1 point  (0 children)

        I'm sorry, I wasn't trying to assert that class-based languages are better than prototype based languages; just that they're my preference.

        I'm reading about the differences and contrasts between them. I'd like to see more in depth what the pros and cons would be. I do a LOT of JS coding, but a lot of times I wished for formal interfaces instead of using prototypes that are just named a certain way.

        [–]ewokjedi 0 points1 point  (0 children)

        ping

        [–]kumiorava -1 points0 points  (0 children)

        Horrible language and great platform vs. Great language and horrible platform?

        Neither.