Hacker News new | ask | show | jobs
by hasenj 5188 days ago
The decrease in productivity with node comes from having to write everything with callbacks. Programming asynchronously is crazy, it makes very simple algorithms very annoying to write.

I'd say it's almost like writing in assembly. You have to write your code in some pseudo code first, synchronously, then translate that into the asynchronous callback spaghetti than node requires.

> Lastly, I would like to know what you find productive about Go, that's not the case with either CS/JS on Node.

Not having to write everything asynchronously?

I haven't actually used go, but the way goroutines communicate (and synchronize) with channels suggests to me (from what I've read/seen) that this callback spaghetti problem is non-existent in Go.

2 comments

> I'd say it's almost like writing in assembly. You have to write your code in some pseudo code first, synchronously, then translate that into the asynchronous callback spaghetti than node requires.

This is a sign of a not-fully-adopted paradigm shift. Like, when someone first learns a new (spoken) language, they translate it to their native language in their head.

Fluent speakers don't translate, they simply understand. Similarly, when you fully grok functional programming, coding with callbacks will cease to feel unnatural.

That said, it does take some getting used to, which is a real cost that needs to be considered when choosing Node.

> Similarly, when you fully grok functional programming, coding with callbacks will cease to feel unnatural.

A minor remark from my experience with functional programming, continuation-passing style is actually something I prefer to avoid.

> Similarly, when you fully grok functional programming, coding with callbacks will cease to feel unnatural.

I don't understand this comment. Javascript, while having first-class functions, does not have call/cc. This is the source of complaints that Javascript encourages callback-spaghetti. As people have mentioned elsewhere, continuation-passing style is meant for compilers, not humans.

Thanks! I couldn't have phrased it any better.

This is why I said it's like writing assembly.

It cracks me up that you haven't tried Go but you're still recommending it, is there a web framework?

Edit: Found web.go. Screw it it's a long weekend, I'll give learning Go a go.

You don't really need a web framework with go. net/http is just fine for most use cases.
I haven't had a pressing need for using it, and I'm considering it as something I want to learn on the side for now.

As for frameworks, it seems the http package comes builtin with a server and a url router. Also, Google's AppEngine supports Go.

web.go is still not compliant with the recently released Go1. I'd recommend anyone interested in Go but not in a hurry to wait a month or two until the Go1 dust settles.