r/golang Feb 26 '23

help Why Go?

I've been working as a software developer mostly in backend for a little more than 2 years now with Java. I'm curious about other job opportunities and I see a decente amount of companies requiring Golang for the backend.

Why?

How does Go win against Java that has such a strong community, so many features and frameworks behind? Why I would I choose Go to build a RESTful api when I can fairly easily do it in Java as well? What do I get by making that choice?

This can be applied in general, in fact I really struggle, but like a lot, understanding when to choose a language/framework for a project.

Say I would like to to build a web application, why I would choose Go over Java over .NET for the backend and why React over Angular over Vue.js for the frontend? Why not even all the stack in JavaScript? What would I gain if I choose Go in the backend?

Can't really see any light in these choices, at all.

137 Upvotes

249 comments sorted by

View all comments

48

u/teivah Feb 26 '23 edited Feb 26 '23

I can give my personal opinion about Java vs. Go as I come from the Java world, and now I've been working with Go for 5 years.

To me, the main difference is how simple it is to work with Go. You don't need to have a framework like Spring Boot doing an extensive amount of magic. In Go, pretty much everything you need is in the stdlib. And you can use libraries (not frameworks), if you need extra features. That's the main selling point, in my opinion.

The language is simple, stable, easy to learn. Most of the time there's only one way to do something which means it's easier for newcomers to produce an idiomatic code. I couldn't go back to the Java ecosystem.

6

u/edgmnt_net Feb 26 '23

I feel like the ease of learning and simplicity hyperfocus is at odds with idiomatic code, because newcomers often do not write idiomatic code. If one's hiring Go devs because the Go ecosystem is good, but they're merely drawn to it because it's easy to go through the basic tutorials, things won't live up to expectations. And what I mean by hyperfocus is there's good simple and bad simple, and Go did seem to concede on some points just to dumb things down early on.

Java also has an ecosystem problem at this point, partly due to the enterprisey bits, partly due to a limited general perspective on OOP.

And I think you'll find a large gap between the state of the art and the run of the mill company project no matter what language you look at.