3 ms·
Java is statically typed. Clojure is not. To me, this is the biggest difference and the reason to choose Java.
by ian1321 7y ago
Java is statically typed. Clojure is not. To me, this is the biggest difference and the reason to choose Java.
- deleted 7y ago[deleted]
- jnwkw 7y agoIs this true or false? I don't understand the downvotes.
- Rovanion 7y agoWhile it is true that Java is statically typed and Clojure is dynamically typed it is perhaps one of the less important differences between the two languages. If you in fact would like to add a static type system on top of Clojure there is a way to do that: Typed Clojure. https://typedclojure.org/ https://typedclojure.org/
- pyb 7y agoMany people disagree with "the reason to choose Java".
- CodeArtisan 7y agohttps://danluu.com/empirical-pl/ https://danluu.com/empirical-pl/
- innocentoldguy 7y agoI'm not going to downvote the comment, but I think the "statically typed" argument is fantastically overrated. I spent years of my life coding in Java and C# and other years of my life writing Clojure, Python, Ruby, and Elixir code. I've never once thought to myself of the latter, "Damn! This would be so much better if I could have static types." It has literally never, not once, ever been an issue for me.
- roshan_naik 7y agoIn the critical path many things can matter that ordinarily don't. When working on perf improvements for Storm 1.0 release, profiling revealed hotspots in Clojure code. Adding type hints to avoid dynamic typing fixed some of these hotspots. In other places, Clojure primitives showed up as a bottleneck. These required rewriting some code in Java and invoking it from Clojure. This was mentioned briefly here: https://hortonworks.com/blog/microbenchmarking-storm-1-0-performance/ https://hortonworks.com/blog/microbenchmarking-storm-1-0-per... The Clojure based core has served the community well for some time. It was still powered by Disruptor (a fast Java messaging library). So there was always some back and forth between Java and Clojure. For Storm 2.0, the Java rewrite happened first. The re-architecture work might have not happened without it (at least for the foreseeable near future)... primarily due to Java expertise being more easily available.