by codecurve · 10y ago · 0 comments
Many of these "solved problems" have also been solved with the other languages, albeit not always at the surface level. For Node specifically:
WebSockets -> SockJS, Socket/Engine.io
Concurrency -> Generator Functions
Testing -> import assert from 'assert' and npm test
Syntax -> Some great improvements with ES6 and solid styleguides (airbnb, standard) + eslint as an autoformatter
The major win here for Go is that as a new platform it was designed with simplicity in mind. These features are probably easier to pick up in Go than any of the alternatives, which is great. However, don't make the mistake of thinking that Go is the first language to solve these problems.
We are also web developers on those stacks.
I mean, tell me the equivalent Java code to this:
resp, err := http.Post("http://example.com/upload", "image/jpeg", &buf)
I think that would be about 20 lines in Java. You've got to make a `HttpUrlConnection`, then call `setDoInput(true)` (or is that `setDoOutput(true)`), wrap it in a `try`, etc. etc. etc.Go's standard library is amazing.
Nothing prevents you to wrap those 20 lines in a generic method.
Also there are other options in Clojure, Scala, Kotlin, Groovy besides pure JDK API calls. Here Scala style, easy to mimic in Java 8
val result = http.postData("http://example.comupload").header("Content-Type", "image/jpeg").responseCode
> Go's standard library is amazing.So amazing that is doesn't have proper database drivers for the SQL databases that matter.
Request request = new Request.Builder()
.url("http://example.com/upload")
.post(RequestBody.create(IMAGE_JPEG, file)
.build();
Response response = new OkHttpClient().newCall(request).execute();
But yes Go's standard library is cool, but Java's ecosystem is too, and larger.Ruby doesn't have "built in concurrency"? Ruby has fully native threads; it just has the GIL that blocks for IO (but you could use jRuby). It gives you several options for message passing. You also have the extremely under-rated dRuby system. Not to mention the whole EventMachine world.
Node is "close" to concurrent? It's god damn single-threaded! At the very least it's possible to spawn multiple processes and communicate over a Unix socket, good luck doing something like that with PHP. What does socket.io have to do with anything?
Sorry man, I'm hearing a lot of cargo cult opinions and precious little data to back it up.
Seriously. Pretty much all languages have support for concurrency via threads. Ruby even have the equivalent of channels since a decade: http://ruby-doc.org/core-2.2.0/Queue.html
Now if you meant to talk about the GIL, well it prevent parallelism only for purely CPU bound tasks. And in the context of a web app, if I have a CPU bound tasks that I can just fire and forget, I don't want to execute it on my frontend server anyway.
> Seriously. Pretty much all languages have support for concurrency via threads.
You missed the most important point: like Go does
I do have fun bashing Go, but I also use it. It's too practical not to. And the Go team, above all other of the latest wave of language that are ready for production, got that 100% right. I just can't overstate how simple Go makes setup, deployment, and updates. And how complex Elixir is in comparison.
I wish Elixir et al. could have a zero dependency, zero external configuration, and single/xcopy file deployment too.
yeah no, please compare node/ruby whatever to modern PHP and not some ancient versions you used some time ago. Modern PHP is very much up there.
At a glance his previous articles seem to be about Go and PHP (with a little bit of shell scripting) as well, so GP's point seems to stand.