Live data from Hacker News

Why We Use Go

bravenewgeek.com

31–40 of 49 posts

Re: Why We Use Go

#31
The author touches on a lot of reasons I think go continues to be used. For me, its the simplicity really.

This ultimate simplicity, and encouraging programmers to write simple code (sometimes, I know, at the cost of having more tedious code) is not all bad.

The "dogma", and the "it's too complicated" parts of go, while sometimes are indeed a frustration. However, I feel like it has kept the language and the culture surrounding the language largely simple. So both a pro and a con in my opinion.

Having worked with go for several years, on many small project and a few large ones. The pros outweigh the cons.

One of the bigger ones for me is simply understanding other people's code rapidly. Go projects seem extraordinarily easy to understand without spending hours reading code. When I am in a position to support/operate/scale/troubleshoot other people's code, which is part of my role, this has been a less challenging experience than other languages.

Re: Why We Use Go

#32
It's good that the author realizes that there is a tradeoff between the complexity of the language and the time and energy needed to bring new programmers up to speed on a project. This is something that gets missed really often.

However, I think the author completely misses the power of composition. It's usually the best alternative if you want to share code between different types in Go. I have written many large go programs without ever using the empty interface or typecasting (except of numeric types, where sometimes you need it because go doesn't ever do implicit conversions between numeric types.)

I agree that the behavior of storing nil in an interface is a wart.

The author spends a long time arguing against the idea that the use of sync and atomic should be discouraged. He claims that it is hypocritical because the standard library uses these packages. But it doesn't seem hypocritical to me to put tricky optimizations into the standard library, but discourage ordinary programmers from writing tricky code in their ordinary applications. The standard library has millions of users; most code has a handful. The tradeoffs are going to be different.

Besides, the author is arguing against a strawman here. Go has always given programmers access to low-level programming resources such as inline assembly, operating-system-specific calls, and even the ability to directly make non-portable Linux system calls. Compare this to Java, where up until very recently, you couldn't even create a symlink without using JNI because the authors were afraid it might be non-portable.

I think micro-benchmarking the performance of channels misses a lot of the point. OK so you have a microbenchmark where mutexes are 30% faster than channels in a tight loop-- and you're willing to give up all the benefits of channels for that? Talk about missing the point. And if your goroutine does anything interesting with what it's pulling out of the channel, this is even more irrelevant.

Re: Why We Use Go

#33
post #5

Earlier quoted context omitted.

Games seem to have a shorter lifespan[1] than PLs. Certainly from an economical perspective. Does the design have to be perfect? No -- just make a good enough game and then make a sequel that incorporates slightly other ideas (and that is always inferior to the original, apparently... or was that for movies). [1] Surviror bias note: we might mostly tend to compare newfangled languages to well-established languages, i…

Games have shorter lifespans because they are consumable: you play them and throw them away. It gets slightly more comparable when there are games on which you can build a business/career (esports-types, MMOs etc). In fact, if you look broadly at the numbers from the last decades, popular games of that type last for roughly 1.5 gamer generations (~10-12 years), and popular programming languages last for roughly 1.5 s…

Esports (at least RTS) games have to be constantly iterated on with regards to balance. That tweaking is probably simple enough when it is things like giving a unit 5 more HP, but the designers can not a priori know how the game will play out on the dedicated, professional level. Maybe what strategies and mechanics that are balanced on the level of "500 hours played" works great at that level, but falls on its face and is inverted at professional levels. Then you are either left with some part of the design that is so broken that no one uses it (underpowered), or force the game into a spectator-unfriendly monoculture of single-strategy, single-unit or whatever the players had to use to adapt.

Designers of competitive RTS games rely incredibly on player feedback. And they are eager to give it.

Re: Why We Use Go

#34

