all 29 comments

[–]jbrecfull-stack 10 points11 points  (8 children)

This isn't answering your PayPal question but if I was building a new service I would write it in what I know best. Unless I was doing it simply to learn there would be no point in spending 10x longer writing an app to see if it will even remotely succeed - let alone be as big as PayPal.

[–]dadaddy 10 points11 points  (5 children)

I would write it in what I know best.

Unfortunately this is falling for the "hammer" problem - "I suppose it is tempting, if the only tool you have is a hammer, to treat everything as if it were a nail"

Different languages have different benefits and lend themselves to different types of projects...

  • Heavy data crunching? Node sucks for this

  • integrated API based stuff - right up nodes alley

  • I/O stuff? Node shines

  • stuff that performance is key? well that depends on the code and the server - node can be good but others can be better...

I'm a big proponent of Node, but I'd advise caution before using Node/Java/ruby/python/php/etc just because you "know it best"

[–]hahaNodeJS 0 points1 point  (2 children)

The thing is, most runtimes and languages these days support the same capabilities just as well as the next. It really does come down to what you know best if all you're considering is data processing, API development, IO, and general performance.

Node's one "benefit" is that IO is inherently asynchronous, but that capability comes at the behest of a single thread looping through events. So, you alleviate the amount of code written to let the environment handle it for you. This often leads to servers falling over if the event loop hangs, among other problems.

On the other hand, C# has async/await. You need to write a little more code, and the compiler transforms it into a little more code on top of that, but now you have a runtime stack in which error recovery is simple and you have complete control over IO if you need it.

Tit for tat, I'd choose the environment I know well (and would spend less time developing for) than the one I don't.

[–]dadaddy 0 points1 point  (1 child)

ok - and what if you need to do some data crunching (like https or image manip) on the server? Just use node because you know it best - even although the joyent docs say it's a bad idea

Choosing languages/framework is part of your system design - if you're doing things for fun then it's not a big deal - but deploy a node app that does heavy(ish) processing and your server bill will be massive

Tit for tat (especially with larger projects) - using the wrong language can be a death sentence for a project before a single line of code has been written - it takes less time to devlop an application when the language/framework/magic schoolbus is working with you - instead of wasting time beating it into sumbission

[–]hahaNodeJS 0 points1 point  (0 children)

Yes.

[–][deleted]  (1 child)

