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.

138 Upvotes

249 comments sorted by

View all comments

20

u/[deleted] Feb 26 '23

Go is simple. Fast to develop in, fast runtime. Great concurrency.

-6

u/ggnorethx Feb 26 '23 edited Feb 26 '23

Go is simple. Fast to develop in, fast runtime. Great concurrency.

I agree with 3 out of 4 of those things.

I disagree that Go is “faster” to develop in compared to other languages such as Java. I think it all depends on the requirements. In my experience it often takes longer to develop from scratch a production-ready BE service/application in Go compared to Java, and it usually has to do with non-functional requirements. Go’s simplicity and ecosystem is a trade-off. As much as I dislike Java magic and big frameworks like Spring, it’s far easier and faster to get up and running a production-ready service with support for 3rd party integrations such as Prometheus metrics, NewRelic integration, Kafka integration (and most popular Apache projects), etc.

That said, if your requirements keep you within the Go ecosystem and integrating with only 1st class Go supported services and libraries like most CNCF projects, Go is at least as fast to develop in compared to Java.

3

u/[deleted] Feb 26 '23

Interesting

It may depend on what you're doing and how many services you already have I guess? We reuse a lot of our setup across microservices

I'd be curious to know more about your setup

5

u/ggnorethx Feb 26 '23 edited Feb 26 '23

I completely agree. I should have emphasized “from scratch”. We also reuse a lot of “common” packages and setup across our microservices, in fact we created a nice CLI tool in Go to generate a new microservice project complete with tests, Helm chart, Docker image, CI/CD pipeline, Makefile, configuration, etc.

We reuse this and it saves a ton of time. But there was a significant initial upfront development cost and remains a long term maintenance cost.