4 ms·
A really good alternative to Python and C: Clojure + Java Mostly because - Clojure is very very terse - Java has the battle-tested libs - they run on the sa
by dmichulke 8y ago
A really good alternative to Python and C: Clojure + Java
Mostly because
- Clojure is very very terse
- Java has the battle-tested libs
- they run on the same (J)VM - so no FFI required in your code
- zimablue 8y agoI think the problem with this is, if I'm going to say "completely rewrite this [function/class/module] into another language", then there's a good chance you want that language to be about as fast as possible. I guess because a lot of problems fall straight from "speed absolutely doesn't matter" to "this is the bottleneck of the whole thing". I think that is a reason why there's a lot of python/c++ in hedge fund land. I've written some clojure but don't know the c interop story for it.
- dmichulke 8y ago> completely rewrite this into another language You just opened the box of pandora for a million reasons most of which are unbeknownst to the both of us :) But for the sake of argument I will continue under this assumption > language to be about as fast as possible If you're interested in Mathy stuff like Machine Learning, FFT, ... then maybe. But even for those you usually have JNI bindings, so it's easy to use most of those mathy C libs if necessary. But I guess that 95% of all software isn't about speed but about something else (correctness, maintainability, safety against threats, portability, ...) because costs today are usually dictated by manpower costs or those arising from safety/security incidents and much less often by hardware costs compared to say a decade ago.
- zimablue 8y agoWhen I say completely rewrite, I mean rewrite a class, method or library which is what we're talking about (since you probably started writing in python/clojure). Sorry, it was poorly phrased.
- mywittyname 8y agoMy limited experience taught me that doing anything mathy in Java is painful due to types (well, more lack of math-specific built-in types). The input/output is usually going to be in primitive types while the library likely uses some home-brew custom typing(or Commons, if you're lucky) for Complex numbers, matrices, etc. So you have to do the type conversion song-and-dance. The Python libraries never seem to care. Just give them a list of a list of number-ish values and off they go. Java might have some great ML/Math libraries, but the fact that Python dominates data science suggests that my experience is a real-world pain-point.
- kenhwang 8y agoArguably you could mix and match any of the jvm languages to your liking. Jython, JRuby, Kotlin, Scala are all reasonable alternatives to Java while being easier to hire for than Clojure.
- LoSboccacc 8y agoBack then I used to use beanshell for the most changing part of code (prototypes/logic)