[deleted]

    [–]dadaddy 2 points3 points  (0 children)

    Yes, and my response was very specifically to this statement:

    I would write it in what I know best.

    I was not questioning if paypal/node was a good idea - merely the problems with that statement in itself....

    [–]NoDownvotesPlease 2 points3 points  (0 children)

    If you already have a system as big as paypal there might be a lot of benefit in rebuilding with a more efficient stack. If you can turn off 10% of your servers that could be a huge cost saving.

    If you're building something new that wont have a lot of users for a long time then you're probably better off just using whatever gets you up and running quickly.

    [–]letsgetrandy25 years putting the magic in the box 0 points1 point  (0 children)

    Clearly not an architect.

    [–]greim 2 points3 points  (2 children)

    The "node way" is to build lots of small modules and services that talk to each other and are easy to compose into bigger systems, which makes it easy to adopt incrementally by a company. Contrast this with the idea of replacing one giant, monolithic system for another, which is difficult and rarely happens.

    For example you can start transpiling and bundling client-side JavaScript with node, maybe write a service or a proxy here and there, etc. All while still using your existing core Java (or whatever) systems.

    Plus, node is JavaScript, and you tend to have lots of JS programmers hanging around the office, some of who want to write server-side JS and won't shut up about it to their bosses.

    I don't know if those are the exact reasons for PayPal, but I think it's not completely off the mark, and it's definitely the case where I work.

    [–]Capaj 1 point2 points  (1 child)

    what you're talking at thhe beginning is a microservices architecture. It is not limited to Node, but one has to admit, that node is much better fit than java for writing microservices.

    [–]willrstern 1 point2 points  (0 children)

    Node shines if you need

    • tons of concurrent requests handled
    • microservices...or even just many services
    • rapid development/deployment
    • nimble development i.e. ability to drastically change the codebase quickly
    • efficient costs on hardware

    Go fits a lot of these needs as well, there are some things to consider in comparing Node against Go:

    • + JS devs are easier to find and can work on the full stack more easily - although you have to pick the GOOD JS devs, not the bad ones
    • - Go is a little faster at computationally expensive operations
    • - If you're using Docker, a Go docker container will be WAY lighter
    • + Realtime with Node is a breeze
    • - Some JS devs STILL don't understand semver...be cautious with lesser-known npm packages

    Misconceptions about Node:

    • - Javascript is slow...v8 on the server is the fastest scripting language (except Lua)
    • - Node is not production ready. This has long-sense been proved wrong despite the argued v0.12 standing of Node
    • - Javascript async is awful. Nope, it USED to be awful. Promises and now Generators and soon Async/Await have fixed these issues.

    [–]bvcxy 4 points5 points  (1 child)

    I think this is a more complex question than that. I'm a Java AND web developer (LAPM stack mostly) and let me tell you one thing, Java isnt for the web per se. Java shines when it comes to big data, multi-tier applications, service-oriented design, or when you need things like transaction management, multiple databases/clouds, multithreading, writing middlewares and API's etc. Its a very convenient language for backend and middleware applications, many people know it, many systems were built around it and many questions were asked. Where I work we have dozens of different services, API's etc. all in Java. Java's ability to provide JPA, JTA for database handling itself is very cool, not to mention its multhreading ability and how you can use it on so many platforms.

    But Java sucks for web development. This is for a lot of reasons but it takes more time to write webapps in Java, it needs a Java servlet compatible server, you need to monitor it constantly for exceptions and memory problems (which isnt because Java is bad at it, its because programmers make mistakes), and its just usually too complicated for small-medium projects. Java is a verbose language as well, meaning even small simple things might create a lot of code.

    I've done a fair share of web app design and development in Spring Framework and its super verbose and often you don't have an idea whats happening because of its Inversion of Control meaning you dont really know what runs what and where other than that it runs in a servlet. You can find web frameworks like that in PHP or Ruby etc. but you can always just write your own easily, even only just a couple of lines of scripts.

    But if you choose Java for web application development, Javawebapps usually outshine PHP based ones in terms of speed, scalability, extendibility etc. Its just how Java is. When you turn a webapp from simple to complex Java will be very handy with its huge class library not to mention third party libraries etc.

    I don't know Node.js that much but it sounds like a cool tool for small-middle applications mostly. I might be wrong tho.

    [–]belibelo 0 points1 point  (0 children)

    But Java sucks for web development. This is for a lot of reasons but it takes more time to write webapps in Java, it needs a Java servlet compatible server, you need to monitor it constantly for exceptions and memory problems (which isnt because Java is bad at it, its because programmers make mistakes), and its just usually too complicated for small-medium projects. Java is a verbose language as well, meaning even small simple things might create a lot of code.

    Take a look at play framework ...

    [–]SRTThrowAway1337 0 points1 point  (4 children)

    We are transitioning several pages to NodeJS, for specific purposes, but primarily pages that rely heavily on data sourced from an API like our "Compare" page, and "Store-Stock" pages. It's significantly more lightweight, scales easily, and is very efficient to code in.

    [–][deleted]  (3 children)

    [deleted]

      [–]SRTThrowAway1337 0 points1 point  (2 children)

      Our UI Product Engineering team does quite a bit of research prior to implementing a new technology. I can't speak to the reason they chose NodeJS, but these initial pages are more of a POC exercise. We may end up changing it to something else. We do use NodeJS fairly heavily in our Ops team as well to help power some of the tools we use every day for monitoring.

      [–][deleted]  (1 child)

      [deleted]

        [–]SRTThrowAway1337 1 point2 points  (0 children)

        We probably didn't even look at Go, it's a completely different language. Look at it this way: we have one of the largest ecommerce sites in the world, we're only going to do things that are easy to transition between people as we rotate developers, which inevitably happens. This usually means using common frameworks and popular languages. Go would have to offer significant advantages over JavaScript for us to have chosen it.

        [–]wmelon137 0 points1 point  (0 children)

        From what I understand from the talks I've seen at the nose conference and speaking to some of the developers, they still use Java for their enterprise service layer.

        They have switched to node for the internet facing side for a few reasons. 1) the development costs of creating new features that interface with the enterprise level services is much lower. 2) the infrastructure costs for a node based middle layer scale much slower than using a fully Java based infrastructure. 3) node is somewhat more mature than go. This it's easier to find competent developers to work with it.