|
I've been writing in Go at work nearly every day for the past year. I think that of the problems both Go and Rust attempt to solve, Rust solves them better in a technical and academic sense. As someone who prefers C and C++ over Python and Java, I personally would rather use Rust, but I have to say that Go strikes a great balance for general-purpose use. It is as fast to develop and as flexible and extendable as Python. Similar performance to Java but with much less code, better interoperability, and a more robust standard library. More features than C without the needless complexity of C++. Entirely too opinionated and the build system and dependency management are 80% solutions / hacks, but for the most part you can work around them. Most importantly, I think Go can be easily picked up and used by C, C++, Java, PHP, JavaScript, Python, C#, Objective-C, XYZ, ETC programmers alike with very little learning curve (some more than others perhaps). I think with Rust, you are going to have a hard time training someone who has depended on GC for so long that they have to be explicit about the ownership and transfer of ownership of memory and that it's elegant and cool and performant to do so. You are going to have trouble explaining traits and composability and the syntax around it to someone who is used to using more verbose syntax to implement complicated inheritance trees. Pattern matching and enums are fantastic, but also foreign to most of the programming public. This is why Go is spreading - good middle ground for productivity and performance, easy to pick up, seemingly bright future, Google backing, good documentation (no doc is perfect - Sphinx is frequently not great, Javadoc is terrible, Doxygen is meh, MSDN is overgrown with cruft - but Godoc is decent), etc. |
I disagree on all points.
1. The similar performance to Java is usually in small benchmarks. Once the program grows, the difference in quality of the GC and code generation starts to show (in favor of Java, of course).
2. Less code? I've seen Go programs in the wild that are indeed shorter than their Java counterparts, but that's almost invariably because the Go code is less "careful" (less attention to error handling, logging, monitoring, maintainability etc.) But when you compare programs that actually do the same thing, I find that the code size is similar, with Go winning fewer characters and Java 8 fewer lines.
3. Interoperability is, IMO, much better in Java, where you can interoperate with both C as well as JVM languages (including JVM ports of Python, Ruby and R); for Go it's just C.
4. As to the standard library -- especially when it comes to concurrent data structures -- there are few if any languages out there with implementations of as high a quality as Java, and the difference between the variety and quality of available third-party libraries is beyond comparison.
All in all, I find Go and Java to be quite similar, and the choice between them boils down to the runtime. I reach for Go when I need small command-line programs where JVM warmup is unacceptable and static linking to a native executable is a plus, and Java for long-running, "important" server apps, where top performance and deep monitoring (and sometimes hot code swapping) are necessary.