5 ms·
Interestingly, it's the culture of Java that makes it verbose. You can write concise pure Java if you don't rely on libraries, have unit tests, or do things th
by throwaway13337 7y ago
Interestingly, it's the culture of Java that makes it verbose.
You can write concise pure Java if you don't rely on libraries, have unit tests, or do things the Java way.
It's too bad, too, because there are some things to love about Java, really. It's simple, it's super fast thanks to the jvm, and it's well supported.
- Yessing 7y ago> It's simple, it's super fast to what baseline are you comparing it to?
- ReverseCold 7y agoThis is potentially a bad example, but the current "fastest" web frameworks as per the techempower benchmarks are all Java.
- pkroll 7y agoThey're not: C++ and Rust have winners for some of the tests.
- floriol 7y agoOf course you can write more performant code with lower-level languages, though there is a reason that almost no web framework/application is written in them - the additional burden of managing memory outweighs the (actually surprisingly little) performance benefit. If you look at examples on the site, in basically every other benchmark Java and sometimes Go rank the best.
- ReverseCold 7y agoI should clarify that I sorted by fullstack frameworks with ORMs. Obviously C or C++ can be made faster. Too late to edit now though.
- Yessing 7y agoI'm not familiar with it, do you mean this one? https://www.techempower.com/benchmarks/ https://www.techempower.com/benchmarks/ Rust, C, and Go appear to be on the top.
- ReverseCold 7y agoSorted by full stack frameworks only: https://www.techempower.com/benchmarks/#section=data-r18&hw=ph&test=fortune&c=6&d=8 https://www.techempower.com/benchmarks/#section=data-r18&hw=...
- VeninVidiaVicii 7y agoAs a genomicist I'm half biologist, half data scientist. I think for the majority of my problems, it's the verbosity of Java that I just cannot stand. Maybe the instruction I've had in Java is flawed, but the amount of codewords to do anything has really kept me away from it. I don't really ever run into the same problem twice. I've never been able to write anything as concise for a one-off problem as I can using Python or Perl (or even Awk) for data wrangling.
- hirako2000 7y agoScripts are superior in term of usability for what you do. Period. Java is for enterprise scale applications, where dozens or hundreds of developers contribute to the code base, for a decade or more. The boilerplate, the verbosity, strong types, the dependencies on complementary tools is what makes a large code base maintainable in the long run. If cared for. If you need to scrap a website a couple of times, convert text from one format to another. Yea just use some script. Throw away code that nobody but you will ever need to touch or even look at. It is possible to write a python, Perl, JavaScript, or even Php app at scale. It may require a bit more due diligence though. Frameworks have been introduced to help with that. The article is written by someone who doesn't fully understand Java. No need for interface to support injection. Interfaces are commonly written by CS graduates or uninformed long time OOP developers, but composition and DI have been around for over a decade. I stopped reading when the interface was pointed out as the only way to go.
- commandlinefan 7y ago> if you don't ... have unit tests Uhhh... you should have unit tests no matter what language (or culture) you're dealing with.
- stefano 7y agoDepending on your application, you can go a long way with integration tests alone.
- elwell 7y agoIt sounds like you want to use Clojure.
- marcosdumay 7y ago> You can write concise pure Java if you don't rely on libraries Hum... No, you can not. Java is missing basic tools for abstracting idioms, break your code semantically, and reusing your code. Without those, you'll just write stuff again and again, hope you have a very good IDE. > It's simple It's simple the same way Go is simple. The language itself is small, in ways that make your code complicated. On this competition, Brainfuck is unbeatable. > it's super fast C, C++, Rust and Fortran are fast. Java is not. It's a second tier, at around the same speed as C# (obviously), Go, and Haskell.
- apta 7y ago> Java is missing basic tools for abstracting idioms Such as?
- marcosdumay 7y agoAny kind of flexibility on the syntax, metaprograming, reflection is so useless that it could as well not be there, high order constructions where the compiler can infer the idiom, well, really anything. It has relatively recently gained usable high order functions, and seems to have stopped there.
- apta 7y agoCould you point out specific use cases? Are you referring to lisp-like macros? Constructs like Higher Kinded Types? I'm just trying to understand where you're coming from.
- marcosdumay 7y agoWell, I'm saying that Java doesn't have any of those. Other languages have some concept they run away with, like macros for Lisp, monads on Haskell, named parameter enumeration and monkey patching on Python. Even PHP relies heavily on object enumeration. All of those techniques are kind of equivalent in power, spread through a curve trading flexibility (expresivity) with organization (possibility of analysis). Java has nothing near that curve.