This is a nice take on the language; and doesn't descend into the regular lampooning ("lol no generics") that's found on languagey posts. Kudos! > The attitude of the decision making around the language is unfortunate, and I think Go could really take a page from Rust’s book with respect to its governance model. (I wrote part of Rust's current governance model and was a part of polishing it up; though I wasn't so inv…

What they are getting at is that the Go designers are stubborn and the Rust designers are open-minded... but they don't want to just come out and say that. For instance both had green threads. Rust designers ran into all the problems with them like interop with anything else and interrupts and fairness, so like everybody else that did M:N threading they threw up their hands and said "well it looked like a good idea a…

That's very sad for Rust, because Go's goroutines are amazingly awesome.

Re: Why We Use Go

#35

> Previously, we worked almost exclusively with Python, and after a certain point, it becomes a nightmare. You can bend Python to your will. You can hack it, you can monkey patch it, and you can write remarkably expressive, terse code. It’s also remarkably difficult to maintain and slow. Performance aside which is a weak point of python, the language is certainly not inherently unmaintainable. My most maintainable an…

I primarily use ruby, and I agree it doesn't have to be unmaintainable, but I also think that static typing will eventually win because it's easier to make type systems more powerful and expressive than it is to make programmers smarter or able to fit a larger system in their heads. One reason dynamic typing has so much mindshare is because the comparison was always against Java which not only has some of the most bo…

Personally I think optional typing brings the best of both worlds, I don't see why it's more popular. It's coming to Python with 3.5, using syntax compatible with as early as 3.2, which is fantastic.

Re: Why We Use Go

#36
post #16

> Dynamic typing allows you to quickly build and iterate but lacks the static-analysis tooling needed for larger codebases Large codebases, ewww. Instead separate things into smaller projects, each easily maintainable on it's own.

Openstack is a very good example of a very large python codebase split into smaller projects. But it's still a large codebase. It's still hard to work with different components and the only thing that happens to hold it together are loads and loads of tests and lints which try to come close to what static analysis could provide.

Related - Openstack Swift investigating using Go: http://lists.openstack.org/pipermail/openstack-dev/2015-Apri...

Re: Why We Use Go

#37
post #34

Earlier quoted context omitted.

What they are getting at is that the Go designers are stubborn and the Rust designers are open-minded... but they don't want to just come out and say that. For instance both had green threads. Rust designers ran into all the problems with them like interop with anything else and interrupts and fairness, so like everybody else that did M:N threading they threw up their hands and said "well it looked like a good idea a…

That's very sad for Rust, because Go's goroutines are amazingly awesome.

I firmly believe that moving away from M:N threading was the right decision for Rust. Even if nothing else, the fact that Rust FFI performance is thousands of times faster than cgo alone justifies the decision. There are numerous other reasons (fairness, I/O performance, performance of synchronization primitives, implementation complexity) why just using the OS scheduling is superior for a systems language. The primary benefit of M:N scheduling—fast thread spawning due to small initial stack sizes—requires GC, which Rust doesn't have, and arguably has little to do with M:N scheduling in the first place, given that thread stacks are configurable in the syscall.

Re: Why We Use Go

#38
post #34

Earlier quoted context omitted.

What they are getting at is that the Go designers are stubborn and the Rust designers are open-minded... but they don't want to just come out and say that. For instance both had green threads. Rust designers ran into all the problems with them like interop with anything else and interrupts and fairness, so like everybody else that did M:N threading they threw up their hands and said "well it looked like a good idea a…

That's very sad for Rust, because Go's goroutines are amazingly awesome.

I'm pretty certain green threading can be designed as a library.

However, the choices made by that library need not affect the language as a whole anymore.

Re: Why We Use Go

#39
post #36

Earlier quoted context omitted.

Openstack is a very good example of a very large python codebase split into smaller projects. But it's still a large codebase. It's still hard to work with different components and the only thing that happens to hold it together are loads and loads of tests and lints which try to come close to what static analysis could provide.

Related - Openstack Swift investigating using Go: http://lists.openstack.org/pipermail/openstack-dev/2015-Apri...

Swift has a very fortunate position here. Specifically, the interaction surface is very low (mainly user appSwift and GlanceSwift) and the interface is very restricted. It's just an object store.

It may be a great project for migration, just like Glance (although that one doesn't need that much performance).

The projects I don't think will ever be able to move are Neutron and Nova. Even parts of Nova are so tightly connected that it would need a major redesign before rpc can really split scheduler and other pieces into different projects. Also Keystone probably has too many integration layers / plugins by now to migrate to anything.

(I'm glad that this happened BTW, the more languages in OpenStack, the better isolated and simpler the interfaces will become)

Re: Why We Use Go

#40
post #34

Earlier quoted context omitted.

That's very sad for Rust, because Go's goroutines are amazingly awesome.

I firmly believe that moving away from M:N threading was the right decision for Rust. Even if nothing else, the fact that Rust FFI performance is thousands of times faster than cgo alone justifies the decision. There are numerous other reasons (fairness, I/O performance, performance of synchronization primitives, implementation complexity) why just using the OS scheduling is superior for a systems language. The prima…

I believe you know what you're talking about, and so are right about what's best (or really, even possible) in rust, but I can still be sad that there's not some magic way to have my cake and eat it too.
Post reply on HN