DEV Community

Ido Shamun
Ido Shamun

Posted on

Should I learn Go?

I have been a developer for around 10 years.
In the last few years I've been using especially Javascript and Scala for web development and data processing, I love functional programming.
There is a huge hype now around Go and the popularity is growing.
I am thinking giving it a "go" :P

Let me know what you think, pros/cons, anything...

Top comments (48)

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
 
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!

Collapse
 
rhymes profile image
rhymes

great answer!

Collapse
 
olddutchcap profile image
Onorio Catenacci • Edited

When you ask this sort of question, you're likely to get two types of responses:

Developers for whom Go is a pet language. They'll love it; they'll go on and on about how wonderful it is. Don't get me wrong, I'm sure all the sterling qualities they tell you about will be totally 100% true. Thing is they won't mention the sharp edges and/or the places where the language isn't so great.

The other responses you're likely to get are those who despise Go for whatever reason. They'll point out all the weaknesses of the language--"No interfaces? Are you f***ing joking?"--stuff of that sort. I don't think they'll give you much of a balanced and considered response either.

In short while I understand the desire to figure out if it's worth your time to invest in Go, I think posting the question here is probably the least good way to figure out if it's worth your time. Play with Exercism.io. Look at the number (and quality) of questions asked about the language on Stack Overflow. Try to write something beyond the typical "Hello World" with it and see how it feels.

I have found over the years that chasing the new hotness when it comes to programming language is really a fool's errand. No one knows what will prosper, what will become a footnote and what we all wish would die off already (VB6 anyone?) Learning new stuff is definitely great and I totally agree with you on that. But trying to decide what you should learn based on what's "the next big thing" is sort of foolish. I can't tell you what I'll be working on six months from now. It takes years for a language to develop enough of a following for there to be good jobs writing it. Therefore I think trying to predict what's worth learning based on future job prospects dictates that <sarcasm> we keep on with C# and Java </sarcasm> unless we're really willing to play the long game.

Just my humble opinions of course.

Collapse
 
idoshamun profile image
Ido Shamun

Actually I was looking for the extremists to show up. This way you learn the most about the best and worse of the language.

Collapse
 
rhymes profile image
rhymes • Edited

The language isn't going to change much from what it is now. They will add generics and improve error handling. They will finalize the packaging system. That's it. Don't expect it to change for many years.

Collapse
 
olddutchcap profile image
Onorio Catenacci

:) Then I suspect you're already getting what you wanted!

Collapse
 
idanarye profile image
Idan Arye

+1. One of Go's main selling point is being very easy to get into - so just get into it and form your own opinion!

Collapse
 
ben profile image
Ben Halpern

Go is definitely going to be a big deal for years to come.

I also feel like the Go ecosystem touches on much of the most cutting edge techniques in distributed systems, so I feel like learning it gets you closer to some really interesting things (which pay a lot!)

Gophercon also looks like one of the great software conferences.

I know some Go and have enjoyed the basic experience, but I can't speak too much to the actual language other than second-hand accounts. Haven't gotten that deep.

Collapse
 
idoshamun profile image
Ido Shamun

Could you give an example to cutting edge techniques? Like event sourcing and such?

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

If you've not learned a system level language before, like C or C++, then learning Go is probably a good idea. I have no idea what the language is like, but I'm assuming it exposes concepts you've not yet been exposed to. Even if you end up not using Go, learning new concepts will help you in whatever direction you go.

Don't pick it for hype though. Pick it for learning. And don't hesitate to drop it if isn't helping you in some way.

Collapse
 
idoshamun profile image
Ido Shamun

I have been a C++ programmer for a few years so I know what system level language is like and the whole concept, I actually I like it.

I am not choosing Go because of the hype, I am trying to figure out if there is something behind this hype. The one thing that really caught my eyes is the amazing performance of Go due to the fact it's a system level language.

Collapse
 
derek profile image
derek • Edited

I believe a lot of the hype is sadly due to it's "concurrency" model which is now a buzzword which also ends up getting conflated with another buzzword "parallelism".

Go is definitely a SOLID language (pun intended), but it does have it's warts:

  • πŸ“¦management
  • 🚫generics (yet?)
  • too many ways to declare a var
  • etc, etc

I do think...

There are 2 types of programming languages: one nobody uses and the other everybody complains about - somebody?

Personally, I really enjoy writing Go (for work and play) and being apart of it's community (for work and play).

Collapse
 
rhymes profile image
rhymes

Don't pick it for hype though. Pick it for learning. And don't hesitate to drop it if isn't helping you in some way.

That's what I did, I steered clear of it for a long time because of the hype, now I'm still unsure if I like it because I like it or if I like it because I'm learning something different from the day to day. I'll get to the answer eventually

