- cross-posted to:
- programming@lemmy.ml
- cross-posted to:
- programming@lemmy.ml
I honestly don’t understand the hype around golang. Can anyone ELI5? (longtime C++ and Python user, now doing Rust)
I think, and this is by no means intended to be disrespectful, golang attracts a lot of programmers that do not want to learn a lot of things. They just want to write something down and it be fast, they don’t mind edgecases, security bugs, performance bottlenecks and all that stuff. A JS dev that was called “scriptkiddie” some years ago might now be a go developer.
And there’s nothing wrong with that, IMO… What bugs me all the time though is that they claim that golang is the superior language and should be used for allthethings^tm. It should definitively not.
On the other hand, I don’t claim that Rust should be used for all the things (I sometimes claim for the memes, to be honest, but that’s not too serious). It definitively has a learning curve and sometimes writing down your 50 LOC of Ruby/Python/Bash might be a better choice. But (as the tagline once was), Rust is good when it matters. And it matters often (IMO).
Go was designed with simpleness in mind. C++ and Java were already really complex in 2009 when Google started the development of Go. For example, Go has fewer keywords than C and is easy to learn in about an afternoon.
The second point is compilation time. C and C++ (and Java) have quite slow compilers which slows down the development process of large projects significantly. Go sacrifices some runtime performance in exchange for a very fast development cycle.
Third, Go introduced a very easy-to-use concurrency system. Goroutines (and channels as main communication method) are really good for writing asynchronous code (e.g. doing a lot of I/O or networking).
And fourth, Go has a comprehensive standard library that also includes an HTTP server/client, a template engine, a database wrapper, out-of-the-box support for common serialization formats, compression algorithms, cryptography and more (see yourself).
It’s somewhat like the best of C++ and Python combined—easy to learn/use, batteries included (and if not, there is almost always a lib for your problem) while still being fast and efficient.