Live data from Hacker News

To boldly go where Node man has gone before

blog.jgc.org

61–70 of 124 posts

Re: To boldly go where Node man has gone before

#61

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…

You might like Perl too. Edit: haha I love how people downvote this like i'm being sarcastic. Down with Perl, that horrible language with a community and modules 100x larger than Node!

I don't understand the attitudes either. While I enjoy writing Javascript for Node, when other Node users tell me they hate Perl, I can do nothing but give them a blank stare.

So you want an environment that is easy to program in a functional style with closures and first class functions. Has a large ecosystem, including hundreds (thousands?) of packages to do asynchronous IO. Is easily extensible and can fall back on code written in C. Finally, has a large and active community ( Madison NAPC is sold out )?

And Perl isn't even on your radar?

Re: To boldly go where Node man has gone before

#62
post #4
post #3

Earlier quoted context omitted.

It's true that Go can use multiple cores, but I was doing these tests in a Ubuntu VM that was restricted to using a single core so that Go's inherent 'multicore' advantage was dialed down. I'll add a note to the post.

That's a(nother) pretty big real-world advantage for Go then, no? I know the solution for Node is to just run one instance per-core, but it's automatic with Go. I'd love to see a second set of benchmarks of the same code on multiple cores.

Yes, Go will do that automatically. Plus, you can write your code in a completely linear fashion, instead of the typical Node.js code with lots of callbacks.

Re: To boldly go where Node man has gone before

#64
post #9
post #2

So 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?

> So does Go's net/http module really provide basically exactly the same programming model as Node? If so, why use Node? Well, for starters, Go is much more awkward for working with JSON than JS is (which is to be expected since JSON is literally a subset of JavaScript). More importantly, Go lacks the ridiculously vibrant ecosystem for Web development that Node has — no NPM, no Connect, no Jade, no Stylus, etc.

So what exactly do you think is awkward about Go's way of working with JSON? Here's a code example from one of my current projects:

    type UploadProgress struct {
        Progress int `json:"progress"`
    }

    //...
    // variable progress is of type Progress
    if json_data, err := json.Marshal(progress); err == nil {
        w.Header().Set("Content-Type", "application/json")
        w.Write(json_data)
    }
json.Unmarshal works the same way. IMHO, not exactly more awkward than using JSON.parse and JSON.stringify.

Re: To boldly go where Node man has gone before

#65
post #47

Earlier quoted context omitted.

Kind of a clunky way to handle versioning though. In Lein (for example), adding [noir "1.2.0"] ensures I'm always grabbing the same version. In Go, appears the only way to guarantee this is to check in the full source of the library alongside your own in your repo.

I wish Leiningen would also handle bleeding edge dependencies as easily as rebar eg: {deps, [ {quoted, "1.0.3", {git, "git://git.corp.smarkets.com/quoted.erl.git", {tag, "1.0.3"}}}, {proper, ".*", {git, "git://git.corp.smarkets.com/proper.git", {branch, "master"}}} ]}.

This plugin[1] looks like what you're looking for.

[1] https://github.com/tobyhede/lein-git-deps

Re: To boldly go where Node man has gone before

#66

Earlier quoted context omitted.

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.

How's that any faster than 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.

It is faster because you don't have to install npm, the case I was explaining involves someone with no developing skills.

And I'm not saying this feature of Go is better than npm, I also use npm and I like it very much. What I like is the fact that Go comes already with this feature and I don't need anything extra.

Re: To boldly go where Node man has gone before

#67

Earlier 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.

And npm ships with node, so this is no different.

Furthermore npm can install git URLs directly too, including tags and branches if you need a particular one. Just specify the url as the "version" in your dependencies section of package.json. Totally trivial.

Re: To boldly go where Node man has gone before

#68

Earlier quoted context omitted.

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.

Oh I get it, you're talking about from a package developer's standpoint. Not having to register your package with a central directory does save a bit of time for you I guess. But when installing packages, I have to say, npm is fantastic.

You don't have to do this with npm either. You can provide a URL to a tarball or a git repository and npm will install from there.

Re: To boldly go where Node man has gone before

#69

Earlier 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.

This is a nifty feature and npm can do something very similar:

    npm install git://github.com/substack/node-optimist.git

Re: To boldly go where Node man has gone before

#70

If 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…

Also it is often external influences that will drive performance improvements e.g. Nginx, Redis, Memcached, Javascript caching etc.
Post reply on HN