News for hackers. Stuff that matters.
Re:Generating a Java program with 90% less code by injb on Wednesday December 04, 2019 @11:19AM (#21703460)
When I used to use Java, the thing that I found remarkable was how much stuff you had to write in other languages. You had Spring, Ant, Hibernate, Ibatis, text-based "properties" files etc. It seemed that Java programmers were willing to go to great lengths to avoid writing anything in Java. But if Java was so unsuitable for such a wide range of tasks, what made us think it was a good general purpose language?

In contrast, when I started using Python, one of the things I liked was how suitable it was for all the things that Java developers typically used other languages for. Your typically Python project back then contained very little that wasn't Python, because there weren't many things that it wasn't useful for.

Things may have changed with Java in the 9-10 years since then but I think that was certainly one of the things that led to Python becoming more popular.

Re:Generating a Java program with 90% less code by tootie on Wednesday December 04, 2019 @12:03PM (#21703996)
You don't actually need to do any of that. If you're writing Ant, I assume this was at least 10 years ago. Modern Spring Boot is all annotations and using an ORM is out of fashion. Maven can be a little complicated, but it's easy to work off an archetype and it's far more sophisticated than npm. Python doesn't have this problem, but it also just doesn't have these features as an option. You can certainly build a Java project with javac but we generally don't because Maven is better.
Re:Generating a Java program with 90% less code by abledon on Wednesday December 04, 2019 @01:20PM (#21705161)
wait.. using an ORM is out of fashion now? is everyone doing direct SQL queries again?
Re:Generating a Java program with 90% less code by michaelper22 on Wednesday December 04, 2019 @02:33PM (#21706034)
Or the ORM (Hibernate by default) is abstracted behind Spring Data interfaces. It's pretty easy to autowire the EntityManager if you need it.
Re:Generating a Java program with 90% less code by oftenwrong on Wednesday December 04, 2019 @10:49PM (#21709822)
I favour jOOQ.
Re:Generating a Java program with 90% less code by abledon on Thursday December 05, 2019 @10:29AM (#21713111)
oh, i like its DSL, much more sane than raw sql queries.
Re:Generating a Java program with 90% less code by tootie on Wednesday December 04, 2019 @01:44PM (#21705476)
Yes. Or use a NoSQL DB.
Re:Generating a Java program with 90% less code by oftenwrong on Wednesday December 04, 2019 @11:38AM (#21703709)
Spot on. Thankfully it is becoming more common to Just Write Java. Java without the frameworks and other bloated crap is actually decent. The language itself has a lot of warts, but the Java ecosystem is one of the best (Python too).
Re:Generating a Java program with 90% less code by MH15 on Wednesday December 04, 2019 @11:54AM (#21703888)
This is how I feel about the language! Modern Java works well enough to me that the frameworks are nearly never justified.
Re:Generating a Java program with 90% less code by smabie on Wednesday December 04, 2019 @01:20PM (#21705164)
What ecosystem? The JVM doesn’t require Java. Scala is pretty much categorically better in every way than Java.
Re:Generating a Java program with 90% less code by retbull on Wednesday December 04, 2019 @02:24PM (#21705946)
Not in maintainability. It is pretty hard to follow Scala when people use the flexibility too much. You have so many options that everyone develops their own flavor of overrides/overloads and style. This makes transferring skills between jobs or even just projects much harder as the same looking code line can mean several things.
Re:Generating a Java program with 90% less code by proverbialbunny on Wednesday December 04, 2019 @01:29PM (#21705285)
>But if Java was so unsuitable for such a wide range of tasks, what made us think it was a good general purpose language?

Other competing languages you would use today didn't exist, and C++98 was a pain in the ass. The selling point back then was Java was C++98 with all of the difficult parts stripped out, and with good tooling and IDE support. Back then people flocked to Java like some sort of oasis. Today, even modern C++ is better in most ways.

Re:Generating a Java program with 90% less code by Nursie on Wednesday December 04, 2019 @12:48PM (#21704696)
This is not really true any longer. Spring, thankfully, seems to be going away. Java itself is now far more feature-rich in terms of lambdas, anonymous classes, stream processing etc.

I came back to java about 4 years ago after a long time away and have found it quite pleasant, and quite different to how you describe it.

I think I skipped the 'enterprise' years, thankfully!

Re:Generating a Java program with 90% less code by jayd16 on Wednesday December 04, 2019 @12:00PM (#21703968)
You mean, you had to edit the build file, some SQL and some configs that weren't baked into the compiled code?