5 ms·
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
by johan_larson 12y ago
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?
- pjc50 12y ago- freedom from JVM vulnerabilities and updates - C-style systems programming without C-style catastrophic security bugs - "real binaries"
- sanderjd 12y agoTo 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.
- pjc50 12y agoTrue 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.
- sanderjd 12y agoInteresting! 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++.
- pjmlp 12y ago- 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.
- regularfry 12y agoIt's fast (the whole toolchain, not just the runtime after a warmup), not overly verbose, and, as you say, unsurprising.
- mrweasel 12y agoHonestly 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.
- jbooth 12y agoA 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.
- georgedrummond 12y agoI love bland and hate surprises. One of the features I despise most in Ruby is Monkey Patching since it changes expected behaviour.
- TheHydroImpulse 12y agoGo does not have type inference.
- SixSigma 12y agoBecause 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.
- zak_mc_kracken 12y agoSo 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?
- SixSigma 12y agoSeriously. 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.
- pjmlp 12y agoExcept all those languages failed in the market until Google sponsorship came around.
- laumars 12y agoThese 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.
- rakoo 12y agoWhy 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.
- andrewchambers 12y agoGo 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.
- TheHydroImpulse 12y ago> It is native compilation with no runtime required Go certainly has a runtime!
- andrewchambers 12y agoI meant no runtime installation, it's statically linked.