4 ms·
Not that I'm a Java proponent, but have you tried doing the same rewrite effort on modern Java and with modern tools? With newer tools and most important of al
by mixedCase 5y ago
Not that I'm a Java proponent, but have you tried doing the same rewrite effort on modern Java and with modern tools?
With newer tools and most important of all: your rewrite being a second iteration with the benefit of hindsight, you may notice that the language choice makes less of an impact than expected. IME language differences tend to shine the most when writing something the first time around and its expression capabilities shape the design.
- mumblemumble 5y agoI also rewrote a Python service in Java in an attempt to control for that. The results came out similarly in terms of development & maintenance effort. Unfortunately it wasn't a thing where a performance comparison made sense, though, so I didn't really do one. My sense was that the big benefit was actually down to the libraries and syntactic sugar. Dataclasses, comprehensions, and generator functions all have a big impact, but so do things like Python just generally having more ergonomic libraries for talking to databases, producting/consuming REST APIs, and reading/writing data files.
- xapata 5y agoI suspect there's some algorithmic choice hidden in a library in this comparison, where the Python library has the right choice for the job and the Java library has the wrong one.
- twic 5y agoYou mentioned NumPy. NumPy is great, and there is basically no Java equivalent. So if you are doing the kind of work which NumPy can help with, it's going to be very hard work to beat it with Java, either in development speed or execution speed. To put it another way, perhaps what you tested here was having a great array library vs not having a great array library! It would be interesting to test Python vs Java on a more generic task, where there isn't a huge advantage from a particular library or set of libraries. It would also be great if someone would write a NumPy-style library for Java. My team would use that a lot!
- BiteCode_dev 5y agoThere is also no Django for Java, no Fast API for Java, no Typer for Java, etc. Why ? Because it's easier to write great frameworks in Python. It compounds.
- twic 5y agoEqually, there's no Hibernate for Python, no Spring for Python. And FastAPI looks basically like JAX-RS to me. I don't think the lack of any of these things is because they're impossible, or even particularly hard. It's because the community did or did not have the need and energy to build them. Remember that Java had Java EE forced on it quite early. That defined web development for a long time. Eventually Spring overthrew it, and became the new tyrant. Neither of those are quite like Django, or Rails, but they occupied the space that would have had to have been empty for a Django or Rails to emerge. I think this is rather unfortunate; it would be really useful to have a vibrant Django- or Rails-like framework in Java. There's no Typer because there isn't much of a culture of building command-line tools in Java. There are some good command-line parsing libraries, but nothing with all the bells and whistles and extensions that Typer has, as far as i know.
- BiteCode_dev 5y ago> Equally, there's no Hibernate for Python, no Spring for Python. And FastAPI looks basically like JAX-RS to me. Of course there is. In fact, SQLA is easier to use than Hibernate, and the ecosystem around is as rich. As for Spring, crossbar fits the bill. > I don't think the lack of any of these things is because they're impossible, or even particularly hard. It's because the community did or did not have the need and energy to build them. I've never say they are impossible. I've said they require less energy to build them in python :)
- slotrans 5y agoNo one who writes Python has ever said to themselves, "I wish I had Spring." It's not necessary, and it wouldn't even be beneficial. The kind of dynamism that Spring brings to Java, Python already has. Also Hibernate is terrible and should be erased from the Earth.
- tmp_anon_22 5y agoAre you as familiar with Java as you are Python?
- mumblemumble 5y agoI'm much more familiar with Java. It's mostly what I get paid to write. Python's relegated to times when I can get away with it, which are relatively uncommon.