Live data from Hacker News

To boldly go where Node man has gone before

blog.jgc.org

91–100 of 124 posts

Re: To boldly go where Node man has gone before

#91
post #82
post #71

Earlier quoted context omitted.

Unless there's something I missed, json.Unmarshal works the same way iff you have a struct that matches the JSON data very closely. If the JSON data is a little more free-form, you're stuck with a map of interface{}. Having to muck about with types is just a little tedious compared to JavaScript where there aren't really any types and anything can concisely be converted to a string. (I did a little project involving…

If your json doesn't represent something that already follows some known structure, you have an opaque data structure that you have to hand write a parser for in any language.

[deleted]

Re: To boldly go where Node man has gone before

#92
post #19
post #8

Earlier quoted context omitted.

> The language of the web is javascript. Until web browsers allow Go as the embeddable language, node will remain useful. Do people really get that much code re-use between client and server that using Javascript on the server provides a large benefit?

For small apps, no. For complex ones yes. The actual code shared may not be that much, but consider the advantages in sharing validation code between the client and server -- you never accidentally forget one requirement on the server side, leaving you vulnerable to an attack.

consider the advantages in sharing validation code between the client and server

Is there a mature implementation of this yet?

One that is not tied to an entire immature framework (meteor) or programming pattern (nowjs)?

Code-reuse was the big promise of node. Yet in reality I've never seen it executed beyond brittle experiments.

Where is the form_for_model() function that emits code for both the client and the server?

Re: To boldly go where Node man has gone before

#93

Node is popular not only because it's very fast (yes, it's still pretty darn fast even if there might exist faster alternatives), but because it's JavaScript. That'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 smal…

I've heard the JavaScript developers are easy to find argument before. However, good JavaScript developers are really hard to find. Especially when you need them to take those skills and run them on the server.

There is a big difference between a jQuery hack and a good JavaScript developer.

Re: To boldly go where Node man has gone before

#94
If you consider something to be fast and scalable (e.g. Go), then something with ~80% of the throughput (e.g. Node in this test) is probably also pretty fucking fast and scalable. Scalability and performance don't walk fine lines like that; there's a reason we talk about orders of magnitude.

Re: To boldly go where Node man has gone before

#95

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.

If you think Node has a huge community and wealth of awesome modules wait til you to discover the older and more mature languages/platforms, like Python, C, Java, etc.

"What I like about Justin Bieber is the massive history of his career, spanning decades, and the broad range of his musical style across several genres." :)

Re: To boldly go where Node man has gone before

#96
post #91
post #82

Earlier quoted context omitted.

If your json doesn't represent something that already follows some known structure, you have an opaque data structure that you have to hand write a parser for in any language.

[deleted]

>you need a number but an external datasource might hand you a number or a string containing a number.

http://stackoverflow.com/questions/9452897/how-to-decode-jso...

the label on the field lets you denote when that will happen, so... it's not quite as difficult as it may seem; you don't have to write a single method for that case.

The type system is a feature, not an obstacle. Yes, you have to specify a type, but as a result, the compiler can perform a lot of checks that, in dynamically typed languages, would either be something you'd handle manually, something that would cause undefined behavior, or something that you would write a unit test to test for. Yes, you could just wing it, unmarshal some data, have an unsafe reference to some field and hope that it performs the way you want it to, but the reality is that things like that are easy in JavaScript because they're wrong. All data inherently has some kind of type, and different languages deal with that in different ways.

but yes, that particular type of thing does come up a lot, and the topic of handling bad json is one that has woefully too litter literature surrounding it (I've had it stump me before on my own projects). Things like "they're using the wrong format for the timestamp" or "that is sometimes string, sometimes null" are stumbling blocks when coming from dynamically typed languages (I'm coming from Python/JavaScript), but in my experience writing Go, the way the language works makes writing bad code much more difficult, and my Go programs have been much more stable, easy to refactor, and easy to maintain forward progress on over a long period of time. After using it for some time, I've come to the conclusion that these types of tradeoffs have been worthwhile. The significant reduction in runtime errors that I've seen in my Go applications compared to my Python applications have more than outweighed the amount of time I would normally spend debugging and testing my Python code, which is tedious and boring.

Re: To boldly go where Node man has gone before

#97

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…

I use Express, because I can make and host a fast web page in 3 minutes, and if I ever come across those fabled unsolvable "scaling problems" I can abandon whatever needs to be rewritten without a second thought. Admittedly this is usually for promotional media and assorted small projects, but it still works great.

Re: To boldly go where Node man has gone before

#99
post #83

Just want to point out one obvious thing that I found very interesting: that the V8 JavaScript engine which makes Node exist in the first place comes from the same company which makes Go.

Google's Robert Griesemer, who worked on the V8 VM, is one of the main contributors to Go.

Re: To boldly go where Node man has gone before

#100

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…

As we are commenting here, the community is assembling by the minute... Go allows you to import "github.com/user/package" and will download and compile the code, so creating a new project is even easier than with node, no need to "npm install ..." first. For a taste of what's out there, see: http://go.pkgdoc.org/index .

I also consider it a huge plus that Go produces a single, statically linked native binary. No fiddling around with directories of libraries and search paths required.
Post reply on HN