DEV Community

Discussion on: Should I learn Go?

Collapse
 
quii profile image
Chris James • Edited

My situation was quite similar to you, I was born for this question.

Overall had about 8 years experience at the time, about 4 of which was Scala.

I really love(d) Scala, wonderfully expressive, so much to learn about category theory and generally how to write software in a very "sound" way.

But it's not without it's problems right? It's hard in a big team because it's a difficult language where there are about 10 ways to write something. A lot of bikeshedding will occur on teams when one side thinks you should use Akka, another play, etc etc. Plus the compilation times are quite slow and the tooling around it is difficult and awkward (sbt).

The project I was working on had a fairly extensive test suite, coupled with the compilation times I could be waiting 15 minutes for a full build.

Whilst playing foosball was fun I eventually started learning Go in between the builds. (yes, really!)

Go, for better or worse is almost the opposite of Scala

  • The tooling is extremely good. It's simple to build, test, format, document and benchmark software. Deployment is also very easy
  • The compilation times are very fast. Feedback loops are excellent
  • The standard library is simple and thoughtful. The Scala standard library is pretty good to be fair, but there are so many options for making a web server for instance. In Go it is all built in, you can get extremely far with the stdlib (including testing).
  • This is very beneficial coupled with the backward compatability guarantee because it means there are lots of high quality tutorials that will always be correct. No longer looking at old tutorials around Play! In addition no pain of lack of binary comaptability of libraries when upgrading language versions which i recall being extremely annoying when going from scala 2.8 to 2.10!
  • The language is very simple. There's a very small amount of keywords and constructs compared to Scala
  • Interface resolution is impliclit. You dont say "My Foo implements bar", if your foo has the correct methods it just does. This turns out to be quite nice.

So what's it like for a Scala developer writing Go?

You'll love the feedback loops, but you'll hate writing loops. There's no generics (yet, but they are planned) so you have to write a lot of code you wouldn't have to in Scala.

The ability to build abstractions is far lower than Scala. So you'll end up writing what you'll consider boilerplate. Still you'll end up writing a lot less than you think because the standard library is excellent. Compared to the baggage around the JDK and whatever libraries you choose to bring in the overall cognitive load is a lot lower

Have a look at this todo server code

This is something I hacked together last week. Yes there are for loops. But that is all the code that is needed. You can build that one file and deploy it and you have your web server. No dependencies. All very standard Go that you can find tutorials on how to write it. I didn't have to think at all.

For me, learning Go made me re-evaluate what's important about a programming language. Syntax and expressiveness like in Scala are nice traits and have their uses but a language's ecosystem has a much bigger impact on your ability to just ship stuff. To this day I still have more experience writing Scala than Go but if I was making a product for myself I would pick Go in a heartbeat because it just makes producing robust, fast and simple to maintain software easy

Collapse
 
rhymes profile image
rhymes

great answer!

Collapse
 
idoshamun profile image
Ido Shamun

I read somewhere that Go developers "just get the shit done".
By reading your comment I can understand that this is actually the reality.
Sounds like that we are very much a like experience wise and I am totally familiar with what you describe.

Thanks!