Hacker News new | past | comments | ask | show | jobs | submit login

Why Go?

I had a chance to do a bit of Go a year or so ago, and found the language very (how to put it?) bland. There just didn't seem to be anything surprising or obviously better about it.

If the alternative is C++, I can understand the appeal of garbage collection and getting away from the complexities of the STL. But Java provides both. Anyone want to make the case for Go over Java?




A lot of us love bland. Personally working on Scala for my day job and I curse the authors every time I see some neato feature that's been abused by a bored dev or a dev on a deadline.

As far as Go over Java, in terms of differences:

1) Error codes instead of exceptions, big difference, puts Go more in the 'write a server' than 'write an application' category although those lines have been blurred

2) Duck typed interfaces, type inference, automatic delegation and whole bunch of useful little things that make Go, IMO, "Java done right". Regardless of the fact that most of the Go community would want to punch me for calling it that. Go's conventions encourage 2010s Java, Java can sometimes encourage 1990s java.

3) Goroutines being first class is quite different from always instantiating/passing-around an ExecutorService.

4) First class functions and lambdas, although lambdas are a little less useful for not having generics.


I love bland and hate surprises.

One of the features I despise most in Ruby is Monkey Patching since it changes expected behaviour.


Go does not have type inference.


These days a lot of the decisions behind which language a person chooses are down to personal preference. So the following points I raise are my personal preferences rather than stating one approach is "better" than another:

For me, that blandness brings great simplicity - which makes it refreshingly easy to learn and write code in that language. It also helps with those "what the hell was I drinking when I wrote that code" moments that even the best of us suffer from time to time.

Also I love the brevity of the code required to build something in Go. I find Java frustratingly verbose.

Lastly, Java is in many ways more portable than Go (compiled Jar's are platform independent and JRE's have been ported to more platforms than Go's compiler), Go's compiler makes targeting other OS's and architectures a doddle plus it's sometimes more convenient to ship a static ELF / PE without worrying about having the appropriate runtime environment at the destination.

There are some things I miss from Go that are present in Java (amongst other languages) such as better support for GUI development, more flexible namespaces and such like. But, for now, Go addresses more desires than it creates complaints.


- freedom from JVM vulnerabilities and updates

- C-style systems programming without C-style catastrophic security bugs

- "real binaries"


To expand on "real binaries" a bit. It's somewhat ironic, but distributing statically compiled binaries for common systems is actually easier than distributing source (or bytecode) for VM-based languages like Python, Ruby, and Java.


True statically compiled Linux binaries for complex applications are surprisingly hard; libnss insists on dynamically loading, and libstdc++ doesn't like it either. I think we ended up with unpleasant RPATH hacks to load the copy of the standard libraries that shipped alongside the app rather than the system ones.


Interesting! Thanks for the info. I've never run into trouble myself, but I've never tried to link a go application to libnss or libstdc++.


- there are lots of JVMs to choose from.

- also possible in Java via Unsafe package, which is being promoted to official package in Java 9

- Excelsior JET, Atego JVM, RoboVM and many others AOT compilers do exist for Java.


Honestly I hadn't thought about it like that, but I would say you're mostly right. It is pretty bland and there's no surprises (or at least only a few), but isn't that a good feature in programming language?

I think it's better than say C og C++, because I have an easier time understand and writing Go, but that's very individual and may not apply to others. I don't like Java because of it's verbosity and overly complex ways of doing simple things, but I haven't looked at Java for years, so that may have changed.


Why X ?

Focusing on X is the wrong thing to do. What has attracted people to Go is the fact that you can build stuff

- quickly

- with good performances

- easily deployable

- reasonably solid

- can be shared and understood between a lot of engineers at the same time

This featureset seems to match with Go. I have very little experience with other languages, so I can't say Go is the only one that can do it all.

As for what the Go language is, allows or does... that's really not the point. What matters is what you build with it and how you can build it.


It's fast (the whole toolchain, not just the runtime after a warmup), not overly verbose, and, as you say, unsurprising.


Go is nice because:

1. Its build tool is simple. 2. It compiles incredibly fast. 3. It is native compilation with no runtime required. 4. It enforces uniform code formatting, and is strict with no compile warnings. 5. It has a standard build tool and standard test tool. 6. It has a standard documentation tool. 7. Only requires a single environment variable GOPATH for all autocompletion to work out of the box WITHOUT an IDE. No IDE project files necessary. 8. Its a decent language that can be learnt quickly. 9. It has CSP.

You are criticizing point 8 out of context, Go is a sum of its parts.


> It is native compilation with no runtime required

Go certainly has a runtime!


I meant no runtime installation, it's statically linked.


Because Rob Pike made it. And Bjarne Stroustrup didn't.

Rob and Bjarne know each other from Bjarne's time in the Unix lab. The had philosophical differences, Rob tells of Bjarne's storming outbox a conversation.

Some of us trust Rob's judgement, having been treated kindly by it before, so we will walk down his path and trust where it is leading. When Russ Cox joins us, we know for sure that the path will be safe and the walk will do us good.


So you're using a language just because you have some admiration for what its creator accomplished in the past? Even though what he did has nothing to do with languages?

Seriously?


Seriously.

But because Go is the latest of Rob's languages and have spent over 20 years using previous works. It is a relationship built on trust in the concepts. Tackling a language take commitment so it is reassuring when it is built by a team that you trust.


Except all those languages failed in the market until Google sponsorship came around.


Depends which market. They're used on IBM's Blue Gene, in Sandia Labs supercomputer centre, Los Alamos Super computer centre, at NASA JPL, ran the lighting at Sydney Olympics, are used in Lucent's mobile phones masts.


I didn't knew Alef and Limbo had so much users.


Limbo moreso than Alef.

And Plan9's C dialect is also under Rob's tutelage.


I was being ironic. Never saw Plan 9 and its eco-system having any commercial success.

Actually, I wonder how much money Vita Nuova makes out from Inferno.


Vita Nuova is now just one guy, Charles, but I know he makes a living himself working on/consulting for the systems I mentioned. His colleague Rog Peppe, now works for Canonical doing Go.

As I mentioned, Plan9 is used on a few super computer systems for IBM and the DoD.


This industry doesn't need more cults of personality.


I'm just answering the question with honesty and I'm not the only person using Go on the strength of Pike.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: