3 ms·
Sorry, I have programmed in Java since 1995 and am now using Go for some years. There are huge differences, so I wonder how you could call those languages somew
by _ph_ 9y ago
Sorry, I have programmed in Java since 1995 and am now using Go for some years. There are huge differences, so I wonder how you could call those languages somewhat close. Some of the differences, which make me favor Go over Java are:
- functions: Java does not have functions, only methods
- closures: Not sure of the latest state, but until very recently, Java had no closures. Closures are a huge and important element of programming.
- single file executables: make your program easy to deploy, without shipping a JVM, setting up a classpath etc.
- value types: have control to which structures you want to refer by pointer and which should be treated as a value
- goroutines+channels: a far better approach to parallel programming, a goroutine is much more light-weight than a Java thread
- no generics the Java style: eventually Go needs generics, but not in the way Java implemented them.
- no frameworks: possibly not a strict language related issue, but Java grew monstrous frameworks, the Go community has been stay away from them so far.
- pron 9y agoI could list more reasons for which I prefer Java for large, serious projects (I prefer Go for smaller things) and some of the reasons you list are outdated, but that's not my point, as I don't wish to argue which of them is better (neither is, IMO), nor to focus on their differences. My point is that in terms of language and programming style, their similarities so outweigh their differences, that I cannot understand how one's opinion of both can vary by too much. This is doubly clear when you compare Java and Go to, say, Python, Haskell, JavaScript, OCaml, C++, Rust, Clojure, Scala, Eve, Erlang, Pony etc. If your experience has been mostly in Java and Go, you focus more on their difference, but in the context of all other programming languages that truly differ from those two, I find Java and Go -- at least in terms of linguistic features -- nearly indistinguishable.
- _ph_ 9y agoI have plenty of programming experience beyond Java and Go :). Currently I am mostly a Lisp programmer, that is why I consider the existence of closures and functions such a huge differentiator for Go vs. Java.
- pron 9y agoBut Java has closures (including type inference), and they're at least as idiomatic in Go, not to mention that all Java collections have map/filter/reduce. As to functions, all Java requires is that they be defined as static members of some class, which is no different than defining them in some namespace. Thanks to static imports, they don't have to be qualified when called. So, not only is this not a huge differentiator, this is not a differentiator at all.