Live data from Hacker News

One year after switching from Java to Go

glasskube.dev

431–440 of 503 posts

Re: One year after switching from Java to Go

#431
post #68

I'm pretty fond of Java; it's definitely a superior language to Go if you ask me, which I've also written a ton of code in. But I stay away from Spring Boot, end the entire EE stack of crap that came before it, if at all possible. I've had more success adding whatever I need on top of embedded Jetty. It's mostly a cultural problem, no one is forcing you to go the AdapterFacadeInjectionBuilderWhatever way. I've been w…

I've written ORMs for both Java and Go and agree that Java is a wonderful language with a much more complete type system than Go. However, it feels like Java web development teams typically suffer from not having their own Wagtail/Payload/etc and build way too much from scratch. Maybe there is some great open source framework+CMS out there making waves in Java land that I'm unaware of?

But Javas has so many of these web frameworks?!

* Spring (https://spring.io/)

* Spring Boot (https://spring.io/projects/spring-boot)

* Helidon (https://helidon.io/)

* Micronaut (https://micronaut.io/)

* Quarkus (https://quarkus.io/)

* JHipster (https://www.jhipster.tech/)

* Vaadin (https://vaadin.com/)

That's just to mention the bigger ones, there's lots of mini frameworks like Javalin (https://javalin.io/) and Dropwizard (https://www.dropwizard.io/en/stable/)...

There's even the previous generation of big app servers like Weblogic and JBoss.

It's just incredibly weird for me to see someone say Java is missing some sort of framework, it just has EVERY kind you can probably imagine.

Re: One year after switching from Java to Go

#432

Earlier quoted context omitted.

I think we can sum it this way. The blog post writer's intuition was correct: if you write two equivalent Go and and JVM programs, the Go program would use less heap memory and have faster startup times. What they are incorrect about is the extent of these claims. It is obvious that most of the memory and startup overhead in their software comes from Spring, rather than the JVM. The JVM is probably not an ideal platf…

Rust has its uses but why would you write infra code in Rust when Go is used for most of it, and is just much more ergonomic and fast to work with. The iteration times with Rust are quite detrimental. On the other hand, most of k8s' ecosystem is in Go. I don't like commenting in language-war territory things but I found your comment surprising. "Rust or JVM" for infra isn't a dichotomy I would expect.

Discord had a pretty famous transition from Go to Rust [0].

[0] https://discord.com/blog/why-discord-is-switching-from-go-to...

Re: One year after switching from Java to Go

#433
post #23

Earlier quoted context omitted.

After dealing with constant build issues with Go, I hate Go so much. The fact that they've conflated "source code" with "consumable library" means that you need a special case in your CI to publish new versions of a library in Go vs. every other language that builds and publishes an executable, and any tooling that pulls from a private repository has to hack `git config` rather than authenticating like you would any…

I’m confused by this. Go doesn’t have a “publish a library” step, whereas every other language does. Is “noop” the special case you are referring to? And why are you comparing publishing a library in Go to publishing executables in other languages? > unidiomatic to continue developing your packages after you publish them Are you talking about publishing breaking changes without bumping the major version? Because that…

> Is “noop” the special case you are referring to?

"Well, yes, but actually no". It's _not_ a noop - to publish a new version of a library in GoLang requires tagging a commit in the source code repo. This, in turn, is tricky because there's no way to review a version bump during PR - unlike, say, JavaScript where a PR makes a change to `package.json`'s `version` field (which will be used to determine the version of the resultant built library), there is no in-code representation of what the version "will be when merged" of a change being reviewed. We've resorted to hacking-in a `version.txt` file which is updated and read by our version bump automation.

But that's not all! When making a _major_ version bump in a library, you also need to change the `module` line in your own `go.mod` to have a trailing `/v` (e.g. https://github.com/Masterminds/semver/blob/master/go.mod#L1). Another special case - every other language's generic version bump automation logic is "update to hold the version", Go's is "IF bump is major, THEN update go.mod to hold the major version".

This is separate from the awkwardness that comes from "publishing" via source code vs. publishing to a binary repository, where the difficulty arises from `go mod download` needing to authenticate to GitHub, whereas every other language's build tools authenticate to the location where built libraries are stored (Artifactory etc.)

So, yeah, in fairness there are actually two separate annoyances here that I mistakenly represented as the same - "recording version in tags makes it impossible to review the version-bump _of_ a change-in-review" and "publishing source code directly, rather than built libraries, means pulling dependencies from private repositories requires messing with authentication". Forgive me - there are just so many friction points in GoLang's development process, it's hard to keep them straight.

> why are you comparing publishing a library in Go to publishing executables in other languages?

Eh - I guess my terminology was off there. I considered and avoided using the word "binary" instead of "executable" because idk if every language uses a binary format to represent the result of building their libraries. The distinction I was trying to draw was between languages that have a transformation process (building/compiling/assembling/whatever) which turns "source code" into "a that other code can depend on", and GoLang which...doesn't do that. To be explicit - yes, in all cases I'm talking about building and publishing the consumable representation _of_ a library repository.

> Are you talking about publishing breaking changes without bumping the major version?

No, I'm not. I agree that breaking changes need to be accompanied by a Major Version increment. I'm talking about how cumbersome it is in GoLang _to_ bump the major version that you depend on of a dependency library. You don't just have to update the dependency in your go.mod to `github.com/foo/bar v2.0.0`. Because the import path _includes_ the version, you need to update all the `import` statements throughout your code to use the new `github.com/foo/bar/v2` path. Pointless busywork - even worse than the endless `if err != nil` statements which can be defended on the tenuous grounds that they prompt an author to think about how to handle their errors - this import path change is _truly_ useless as a method to catch errors because, if there is a syntax-breaking change in the depended-upon code, that will be caught at build-time _anyway_.

An update to the major version of a library that you depend on is a Big Change, and should be treated with caution. I'm not advocating for doing it blindly or casually. But I don't believe that forcing a basically-cosmetic change to all the import statements _of_ the consumed module does anything to ensure caution.

Re: One year after switching from Java to Go

#434
post #10

Has anybody spotted a similar story of switching from C# to go? As someone who is very fond of C#, I'm definitely curious what I'm missing out on.

It’s mostly the other way around. Go is a strictly worse, caveman experience after C#. In it’s best moments, Go is a sidegrade at most.

Go look at httpclient for .NET core 4.8

I mean, just the star count on GitHub is enough to show what the developer community thinks.

Re: One year after switching from Java to Go

#435
post #53

Earlier quoted context omitted.

Btw js/ts, python, and golang, which one do you find more productive with?

Hard to pick between Python and TypeScript - they have different strengths. TypeScript's type system is more useful (you'd hope, given the name!), but Python "just works" more often for simple use-cases IME (though I have well over double the lifetime experience with Python, so that might be a me-factor rather than a language factor).

Baffling. If you're seriously saying package management for python "just works" and for go "always breaks"... I guess your either a troll, or you've never written production software. And I'm not talking some clever Jupiter notebooks used for some internal auditing or whatnot, I'm talking about customer facing software used by _at least_ 100 people. I'm 12 years in the game and Python has always caused me nothing but pain, while Go hasnt ever cost me a second of afterthought, working in multiple environments after nothing more than git clone. But, if you like making "virtual environments", a horrible shim gimmick which wasnt even supported by the language itself originally, be my guest!

Re: One year after switching from Java to Go

#436

Earlier quoted context omitted.

It’s mostly the other way around. Go is a strictly worse, caveman experience after C#. In it’s best moments, Go is a sidegrade at most.

Go look at httpclient for .NET core 4.8 I mean, just the star count on GitHub is enough to show what the developer community thinks.

There is no such thing as “.NET Core 4.8”. There is no such thing as HttpClient’s GitHub repository either - HttpClient was never a separate project and was introduced into the standard library 12.5 years ago as the replacement to then aging WebRequest which had been around since version 1.1.

If you’re interested, .NET’s source code is hosted here: https://github.com/dotnet with the main repositories being runtime, roslyn, fsharp and sdk.

Re: One year after switching from Java to Go

#437

Earlier quoted context omitted.

> I tend to say that ultra-framework kills people's expertise and in the long term hardly saves resources. You can use as much of Spring or as little as you want. Don't want Hibernate? Use JDBC template. I have noticed that people who don't use a framework, just end up inventing their own bespoke framework, which unlike Spring, is not documented and has no help available online.

It's a paradox as old as time itself. Otherwise intelligent devs assume they can do a better job without all the "complication" and "bloat", but then just end up with homegrown unmaintainable crap that does half of what the frameworks offer for significantly more effort. It's either stupidity or arrogance.

Agree. I have seen same thing where many people maintain a home grown crap called kitchen and think they can do better job than getting ready meal from restaurant.

Developers should not be writing code. Period.

Stupidity and arrogance is ruling everywhere.

Re: One year after switching from Java to Go

#438
post #215

Going back to first principles, nominal typing is what I miss most with Go. I get the utility of structs + interfaces + structural typing, but most of the time there is more benefit in declaring that a type nominally implements an interface when that is the intention. Code is far easier to read and understand that way, both for developers and tooling. I suppose exclusively structural typing would be more acceptable i…

While having to declare the interfaces a type implements can increase the readability, it comes with a huge drawback: you are limited to implementing the interfaces considered when writing the code. In my eyes it is a fascinating and important feature that you can add interfaces and all existing types automatically implement them, if they, by their methods signature, implement them. You don't have to edit their type…

>it comes with a huge drawback: you are limited to implementing the interfaces considered when writing the code

Huge drawback? Quite the opposite. Unintentional implementation is a terrible trade for readability and type-safety, hence the trick the prior commenter mentioned.

In fact, structural typing is best when limited to the far less used case where an interface is designed to reflect functions from existing types. It's useful here, otherwise it's a hinderance for the primary case where a type _intends_ to implement an interface, which is what nominal typing is for.

Go was designed as a systems language, and the choice for structural typing served that goal in terms of performance enhancements. But used as a general purpose language, as the trick above (and others) demonstrate, Go's structural typing is less suitable compared with nominal typing.

Re: One year after switching from Java to Go

#439
post #431

Earlier quoted context omitted.

I've written ORMs for both Java and Go and agree that Java is a wonderful language with a much more complete type system than Go. However, it feels like Java web development teams typically suffer from not having their own Wagtail/Payload/etc and build way too much from scratch. Maybe there is some great open source framework+CMS out there making waves in Java land that I'm unaware of?

But Javas has so many of these web frameworks?! * Spring ( https://spring.io/ ) * Spring Boot ( https://spring.io/projects/spring-boot ) * Helidon ( https://helidon.io/ ) * Micronaut ( https://micronaut.io/ ) * Quarkus ( https://quarkus.io/ ) * JHipster ( https://www.jhipster.tech/ ) * Vaadin ( https://vaadin.com/ ) That's just to mention the bigger ones, there's lots of mini frameworks like Javalin ( https://javalin…

Framework _and_ CMS so most of these don't seem to apply. I haven't seen Vaadin before so that's interesting. JHipster seems like the closest to the ones I mentioned but the UI looks unpolished in the overview video.

Re: One year after switching from Java to Go

#440
post #318

Earlier quoted context omitted.

That is actually enterprise culture, using Go won't make a difference in the enterprise space. Ever looked into Kubernetes source code?

At a former job, my coworkers successfully wrote Java in Python.

Tell me you worked at Google without telling me you worked at Google
Post reply on HN