Choosing Node.JS isn't just a performance / scaling decision for me -- one of the main draws to Node is the huge community and wealth of awesome modules. Socket.io, Now.js, cradle, redis, and dozens of other modules abstract away the tedious work and let me build functionality _really_ fast. Go is really promising but it won't win over the majority of casual developers until there's a community around it. I might as…
> one of the main draws to Node is the huge community and wealth of awesome modules. Socket.io, Now.js, cradle, redis Really? In my experience, all but the most mature modules are hardly beta-quality and in constant flux. Find a good module for your job? Too bad it only runs on 0.4. Find another to get around that; oops, too bad your version of gcc needs to be patched and re-built. The language and its entire package…
To boldly go where Node man has gone before
51–60 of 124 posts
Re: To boldly go where Node man has gone before
#52Earlier quoted context omitted.
In a medium sized web application, 50-70% of server-side code can be re-used verbatim between server and client.
Well, whatever "medium sized" means, I work on a high-traffic Web application that reuses 0% of code from the client; in almost everything I've worked on, I've found reuse between client and server nearly impossible, enough that they're almost always segregated repositories. There's an argument for models existing on both sides (which is reiterated below), but I have a hard time seeing models as 50-70% of any applica…
I've recently been working with a team that is developing a content management system for which the display side of things (responsible for routing requests to models and views, fetching model content, rendering, etc.) is about 500 lines of non-comment CoffeeScript code.
Nearly 100% of the server-side code is re-used on the client, and perhaps 80% of the (non-library) client-side code is shared with the server.
In this case the exceptions are:
- Things like HTTP-level request handling and reading from local files rather than over HTTP are used on the server-side only.
- Things like DOM-manipulation and interacting with browser events are used on the client-side only.
I wonder if a significant factor may be how much functionality you're actually replicating on both the client and server. In our case, browser-permitting, the entire display engine runs equally well on the client or on the server. If we had a lot of JQuery kind of stuff happening in the client-side JavaScript the ratios might be a little different, but "also-run-the-app-on-the-client" is a good example of a use case that leads to a lot of reuse of the server side code.
Re: To boldly go where Node man has gone before
#53So does Go's net/http module really provide basically exactly the same programming model as Node? If so, why use Node? One thing the author didn't mention is that Go will use multiple cores in this example, whereas Node is single-threaded. Right?
It's for an older version of Go, and has only been tested on Plan 9, but it shows a static content + blog server, with JSON config files and templated HTML for the blog pages.
Re: To boldly go where Node man has gone before
#54Earlier quoted context omitted.
npm is awesome, this direct import doesn't seem like a feature, more like a lack of a feature.
It works very well for me. If I want someone to install a Go program I've developed, in Ubuntu 12.04 they can just: $ sudo apt-get install golang $ go get github.com/pauek/garzon/grz That's it, and it takes a few seconds.
npm install express
Not only do npm handle versioning for you, you also don't have to remember the host or username. Obviously Go is a younger community, and could make a package manager some day, but I'm puzzled by how you're comparing this positively with npm.Re: To boldly go where Node man has gone before
#55Earlier quoted context omitted.
npm is awesome, this direct import doesn't seem like a feature, more like a lack of a feature.
It works very well for me. If I want someone to install a Go program I've developed, in Ubuntu 12.04 they can just: $ sudo apt-get install golang $ go get github.com/pauek/garzon/grz That's it, and it takes a few seconds.
But when installing packages, I have to say, npm is fantastic.
Re: To boldly go where Node man has gone before
#56Earlier quoted context omitted.
Why not validate on both? Validate on the client to give a nicer and quicker notice if something is wrong (good UX) and then validate on the server for actual security.
To avoid a split-brain validation scenario. Update your model? Don't forget to update your validation in both the client and server. Otherwise, you'll validate something on the client but not the server (bad UX), invalidate something on the client but not the server (bad UX), or corrupt your data slowly when validation entirely fails (bad UX). Since it's a pain in the ass to remember to update two places when you mak…
Re: To boldly go where Node man has gone before
#57Re: To boldly go where Node man has gone before
#58You'll drive yourself into the looney bin if you hop from one thing to the next based on these comparisons that inevitably popup every month or so.
If you enjoy programming in JS with Node use it - if you enjoy programming with Go use it. Your enjoyment will far outweigh performance differences that will be minor in 99% of real world cases.
Re: To boldly go where Node man has gone before
#59If there is one thing I've learned its to ignore benchmark tests on relatively established technologies. You'll drive yourself into the looney bin if you hop from one thing to the next based on these comparisons that inevitably popup every month or so. If you enjoy programming in JS with Node use it - if you enjoy programming with Go use it. Your enjoyment will far outweigh performance differences that will be minor…
Re: To boldly go where Node man has gone before
#60That's an enormous advantage for startups as (a) the JavaScript hiring pool is much larger than most other languages (particularly in comparison to nascent ones, like Go), and (b) the ability to write client- and server-side code in the same language means small teams can be far more integrated and collaborative than otherwise (and if the startup has a single coder, the point is even stronger).
Assuming these benchmarks are accurate and translate into similar results for more complex applications, I'd gladly pay the 10-20% performance penalty to get the above benefits. Node is fast enough for most startups.