5 ms·
I'd like to hear some Java devs opinions on Go. On one hand I'd like to try and learn something new, on the other hand, everything I could do in go I would pr
by premek 6y ago
I'd like to hear some Java devs opinions on Go.
On one hand I'd like to try and learn something new,
on the other hand, everything I could do in go I would probably do better in java (as in I know how to do it already)
- blandflakes 6y agoThe vast majority of my work has been on the JVM - and most of that in Java. I tried Go for a while, and came away pretty unhappy. First, similarities: Go seems like a really good language for building software for teams. It's straightforward and simple, and generally what you see is what you get. That's great. Where it wins: - having a standard formatter is amazing - having a compiler that is fast, and an executable that starts fast and runs quickly is great - the built-in http stuff seems better than what was available in Java's stlib for years - channels are nice - lower resource usage, especially memory - by breaking with the JVM, you get to abandon a lot of bad patterns because they simply aren't available Where it loses: - I simply don't need pointers for the places I want to use Go - the GC, though different, still needs tuning/consideration for high-load, and if I have to mess with GCs I want the options available to me on the JVM - the dependency management story was rough for a while, though that seems to have settled into something more mature - the error handling is unacceptably anemic - the type system is unacceptably anemic. I'm not even talking about generics (maybe I am) - it just seems moronic to have to subvert it with "interface{}" all the time, which also renders the documentation pretty opaque to me. Overall Go is a solid tool, and I see why it's so successful, especially for network stuff and command-line tools. It's hard to overstate how great an experience it is to have a fast-compile loop and I really envy that (I feel this way any time I use most languages not on the JVM). And for learning something new, there's nothing novel that I've seen in Go. If you want to use it because it is pragmatic and efficient, that's a great reason.
- premek 6y agothanks for a great comment, I feel similar about most of the stuff
- avinassh 6y agoHow was experience using Go routines? And how would you compare it with Java? I am sure Java would have something similar
- pjmlp 6y agoIt had green threads in the early day, than concurrency packages, finally project Loom with virtual threads.
- blandflakes 6y agoThey (Go routines) mostly get out of the way and provide some abstraction over what I've typically used things like Future for in Scala. As pjmlp mentioned, The concurrency package is pretty nice to know, and offers functionality to chain work or fire off an async task or enqueue stuff to be done as messages, but it's not as trivial as marking a function async. Clojure and Scala have more direct paths to this sort of convenience. Loom will be interesting!
- geodel 6y agoI am mainly Java developer but used Go for some tools. I can't use Go for official applications because Go's XML library is little funky and my work is quite a bit XML dependent. It also lacks pure Go drivers for major commercial databases. If these 2 things were there I would have written lot more Go.
- andreygrehov 6y agoJust curious, what kind of drivers are missing?
- michaelcampbell 6y agoHaving used it some, and watched others use it more, I'm struck by the commonality that the most steadfast adherents of the language confuse typing with productivity; "The code flies from my fingers!" Well, sure, but the code I don't need to write in the first place because of well used and vetted libraries, or higher level abstractions, is pretty cool too. It just isn't as keyboard clackyclacky.
- djstein 6y agoThis is how I feel. I need to deploy applications not rewrite Django/Rails/Spring/etc (and all the associating tooling) for the hundredth time. The performance boost argument is a joke when we have horizontal scaling and and multithreading.
- threentaway 6y agoBut not everything is a monolithic REST web app. Sometimes you have many different components -- from CLI apps to serverless functions -- and having a lean but powerful stdlib is amazing, especially with builin type safety, consistent lining, and cross-platform native binaries easily under 10MB.
- lenkite 6y agoGo's standard library is spectacular. Java could be as easy as Go to write quick micro-services, utilities etc if all the HTTP client and server stuff were part of the standard library. If Java had offered a Java -> native option right out of the box (instead of installing and setting up GraalVM), Go would have had difficulty in achieving the adoption it had today. Go lang also made some fundamental re-useable interfaces that are leveraged across all its packages making the stdlib consistent to learn. I still prefer Java though - because Intellij rocks and I am personally faster with development. But for newbies, golang is easier.
- philosopher1234 6y agoGo kills abstraction, which is in my opinion its greatest feature. There is far too many little functions, classes, and abstractions in the Java codebases I interact with day to day. Go is just a lot simpler than Java.