Collapse
 
drbearhands profile image
DrBearhands

If you're interested in some harsher views of Go I recommend this article, particularly when the author cites Rob Pike.

Myself I've used Go to rewrite a few webservices. Now that I have, I'm considering rewriting again back to node.js or python. Go's just doesn't offer enough safety advantages to warrant its opinionated style constraints - which often violate gestalt principles - or its unwieldy syntax.

To me, Go appears to be created to satisfy a political/marketing goal rather than a technical one, namely to (a) draw programmers from java and (b) allow companies to hire less capable (cheaper) developers, by keeping the language very simple/restricted and forcing certain style choices.

This isn't necessarily bad, it has been proven that teams with diverse level of experience perform best. But I personally feel that Go isn't promoting diversity, it's promoting 'simple' work, as there is no way for 'more experienced' programmers to use the tools they want in Go.

However, based on salaries for the adverts I've seen in my country over the last year, learning Go as a career move does appear to make sense.

Collapse
 
rhymes profile image
rhymes

I don't know if initially Go was created for marketing reasons or not, but the simplicity and the forced style can be a plus in the long run. All code looks the same, the difference is what the code does, not how it is written in the page.

You can still name functions and variable counter intuitevely to make it obscure :D

Collapse
 
idoshamun profile image
Ido Shamun

I'll go over the post, thanks!

Collapse
 
wapgui profile image
Torsten Schmidt

I'm a scala developer and other colleagues are doing kotlin and java. Unfortunately we have a codebase, from an external company working for us, with 75% Go code, so we have to handle that. Luckily I have not done so much until now, but I can hear my colleagues crying out a least twice a day "What a shit is this?". Maybe the code is bad, structs are copy&pasted, error handling is primitive and the lack a high level programming language features. It's good for a quick hack like importing data.
Maybe you should have a look on Rust. Same performance but a lot better designed.

Collapse
 
idoshamun profile image
Ido Shamun

You made me laugh imagining your colleagues shouting out loud

Collapse
 
pbnj profile image
Peter Benjamin (they/them)

Like any tool, Go has pros and cons, use it where it shines the most.

Notice: some of these pros/cons in and of themselves are not unique to Go, but the combination with others is what sets Go, as a whole package, apart from other languages.

Pros:

  • Easy to learn. Go has a small learning surface area, thus not as a steep learning curve as other languages.
  • Productive language. Allows you to Get Shit DoneTM with little to no ceremony.
  • Safe language. No manual memory management.
  • Fast language. Micro-benchmarks show that it does not trail far behind C/C++.
  • First-class concurrency primitives. Concurrency is well-designed and built-in, not a library/module.
  • Fast build times.
  • Easy deployments. Compile to your target OS and arch and Just Ship ItTM.
  • Tooling, ecosystem, and libraries around Go are mature, stable, and generally high quality.
  • Because of the above perks, many are predicting it will be the go-to language for cloud-native projects, due to its lower barrier-to-entry and easier scaling efforts across massive distributed systems.

Cons:

  • The Go team resisted including package management in the language around v1.0, claiming that it was a community problem, not a language problem, and the community needed to solve it. Well, this led to at least 15 package management tools with different specs. The Go team has realized the need for this and are actively working on adding official package management support in the next minor version or two. It's in beta in the current version 1.11
  • No generics. Depending on who you talk to, some may agree that it's a negative, others may shrug their shoulders in indifference. I am in the latter camp, but the Go team is also open to some form of generics primitive that fits within the language's design.

There are Go Surveys for 2016 and 2017 that may reveal some additional insights into what the Go community thinks are the pros and cons of the language.

Collapse
 
leob profile image
leob • Edited

I'm in the camp saying that no generics is a huge missed opportunity, especially because it wouldn't be that difficult to add and IMO doesn't make the language that much more complicated to learn (hardly, I would say). No generics means we're still coding old-fashioned "for" loops all the time, instead of using the powerful data manipulation abstractions (map, filter, reduce etc) which virtually every other modern language offers. Go is nice, but give us generics and it will be a dozen times nicer!

Collapse
 
abdurrahmaanj profile image
Abdur-Rahmaan Janhangeer

oh i thought go was an evolved py, i think that package story showed some different thing

Collapse
 
theodesp profile image
Theofanis Despoudis

I think you should learn Go as it's the exact opposite of Scala but it teaches your classic procedural programming. I'm now learning Scala and Scheme after learning Go as I feel that I need to learn more about functional programming

Collapse
 
idoshamun profile image
Ido Shamun

The only problem is that I love functional πŸ˜‚

Collapse
 
theodesp profile image
Theofanis Despoudis • Edited

