5 ms·
My biggest gripe with java is developer productivity. It has gotten better but is still far behind interpreted languages like Python and Ruby. Class hot loading
by mberning 6y ago
My biggest gripe with java is developer productivity. It has gotten better but is still far behind interpreted languages like Python and Ruby. Class hot loading and things like that have made it better, but if you change a method signature or interface you have to stop your process, recompile, redeploy, and restart. For big codebases it’s brutal compared to the aforementioned languages and their attendant frameworks.
- hello_moto 6y agoIn big codebases, people don't change Interface (that's a contract btw) that often. They would do the proper "migration" by offering path to the new contract/api. If you have huge codebase in Python or Ruby, you'll rip your hair more often because it's riskier to make changes (dynamic language) according to your use-case :).
- mberning 6y agoSure, according to some OO professor. In real life these things change all the time. And it’s not just methods and interfaces that force a recompile, those are just examples. As for dynamic language projects, they should include a test suite to mitigate such issues, but often do not.
- NOGDP 6y agoA big chunk of the issues you're writing that test suite for, and constantly rerunning, are solved, out of the box, by having a decent type system. The type system also gives you superior code completion (with proper IDE support), which already outweighs any potential reload time costs in Java vs Python/Ruby, for me personally.
- jakear 6y agoIf you change an interface in Python you need to manually verify that everything is correctly using that new interface. That’s much more of a devprod hit.
- lenkite 6y agoWell..there are always commercial tools like JRebel (https://www.jrebel.com/products/jrebel https://www.jrebel.com/products/jrebel) that one can leverage for live reload
- victor106 6y agoJrebel is really really good but it’s just way too expensive. Maybe worth it for some folks though. http://hotswapagent.org/ http://hotswapagent.org/ Is an open source alternative and covers about 90% of what jrebel does
- tiew9Vii 6y agoThat's interesting. I'm not the biggest Java fan, I can tolerate it. Recently working on a Python project I find I'm massively unproductive compared to something like Java or more specifically Scala as using Spark. Not having strong types and limited type hinting. I have no idea what things are, is it a int, string, object etc, clicking through in an IDE to see code/docs isn't as great as it's hard for an IDE to inspect the code compared to strongly typed language. Not having a compiler means I have to have unit tests doing what a compiler would do or finding out I have syntax errors or other errors at runtime. This massively throws of my development flow as can't lean on the compiler to find trivial errors. Rather than doing compile I have to hope I have a test case with high coverage to instrument the code to get a syntax error or I have to start / deploy it to get the error. There's a great deal of issues with dependency management. Venv, Docker etc help with this but it's a bunch of extra stuff on top I now need to worry about and sometimes still hit errors. The only time I find I'm relatively productive in Python is writing a short 100-200 line script to do one off tasks / sysadmin / devops type scripts. The fact if I change an interface, rename a method I need to recompile I find a huge advantage as everything breaks and I worth through the errors one by one and once complete and no more errors I have confidence the refactor is complete and the compiler has verified it.
- kaliszad 6y agoTypes almost never save the day and they don't add much to the understanding. The code should be structured and documented in such a way that you are able to understand it, reason about it and swap implementations of stuff in the places where such flexibility is handy. E.g. in Clojure, I can trivially test my functions in the context of the application using the REPL. I don't have to reload anything, I do it right in the namespace I am modifying. I can also just look at the data there. Also Clojure is way more consistent and you can probably learn all the functions in clojure.core and some of the typical libraries by heart. These functions then work basically on anything you will do and are almost 100% transferable to ClojureScript. For sysadmin-like tasks, for most stuff you can use Babashka, which is a limited Clojure + some frequently used libraries implementation with very fast startup thanks to GraalVM. For the rest, Python/ Perl etc. will probably still have a bit better standing because of all the libraries e.g. working with SNMP.
- kaliszad 6y agoYou could use Clojure of course and drop to Java for the few performance-supercritical functions if needed (most likely not for like 95%+ of codebases). The productivity and performance may be even better than Python or Ruby. Another positive is, quite a bit of the code can be taken 1:1 and used in ClojureScript if you do back-end and front-end at the same time. (Of course you can program in ClojureScript targeting not the browser but Node.JS e.g. using shadow-cljs which makes working with npm easy.) Also, I haven't spent much time on StackOverflow when programming in Clojure/ ClojureScript because the language is very clear and consistent and usually the documentation and maybe one or two examples there is enough. Or I just play with the function in the REPL for a bit, maybe do a quick (time (dotimes [_ 1e3] (some-function-under-bench))) and dirty benchmark for the more involved stuff. Clojure is a superpower especially for large codebases because you can maintain your state and ship your adjustments from the editor to the REPL in development which is almost instantaneous. This works for production code also, if you need a very, very quick hot-fix or want to look at live data in the live database without copying possibly confidential data around. Of course, you have to be careful. With great power... and all that.
- NOGDP 6y agoIf your development productivity is entirely reliant on how quickly you can reload your changes, then you're doing something wrong. Though I guess you'd have to write mounds of unit tests and constantly rerun them to prevent common issues that Java's type system solves for free.
- kaliszad 6y agoActually, Java, its syntax, the explicit types and how its often taught only obscure the solutions that could be much more obvious. Since I have seen Clojure, I was swearing why nobody has shown it to us right in the beginning when I was in the university. Back then, Clojure was already an established, stable language and that has been a decade. I could just skip the C, Java and other classes and would be a much better real-world problem solver/ engineer much earlier. If I needed the specifics e.g. for embedded or legacy applications, I could always look-up/ learn the details for C/ Java etc. but that is not needed for more than 95% of the tasks a software engineer would encounter in the real world.
- NOGDP 6y agoYou're not saying anything specific about what's wrong with Java. Java is not perfect, but you haven't actually given a single good reason. The type system alone is a huge benefit over languages such as Python/Ruby. Lisp has existed and been taught for a long time, and I like Lisp languages such as Clojure, but the allusion to Clojure being some kind of magic bullet is also pretty baseless.
- kaliszad 6y agoWell, I did say at least 2 specific things (syntax, explicit types). But maybe approach this a bit differently and talk about what is great in Clojure that is not good in Java: - persistent datastructures that can easily be made transient in specific performance critical cases - consistent syntax - the language itself is a datastructure so manipulating of code is very easy and you have a serialization format (again EDN) basically for free - the REPL - most of the code transfers 1:1 to ClojureScript, that is not the case for Java and JavaScript which are completely different languages and have very different strengths - dynamic types, but out of the box type hinting is available for some corner cases where it improves performance/ makes interoperability a bit clearer and e.g. using clojure.spec you can with some effort make something approaching depend type systems/ very strong tests incl. generative testing - Clojure/ ClojureScript interoperability with the Java/ JavaScript ecosystem - developer productivity - actually performance especially compared to Python/ Perl/ Ruby, very carefully written Java would win microbenchmarks but in Clojure you can probably improve the overall performance of a large codebase because in the same time as you would need with Java you can do many, many iterations more and therefore explore the optimal solution - you can become very proficient in Clojure in about 6 - 12 months where with Java you probably need maybe 3-5x that time to tackle the same problem space Yes, some of those things are not so specific to Java. If you only care about performance in micro-benchmarks Java would probably win but probably 95% of the problems in the real world are way more complex. Also, good luck writing correct multi-threaded code in Java vs Clojure. Clojure is uniquely positioned for multi-threaded workloads thanks to persistent datastructures, atoms, agents etc.
- suyash 6y agoWith interpreted languages you pay the price in terms of productivity (best practices, design patterns), performance (at scale) in long run which is way more than what you gain in short term is my opinion.
- reactor 6y agoMay be you should try Quarkus, its hot reloading is slick. Even with a large code base, I could just do change->save->refresh cycle (about a second).