Well If you can be contented with closures but no lambdas , explicit type specification in functions, no sum types etc. you will be fine!

Collapse
 
rhymes profile image
rhymes • Edited

You can do a bit of functional programming in Go: medium.com/@geisonfgfg/functional-...

Collapse
 
virepri profile image
Adele Reed

Yes! You absolutely should learn Go. It's probably my favorite programming language, so I may be biased, but I adore the top notch and frankly first class support for multi-threading and concurrency.

It's actually caused me to start developing my applications significantly differently (I may write an article on my "layer-cake" design theory at some point in the future)

Collapse
 
idoshamun profile image
Ido Shamun

Sounds interesting, looking forward :)

Collapse
 
bgadrian profile image
Adrian B.G.

Yes, especially if you care about the engineering problems that Go try to solve in the Cloud.

Also it only has around 15 keywords, extremely simple to learn. While you were reading this article comments you could have learn 40% of Go.

Most haters will pinpoint superficial reasons, but once you understand why Go is this way you will appreciate its simplicity and see that there is no other way to solve them.
Most design decisions will enforce the devs to build a robust, easy to maintain codebase.

Who compares Go to C has no idea what he is talking about, I haven't see any C support for lambda functions, but I saw projects that had 80000LOC of C for a database connection transformed to 20LOC of Go. Most probably you will not see fridges and microwave software written in Go either.

Also based on your previous language experience you will appreciate the builtin tools and the new package management system, which compared to JS nightmare are a bliss.

Collapse
 
leob profile image
leob • Edited

Go is nice, but do have a look at Rust!

What strikes me the most about Go - virtually no support for FP (functional programming).

Nowadays almost every programming language seems to have map/filter/reduce etcetera, so one of the first things I did when learning Go was look for those - but it's not there, everything's coded with old-fashioned imperative loops. This seems definitely a step back.

There are workarounds (code generation) but it's a kludge, what's sorely missing in the language is generics.

I know generics are on the Go 2 roadmap, the moment they add those a huge swath of reluctant people will convert to Go instantaneously, it's really a no-brainer.

In the meantime Rust might be an alternative, it's way more complex than Go but it's interesting and very well designed.

P.S. I just realized that Go doesn't have a ternary operator (value = x > 0 ? x : -x) ... confirmed by a StackOverflow answer. This is just an example of the fact that Go is simple, but in my opinion TOO simple. Choices like these mean that as a programmer you're forced to write a lot of verbose code and boilerplate. The more I think about it, the better Rust looks as an alternative ...

Collapse
 
tojacob profile image
Jacob Samuel G.

I had Go on my roadmap, but I changed it to Rust after reading experiences and opinions. This is just a comment, of course, I can not talk more on either of them.

Collapse
 
nklite profile image
Nikhil Joshi

If you have knowledge of any more complicated languages like C or C++, then working on Golang is not usefull, unless your particular job or the job you want to pursue is using it.

With time any language that has gc and other things like this (stack growing/shrinking etc) are bound to become complicated (much more than your C/C++).

At one point Java was easy and the next hot thing, look at where it is today... that Java of early years is probably Go of today.

Instead get to know a new "type" of language. Something that is different and solves a well defined and different usecase. (for eg. if you know many imperative languages, try functional, if you know functional and imperative, try some mathematical language like matlab etc...)

Collapse
 
niorad profile image
Antonio Radovcic

I like Go.

I'm not using it professionally, though (only using JS at work).

When I started learning it I made a favicon-to-ascii-converter and a service for getting Spotify-Auth-Tokens for a React-App. Both went pretty smoothly and I sticked to it. My latest project is a 2D-game I'm doing with SDL2.

The Pros I see for myself:

  • I usually code in a procedural and compression-oriented style, so I think it fits my boring way of thinking.
  • No exceptions
  • I don't have to think about formatting at all
  • There's bindings for lots of stuff (QT, SDL2..)
  • Quick build-time, at least for my small projects.
  • VSCode and Goland/IntelliJ are great tools
  • Easy to get productive with

The cons:

  • Too strict sometimes. "Use that variable or I won't build". (The great thing about C in contrast is, no matter how dangerous or uncommon something is, you can always "do the thing")
  • Slices are somewhat uncommon IMHO and I'm not sure I understood them completely yet.

Check out Michael Fogleman for lots of great Go-code

Also a great learning resource: usegolang.com/ (Full Web-App with Go)
And what I'm currently doing: interpreterbook.com/ (Writing a basic interpreter in Go)

Collapse
 
idoshamun profile image
Ido Shamun

Thanks for sharing the materials and the great write-up

Collapse
 
progrium profile image
Jeff Lindsay

I think you have no reason not to.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.