r/java • u/henk53 • Apr 20 '21
Java is criminally underhyped
https://jackson.sh/posts/2021-04-java-underrated/125
u/dpash Apr 20 '21
Comments: 821.
Checks article date
15th April 2021. Oh boy.
81
u/lessthanoptimal Apr 20 '21
Really perplexing how some people seem to go full on tribal warfare at the mention of Java. At this point I think it's a coinvent meme that lets them unleash some pent up aggression.
29
u/dpash Apr 20 '21
Especially when it's based on an outdated opinion of the language.
PHP evokes the same reaction.
25
u/Cefalopodul Apr 20 '21
To be fair in PHP's case the reaction is somewhat warranted. It still has plenty of WTF moments.
18
u/dpash Apr 20 '21
Modern PHP is far from its older versions. It has decent DI and web frameworks, type hinting, exceptions, namespaces, a reasonable dependency manager. It's not the insane choice for new projects it was even ten years ago.
Now if only it gained generics I would be almost happy to use it.
7
u/flyingorange Apr 21 '21
To be honest when I started using PHP in 1998 it was the greatest thing ever. At the time the alternative was writing server side code in Delphi. Well, let's just say, if you didn't write websites in Delphi, you don't understand what a revolution PHP was.
→ More replies (9)2
u/johnwaterwood Apr 21 '21
I wonder what the purpose of modern PHP is?
The original attracted hordes of people because it was such an insane choice. If it’s not that anymore, it won’t be attractive to that initial crowd.
What’s PHP’s target audience these days?
12
u/Routine_Left Apr 21 '21
PHP evokes the same reaction.
PHP deserves it. JavaScript deserves it. Java? They have no fucking clue what they're talking about. Not about Java 20 years ago, not about Java today.
2
0
Apr 20 '21
[deleted]
43
u/thephotoman Apr 20 '21
The one exception, I think, is Python, which initially supplanted Perl.
That's exactly what happened. Python was basically Perl but readable and with batteries included. It didn't help that Perl was struggling to deliver Perl 6.
→ More replies (7)5
u/VGPowerlord Apr 20 '21
Speaking of which, did Perl 6 ever drop or is it still in a theoretical state?
15
15
u/vytah Apr 20 '21
The version 1.0 of Perl 6 came out in 2017, so 17 years after it was announced.
Then they realised that it's pointless to keep the name "Perl" as Perl 6 was practically only superficially similar to Perl 5 (the relation is like between Kotlin and Java – the languages are interoperable, but syntactically incompatible), so in 2019 they renamed it to Raku.
→ More replies (1)10
u/flyingorange Apr 21 '21
In my case our professors hated C++ and forced everyone to learn Pascal. When Java appeared, they embraced Java and said that it's basically Pascal with the ugly C-like syntax.
5
u/walen Apr 21 '21
The one exception, I think, is Python
Because Java didn't exist when Python was born.
3
u/cogman10 Apr 22 '21
This is always such a mindfuck for me :D. Right up there with the fact the Ruby is also older than Java.
4
u/ryosen Apr 21 '21
And C++ was looked upon as C with training wheels while C was looked down upon by the ASM/ML folks.
6
u/umlcat Apr 21 '21
C works well as an assembler macroprocessor, but even these days, the new more complex OS and systems, need better P.L. than C and C++.
Rust is a good example.
And a lot of "old style" assembler folks still don't get it ...
8
u/1bot4all Apr 21 '21
C++ was looked upon as C with training wheels
That's mad. C++ is insanely complex, you can use it for 10 years and struggle with some of its idioms. C is much easier to master.
→ More replies (1)1
u/xtsilverfish Apr 22 '21
The one exception, I think, is Python, which initially supplanted Perl.
Is the hype machine always wrong I wonder? Not a single other language has even come close to supplanting java. Only Python has, in the sense that Pythin has replaced Java as the first language everyone in college learns.
19
u/agentoutlier Apr 20 '21
The guy also posted it on hackernews...
Ahh hackernews where you post "I use to use X and now I use Y... fight!"
I swear the only good content on hackernews is when they post an article that has nothing to do with programming or tech otherwise it becomes essays on the merits of "this worked for me so fuck all other solutions".
7
u/dpash Apr 20 '21
I did notice that. That was the main reason I didn't even look at them. Nothing good ever happens in comment sections. :)
30
u/LcuBeatsWorking Apr 20 '21
I have seen many language hypes come and go (anyone remembering the Ruby/Rails hype of 2005+ ?). Not keen on hypes.
14
u/atesti Apr 21 '21
I remember that time. Ruby gurus said that Java was going to be replaced by Ruby around 2010.
14
u/pfarner Apr 21 '21
I accidentally inherited a Ruby application around 2007, and the app was so slow that performance was clearly the main priority. Profiling it, it became clear that the method dispatch was insanely slow.
So I ported it to Java in a few days. It produced the exact same output, but ran 70× faster, with no refactoring.
15
u/reqdk Apr 21 '21
I inherited a Ruby/Rails project to clean up sometime ago. The damn thing had to run on a 16 core VM with 64gb of ram just to serve some forms with 1-10k submissions a day. Saw rubbish like a method returning either a filename, or the contents of a file, or a number (this was a bug because of the stupid way Ruby returns things), or nil, depending on the size of the file you tried to access. Not only was performance horrible but it was insanely hard to improve/scale. Yeah, you can write shit code in any language, but the better languages have more tools to stem that tide of bullshit with. It took thousands of unit tests to achieve the safety that a strong, statically typed language like Java would have provided automatically. Never again...
0
Apr 21 '21
[deleted]
4
u/LcuBeatsWorking Apr 22 '21
To be fair Java was hyped as the answer to everything in the late 90s, especially on the Desktop. And considering the state of programming back then rightly so.
It was just never "hip" or "cool", mostly because it shifted to enterprise, while the "cool kids" had ruby, nodejs or whatever was the language of the season.
54
u/deadron Apr 20 '21
Java has its issues. Its specification stagnated for a number of years due to the sun collapse and oracle acquisition. It also does not show its strengths in command line utilities, or in GUIs(Swing enthusiasts, fight me.), or in games. It really only shines when running longer lived server side applications where the tradeoffs the language makes are stronger. When you do use it for application development it is often mired in legacy framework baggage that adds little while causing you headaches.
Once application servers are killed off for good, and the next LTS JDK releases, the future should be much more exciting.
19
u/throwaway32908234972 Apr 21 '21
JVM startup time is way faster in newer versions. I saw a benchmark in Java 15 where the JVM fired up faster than Python on average (<50ms). Java command line utilities with modern CLI frameworks like PicoCLI are fast and easy to work with.
Java also has the only good cross-platform Desktop UI outside of QT. Unless you want to write C++ or use janky QT binders for other languages, Java is still the king of Desktop UI's. Java's new cross-platform packaging tool is awesome and JavaFX ain't bad either.
Java's UI is relatively fast because it uses native widgets. Compare that to something like Electron where performance is horrific. Java also uses less memory than JS or Python so if you want a decently performant Desktop UI, Java is usually the best choice.
You probably use a ton of Java Desktop UI's without even realizing it because they look native and everyone packages stripped versions of the JVM with their app these days.
7
u/deadron Apr 21 '21
The startup times most likely rely on using jlink to build a custom jvm. This is still a relatively new feature and is a perfect example of a place java stagnated for years on! With the next LTS this should be used much more often.
Java's ui, as you put it, does not use native widgets. Swing is notorious for looking the same across almost all applications. I can't speak much towards java fx other than to say it's popularity has never really been high.
8
u/throwaway32908234972 Apr 21 '21
Swing uses AWT underneath and some widgets are truly native, but you are right that many components aren't. I didn't know this. Swing's native look and feel is dead-on these days. I usually can't tell the difference at least on Windows. Swing looks like hell with the default look and feel and lazy devs don't bother switching it.
The startup times I'm talking about are for console apps using plain OpenJDK with AppCDS enabled. Check out the massive startup time (and memory) improvements in newer JDK's https://cl4es.github.io/2020/12/06/Towards-OpenJDK-17.html
Java 16 starts in barely over 20ms for simple apps. This is basically fast as interpreted scripting languages like Python
5
u/RandomName8 Apr 21 '21
wing looks like hell with the default look and feel and lazy devs don't bother switching it.
Note that the native LAF pretty much only works well on windows, it doesn't work well at all on linux or mac.
1
6
u/Muoniurn Apr 21 '21
The one benefit of electron is the decimation of a preference on “native widgets”. Nowadays it is much more acceptable to have a slightly different looking window, which while many would say is not a positive thing, it does help Java’s case. Hopefully we can see more growth in this area.
And JavaFX is a hidden gem. I’m not sure why is it not more popular, I think it is far the most productive GUI framework. And with Valhalla, I think it will get a decent boost in performance (for 2D games, it churns on small “primitive” objects quite a bit)
20
u/gdejohn Apr 20 '21
[Java] also does not show its strengths in ... games.
i wonder if that's set to change with max 0.5ms and average 0.05ms gc pauses for zgc and performance improvements from project valhalla primitive classes and generic specialization
12
u/deadron Apr 20 '21
Hard to say. Garbage collectors are tricky beasts and while valhalla types should help certain scenarios they don't seem to solve the larger issue of needing to be able to better manage your memory. Then again I don't do game dev so this is just my opinion!
12
u/throwaway32908234972 Apr 21 '21
I have used ZGC, GC pauses practically don't exist anymore. If Minecraft ever upgrades from Java 8 we'll see some huge performance improvements.
7
u/deadron Apr 21 '21
While ZGC is better about not pausing the world its not guaranteed to always improve performance. For example, if you are capping out your CPU ZGC may be unable to execute properly and may need to stop the world for longer and longer. As with any garbage collector you need to load test and see how it performs.
4
u/Muoniurn Apr 21 '21
It will likely have worse throughput, eg for batch processing. But where latency is important and is currently high, ZGC will help.
0
Apr 21 '21
[deleted]
9
u/reqdk Apr 21 '21
It isn't just game dev. High performance Java generally looks little like the usual enterprisey stuff. It's a little sad that the prevailing image of Java and its problem space is so much "enterprise web app" when it's a much more flexible language than that.
5
u/deadron Apr 21 '21
That is because enterprise web apps is where Java really shines in comparison to alternatives. This is partly a language feature, partly due to the servlet specification being a really well thought out platform for web applications, combined with a suite of libraries useful in business situations. You can have the worst developers in the world contribute to the application and it will mostly plod on without too many issues.
Java is definitely useful elsewhere but almost no other language provides so much for this particular use case.
1
u/nlisker Apr 25 '21
This is interesting. The issue you are describing seems to me that of creating many small short lived objects allocated on the heap, right? Shouldn't ZGC improve that significantly, or in your experience it's still not good enough?
4
u/CraftyAdventurer Apr 21 '21
Hardly. If Java had ZGC and project Valhalla 5-10 years ago it would have the potential to become dominant in game dev. But nowadays Unity, the most popular engine, uses C# for scripting. Unity certainly wont just switch to Java, they invested a ton of time making C# scripting as performant as possible and all of their users are familiar with C# not only as a language but also all the tooling related to it.
Of course, new game engine could come out, but that would take years to gain any traction, and by that time, other popular engines will already be more mature and have way more available resources and developers. I mean if you look at the gamedev world now, everyone is either using Unity, MonoGame, Unreal or writing their own engine from scratch in C++. There are tons of other engines popping up every now and then, but they are mostly used by a small number of enthusiasts or people who just like to experiment.
6
u/audioen Apr 21 '21
I would imagine that today GC is no longer an issue, with G1GC. I don't think ZGC will matter so much, because there's just a limit to how much GC needs to improve before it stops being a problem.
Back when I was learning Java, sometime in java 7 time, I was working on a realtime simulator software that caused a steady 50 % CPU load on my then-laptop, and a new video frame was required 50 times per second. For that target, the old CMS collector was manageable if you kept the heap size small, as the collection time generally grew roughly linearly in proportion of the size of heap to collect with the older algorithms. Thus smaller heap meant more frequent but shorter pauses -- technically you spend more time doing GC in total, but latency will have a bound that is better suited for a realtime application. (Of course, such statement is subject to the rate garbage gets generated, and so on, as you can increase GC load without bound just by generating more garbage.)
I never did measure how big an impact the GC had, though, I just observed if underruns ever happened, and found that with small heaps they ceased to happen. Margin of error was within factor of 2 to 3, e.g. 128 MB heap was fine, but 512 MB heap was not, and so I kept the heap at 128 MB. My guess is that collection times were probably always less than some 4 ms, not enough to cause underruns.
1
u/deadron Apr 21 '21
From my personal experience in large web applications, CPU usage is almost entirely dominated by GC runs once the application has started. The graphs of CPU usage is very spiky for this reason!
1
u/audioen Apr 22 '21
I suppose this all depends a lot on how many threads and how big heaps you have. I run a spoonfeeding proxy and just a few threads and relatively little memory, usually 512 MB of less.
If your thread count is low, you also likely have rather low maximum memory requirement, so heaps can be small and collect times remain low. Even a single thread could work fine if you can guarantee that any request serving time will be low, say around 100 ms per request. At 10 per second, entire day grants around million per day per thread, and 100 ms is relatively speaking already an eternity for modern server computer.
4
u/maxandersen Apr 21 '21
Try jbang and you get command line utilities / scripting. Add some quarkus and you can easily make it start fast with its native compile.
Java moved alot in this area the last 1-2 years :)
1
u/deadron Apr 21 '21
I don't really get why you would use jbang for anything. If I am producing a runnable application I can produce an executable jar already. I just don't understand what the benefit is to it instead of using an existing build tool.
As I understand graalvm still is not compatible with everything. It also doesn't really seem popular with real world developers even though it's being pushed everywhere on reddit. Probably because none of us can use it with any of our existing applications due to said incompatibilities. For example spring is still incompatible.
2
u/maxandersen Apr 21 '21
if you are fine using maven/gradle and whatever keep using it - jbang can still be used to run that output without user having to install and setup java.
if you are fine with the ceremony of dealing with multiple artifacts and multi nested directories just to write a utility keep doing that - jbang lets you just have one file (like bash, python,etc.) and use that directly - no separate build/compile step.
if you love to deal with maven/gradle requirements to do a few things in a project then do that - jbang lets you just write a .java file and run it any kind of project and be used as a debuggable and portable set of utilities not tied to specific build system.
Coincidentally I'm talking about this exact topic in a few hours if anyone interested: https://www.meetup.com/BarcelonaJUG/events/277506478/
1
u/deadron Apr 21 '21
If you annotate a file with JBang specific comments is it still really a Java file? At that point it seems more like a JBang script instead.
Having to install JBang instead of a JDK isn't really a benefit because it is not actually simplifying the fact that you need to install something to run your code.
It sounds like it operates as an alternate build system focused on execution instead of packaging that annotates within existing files instead of within an external file. So it actually reduces your portability and ties you to jBang being the only way to execute your project?
2
u/maxandersen Apr 21 '21
it is 100% pure java. thats why it works.
just because you add a pom.xml or a build.gradle file does that make the .java files non-java?
you can install and run jbang in a single curl command - the rest will be dealt with automatically on any java capable OS. Its just easier. but sure, if you do it all manually you can do that. just tedious.
if maven and gradle does not reduce your portability neither does jbang. And you can mix jbang into your gradle/maven projects so I'm arguing its even more portable.
also jbang can export to a .jar like maven/gradle does at that point its no different.
its just much much simpler to get started with and you can easily move from jbang to gradle/maven once the complexity they require becomes relevant for you.
→ More replies (6)2
u/maxandersen Apr 21 '21
oh and you don't need spring to write utilities - lots of valid alternatives for that use-case.
1
u/deadron Apr 21 '21
This is true. However the applications small enough to not need a framework often don't matter enough to even do basic optimization in a business environment. If you are producing reusable CLI tools for end users this may be different though.
2
u/maxandersen Apr 21 '21
Yes and thus far I've been fine not using Spring for years so I can confirm it is not required :)
→ More replies (3)→ More replies (4)1
u/xtsilverfish Apr 22 '21
Its specification stagnated for a number of years due to the sun collapse and oracle acquisition.
I disagree, a lot of that was the best part of Java. Started with 8 it started to gey bloated and the most recent stuff is a huge inconsistent nightmare. Java was best when it stayed stayed simple rather than becoming a dumping ground for 3 or more different buzzword programming ideologies.
131
u/cville-z Apr 20 '21
Java is underhyped only if you weren't programming in 1995-2005, when it was criminally overhyped. I'd say it gets the right amount of hype now.
Also this article is written like someone just discovering object-oriented type-safe compiled languages for the first time after only ever programming in perl, ruby, or Javascript.
36
u/boost2525 Apr 21 '21
You're describing every junior developer / CS grad of the last five to seven years.
43
36
u/shponglespore Apr 20 '21 edited Apr 20 '21
I'd say just the opposite. Around that time I was working at a company where I successfully argued for using Java instead of C++ for a major project, and that led to the company becoming an all-Java shop because everyone agreed it was a huge improvement. These days Java has a lot more serious competition from languages like C#, Go, Rust, and even JavaScript. I don't touch Java code very often these days, but when I do it's usually painful because it seems like if you want to be taken seriously as a Java programmer these days, you have to rely on things like DI frameworks and magical annotations to such an degree that it becomes very hard to read the code in a project you're not intimately familiar with.
18
u/Orffyreus Apr 20 '21 edited Apr 20 '21
DI frameworks and annotations are not necessarily needed, but there are standardized specifications like CDI (specification JSR 365) and so on, so you can rely on stable APIs and learning what standardized "magical annotations" do, can help you in the long term.
This means, usually you do not have to learn new annotations all the time. The theory is, you learn them and you have more time to focus on the domain instead of e.g. having to think a lot about wiring objects and layers.
3
u/umlcat Apr 21 '21 edited Apr 21 '21
Annotations are good, but Java has a lot of missued ones.
I prefer a more natural
virtual/overwritekeyword and apropertykeyword, like C# and Object Pascal (Delphi) does.Instead of that patch alike
@overrideand@property, too much@hurts my vision.BTW, I have work in Java, and I'm working in my own pet P.L., and explicitly added annotations, but I just don't want developers to overuse them.
Cheers.
2
u/Orffyreus Apr 21 '21
Yes, you are right. Annotations can be confusing and hard to backtrack. They should be well designed and stable and are best used for cross cutting concerns like logging and not for domain functionality.
14
u/deadron Apr 20 '21
DI frameworks, when used properly, make testing substantially easier! If you don't like your DI framework then are probably not writing enough tests to really see the benefits. There are other use cases but in my experience this is when it really shines.
15
u/shponglespore Apr 20 '21
I don't have a DI framework because I don't do Java these days, and they're not fashionable in any language I work with. I'm sure there's a reason people use them, but as an outsider just trying to understand someone else's code, I fucking hate trying to figure out where anything is actually instantiated.
3
u/deadron Apr 21 '21
I have been here. It can be really painful. Personally this is why I don't follow the pattern of injecting interfaces unless there is a good reason to do so. If you inject actual implementations it greatly simplifies figuring out what is coming from where. You can still inject mocks for testing so it is just as smooth.
16
u/CartmansEvilTwin Apr 21 '21
And let's be honest: in 99% of the cases you don't need interfaces anyway. Most code is de facto tightly coupled and/or will never be changed anyway.
We have several projects where the devs made sure everything implements an interface, but almost none of these actually ever changed some implementation in the background. So why bother making your code harder to read, just for the slight advantage of not having to extract an interface maybe 20 years from now?
5
u/deadron Apr 21 '21
I am not sure where this pattern comes from but it is pervasive. The benefits have always seemed dubious to me. If you are writing a framework, sure go nuts, but if you are writing an application that wants to test and verify everything works you don't want implementations swapping in and out.
→ More replies (1)6
u/CartmansEvilTwin Apr 21 '21
As far as I can tell, this comes from the "reusability is everything" hype.
Every component has to be written in a way that abstracts away any coupling to anything, in case you might want to reuse that class. And in the end you write 300 lines of code to maybe save 5 lines at some point. To me this looks like the typical take one principle and overshoot it's application to the max.
2
u/matthenry87 Apr 21 '21
Agreed. I'll usually implement an interface when I think it would be cool for myself or someone else to create another implementation. JsonMasker is one I did, and JsonVerifier. I used Jackson for the first, and JsonPath for the latter (which might also use Jackson under the covers). For Services(business logic) I don't bother..
2
u/MadBull69 Apr 21 '21
Isn't using interfaces everywhere an anti-pattern these days? All the modern Java development I've done (with Spring/Quarkus), only uses interfaces where we actually have multiple implementations.
→ More replies (1)2
u/Serializedrequests Apr 21 '21
How often do you ever inject anything other than the one implementation of something that exists in the project? Honestly?
I maintain a huge spring boot REST API at my current job and 100% of DI in unit tests could easily be done some other way. A lot of the most useful stuff is overwriting private properties which seems pretty hinky to me.
1
u/deadron Apr 21 '21
Most of the time what I use it for is to inject mocks in place of classes performing IO such as database calls or external service calls. While you can get away with testing against a real database(dockerized or otherwise) if you are making calls to something like twillio, and you cant inject a mock replacement for the class making the calls, you effectively cant run tests using that code path.
The caveat here is assuming you are doing constructor injection(or UGH public setter injection) many of your tests can be written without even using the DI container at all. Of course something still has to be creating the classes at runtime and a DI container is the simple solution usually.
If you have to overwrite private properties to test thats a perfect example of something that should be added as a dependency to the class and injected instead.
→ More replies (12)7
Apr 20 '21
but when I do it's usually painful because it seems like if you want to be taken seriously as a Java programmer these days
I kind of see a trend to the opposite, especially with microservices. There are many micro frameworks like Javalin which have popped up which promise no annotations and pure Java code.
when I do it's usually painful because it seems like if you want to be taken seriously as a Java programmer these days, you have to rely on things like DI frameworks and magical annotations to such an degree that it becomes very hard to read the code in a project you're not intimately familiar with.
A lot of Java development is enterprise where you're dealing with a lot of dependencies. DI container automagic takes care a lot of the tedious configuration.
The trend towards microservices, where instead of bundling all your dependencies in one mega-service, you spread them across multiple services, has really reduced the need for this.
2
u/audioen Apr 21 '21
And the Dog example given against typescript is just perplexing. Whoever writes code this way if you can just use a class.
1
85
33
u/RunnyPlease Apr 20 '21
Java wasn’t my first language but it’s the first language I ever fell in love with. But even I can see why some applications or corporations specifically are better suited to using other languages.
In faith I do not love thee with mine eyes, For they in thee a thousand errors note; But 'tis my heart that loves what they despise, Who, in despite of view, is pleased to dote.
49
u/coincoinprout Apr 20 '21
Java developers can confidently trust the JVM to do what's best. Whether they're implementing a multithreaded application or storing a large amount of data on the heap, they can be confident they won't shoot themselves in the foot with memory management or data races.
That's an exaggeration. It's true that you don't have to deal with memory management directly. But you can absolutely shoot yourself in the foot with memory management or data races. I don't know a lot of java programmers who never had to deal with OutOfMemoryErrors or thread safety issues. I think that the JVM is awesome but IMO you have to understand how it works at least a bit if you want to be a good developer. Thinking that the JVM will magically deal with all these issues would be a big mistake, and that's how you end up with an application that crashes in production.
12
u/TheCountRushmore Apr 20 '21
There definitely are those developers who think that they can load in more data then they have memory. That happens in every language though and they learn that lesson quickly.
1
u/deadron Apr 21 '21
To be fair there are often not good tools available to help with this. For example if you are reading a file there is no JDK offered solution to avoid slurping up a file larger than your entire memory. Sure, depending on the situation, you can use streams to process the file, but that is never quite as easy as it sounds. A wrapper that lets you set a maximum size on the file read and kills the read with a sensible error message would be really useful.
5
u/iamsooldithurts Apr 20 '21
Reporting in. You absolutely have to be aware of how things work. You might only have to deal with these issues once in a life time, but they do happen.
9
u/lessthanoptimal Apr 20 '21
Yep I agree. Due to the problems I solve, I probably have to spend more time thinking about memory management than if I was writing a modern C++ project. Things do get more complex in non GC languages once that part of the code needs to get optimized. At least that's my experience.
3
u/istarian Apr 20 '21
Is there a magic fix for no more memory or concurrency problems? Those don't seem like issues that are specific to Java.
5
u/DualWieldMage Apr 20 '21
I think for OOM a large portion of the problem is various processes having caches, managed runtimes allocating large heaps, but none of them communicating with eachother about how to coordinate system memory usage as a whole, so often you can only set java max heap conservatively. Ideally an OS should signal processes that memory is scarce, run your GC and release unused memory or else be oomkilled. It's definitely possible and makes sense to write such a monitoring tool if the problem is only multiple JVMs in a single machine, for example microservices in a container.
7
u/iamsooldithurts Apr 20 '21
They’re not specific to Java at all. The magic fix for concurrency problems is semaphores. For memory, that can be a very complicated problem; Java can only address so much space, so if there is too much data you’re SOL. If there isn’t too much data, but you still run out of memory, it can be a chore tracking down where the leaks are because some things don’t pass out of scope and get flagged for GC like you would expect.
3
u/Zardoz84 Apr 21 '21
They’re not specific to Java at all. The magic fix for concurrency problems is semaphores.
These aren't the magic fix. Instead, is one of the classic ways to handle.
PD: There isn't a magic way to handle it.
1
6
u/coincoinprout Apr 20 '21
I don't think that there can be any magic fix and it's not specific to java indeed. The thing is that a lot of junior java developers think that they don't have to think about the memory. I've been there. And I think it's important to say that nope, the JVM won't be there to save you if you're not cautious.
2
u/throwawyakjnscdfv Apr 20 '21
The only mainstream language that handles data races is Rust. Threading in every other language is equally or more painful than Java. Java probably has the most sensible, flexible threading support of any language I've used though.
17
u/tim125 Apr 20 '21
Java libraries are fundamental. There are a range of interfaces that are defined by the now jakarta ee specs which allow innovation above and beyond what Microsoft deliver. Hadoop and other big data system (spark etc) have little competition when they came to maturity ... and that was years ago. There are hi tech solutions to problems you don’t even know exist.
Where C# is a petridish, Java is a planet. Evolution has done well for Java. Once primatives are flattened and inlined the whole ecosystem is better off.
Under hyped... Yea but there are real world problems to solve. The java hype was in 1996.
6
u/Orffyreus Apr 20 '21
Yes, and Java could be hyped a little more for being so good at supporting to solve real world problems instead of bikeshedding about technical micro improvements.
29
u/ziano_x Apr 20 '21
Most of the people I know who hate Java, do not work on Java. They just glossed over it and let their biases take control.
0
Apr 20 '21
[deleted]
7
u/androgynyjoe Apr 21 '21
When I worked with Java I was somewhat ambivalent toward it. Now I work with R and I miss Java every day.
2
u/ziano_x Apr 21 '21
I did not have to go that far. I started missing Java the moment I started writing javascript in the backend. ;-)
1
0
3
→ More replies (1)2
Apr 21 '21
That's not logically consistent. OP posited a reason as to why people might dislike Java. You simply made a random comment. Explain what makes Java so bad in your opinion, or simply don't post.
→ More replies (4)
34
u/post_depression Apr 20 '21
I would never understand why people hate Java. Being a java lover I ask them about their reasons, and here are the common answers:
I don’t understand Java. (Well is that really Java’s fault?)
It’s too much boilerplate code. (Well, I agree, but I always love verbose languages. Reason why I also love TypeScript)
“... but, but, but ... you could do that in Python in only 3 lines!” (Have you ever heard of Generics and the Collections Framework ... or lambda expressions?)
The problem I have seen is not that almost everyone will only learn the ancient bits of Java. Most books and online tutorials teach Java in that way. These people never gets to realise that Java has evolved over time to compete with the “modern languages” and have most of those features in one way or the other.
24
u/whitechapel8733 Apr 20 '21
I think Python is criminally overhyped. Java just needs sexier documentation and better branding and all the kids will love it.
3
May 05 '21
I am still studying but I think that is so true. No one in our batch wants to learn or teach Java, every other tutorial I see on the internet is either about Python or Javascript. Professors mason the thought of "Machine Learning and Web Dev is hype these days, go learn Python or something and make tons of projects", but no one says go learn Java.
Everyone asks Why Java? But no one asks How is Java.
9
u/CraftyAdventurer Apr 21 '21
I can maybe give you some perspective as a guy who worked with Java, hated it, went to Node, fell in love with it's simplicity, used it a lot (among with using smaller subset of other languages like C#, Go, Python), started seeing real strengths of Java, and came back to Java.
Too much boilerplate people talk about often doesn't refer to strong typing or being verbose in general. It refers to some weird things you have to do in Java vs how you can do them in other languages, which can especially confuse beginners.
Compare for example Java's way of getting user input with how you would do it in Node. Even if you use Typescript with Node, you still just get the input, you don't have to create new Scanner and give it System.in for that. Things like this are a minor annoyance, why do I need to create Scanners and give them something, why not just call a method a be done with it? There are a ton of those small things in java which are not a problem by themselves, but in large numbers, they can become really frustrating when you are already working in a stressful environment and now have to deal with googling stuff like that because they are not easy to remember.Even though I worked with Spring Boot much more than I did with Node, I can type the Node API much faster and most of it from head, while I still have to google Spring stuff almost every time, I just can't remember it.
Middleware in Node is a breeze to write, in Spring I have to google Servlet Filters.
Creating JWT in Node is basically just doing jwt.sign({someData...}) in almost any place you want. It's intuitive, it makes sense. I want to sign a JWT, I will call jwt.sign. It couldn't be easier if it wanted to, and using Typescript doesn't make it any more verbose.
In Spring it's like "here, create these 4 files and fill them with tons of code you will never know how to write from your head because most of them don't even contain a word JWT but are some kind of adapters and configurers". That's not intuitive at all, it's annoying. I want to sign a JWT, not build a world around it.
And yes, you are right in saying "The problem I have seen is not that almost everyone will only learn the ancient bits of Java. Most books and online tutorials teach Java in that way. " This is actually a big problem. It presents Java in a bad light. Not only do most tutorials show ancient ways of using Java, but they are also extremely basic. Jump into Youtube, Udemy or any learning platform and type "instagram clone, netflix clone, how to make a chat app...". On Node/Flutter/Python/etc side, you'll find videos with high video quality, large readable font, high audio quality and a presenter who is articulate, talks clearly and sounds enthusiastic and happy while writing the project. The project itself also often does cover most of the things you need in building a real app.
Now try to find any of those videos in Java realm, you will more often than not run into 5 year old videos with outdated frameworks, thick Indian accent, horrible sound quality, bad code examples and extremely basic projects which cover almost nothing you would need in a real app (authentication/authorization is for some reason missing in most Spring videos).Now imagine yourself as a beginner who knows nothing about differences in languages but decides to learn something, which would you choose to learn? The verbose language with bad quality videos that cover only the most barebones basics recorded by authors who sound like they are bored to death? Or the high quality videos which really build almost complete apps with people who sound like they actually enjoy building this stuff? If I didn't start with Java as my first language and didn't work in the industry with it, I would probably avoid it like most people do and never get the chance to learn it's strengths, and this is what happens more and more. Java needs a better representation of itself on the internet. Most languages have "this is why we are better than java" articles, so Java needs "this is where I'm better than other languages", or "this is how you can use me today and build a full fledged app".
35
u/youwillnevercatme Apr 20 '21
Boilerplate in Java: Ughh, terrible I hate this language
Boilerplate in Go: Classy and elegant as every code should be easy to read
12
u/lurker_in_spirit Apr 20 '21
Yeah the first few snippets of Go code that I wrote made me think "wow, that's a lot of ceremony!"
Granted, it was all I/O-related, but still...
8
u/throwaway32908234972 Apr 21 '21
ugh Go is the fucking worst. At work we call it "C with garbage collection"
All the fucking shit copy pasted all over the place because it doesn't even have shitty Java generics. Designed by C programmers for C programmers that want to write high level code without learning anything.
3
8
Apr 21 '21
The problem I have seen is not that almost everyone will only learn the ancient bits of Java
Yes exactly! Most tutorials is some dude typing slow as fuck in Eclipse. Modern Java is totally different.
-4
u/Freyr90 Apr 20 '21
I would never understand why people hate Java.
Weak and not very expressive language.
This leads to tons of obscure code generation that could rival with GObject. Lombok and Spring are good examples.
2) Tooling typically is not very friendly towards text editors, XML configs everywhere, hard to write code without bloated IDE with tons of plugins.
20
u/wildjokers Apr 20 '21
XML configs everywhere,
This hasn’t been true for at least ten years. There is an occasional tool that uses XML (e.g. Maven) but generally XML for config is not used much anymore.
3
u/Celeriax Apr 21 '21
If you’re seeing XML in a Java project:
A) you’re using Maven (there are non-XML alternatives, like the very expressive Gradle)
B) you are on a very old project, one that has to interoperate with legacy services, or one run by someone with very outdated ideas
12
u/PeaceSign02 Apr 20 '21
Because I mostly write in Java, I assumed everyone used an IDE. Is that not the case? Do people not using Java not use IDEs?
4
u/Freyr90 Apr 20 '21
Well, many people outside java world use something more lightweight. I use emacs for example for nearly everything, and I don't need much complex features even for Scala.
I can write java in emacs (and do), but everything from dealing with annotations and generated code to simple editing of maven files is tedious.
3
u/ljdelight Apr 20 '21
Projects over 10k LOC basically require an IDE (or text editor plugins that support debugging and search, like emacs, vim, vscode)
→ More replies (2)1
Apr 20 '21
I only use an IDE for java. When I'm using python or JS, it's vscode for me (afaik, vscode is still a text editor)
3
u/Log2 Apr 21 '21
Unless you have 0 plugins in that vscode, you pretty much built an IDE out of plugins.
10
5
u/m_takeshi Apr 20 '21
Tooling typically is not very friendly towards text editors, XML configs everywhere, hard to write code without bloated IDE with tons of plugins.
funny you say that because that's what I said about C# when I met our .net team for the first time (even the most experienced ones had issues trying to do things without visual studio)
→ More replies (7)6
Apr 20 '21
Tooling typically is not very friendly towards text editors,
I never understood this argument. It's like saying that modern construction techniques are not friendly towards hand tools.
I've been using emacs for like 20 years now, and it seems practically barbaric next to modern IDEs. Back in they day, when I did C/C++ development I'd set up things like ctags and cscope for navigation, which was really tedious.
But, in Java, I can navigate source code with ease. I used to have man pages and documentation alongside the editor back when I did C/C++, but in Java I don't remember the last time I've really ever read documentation. Code navigation, even into libraries is ridiculously easy, and the IDE will even recognize that I don't have source downloaded, and will download it for me. This dovetails with Java's major strength, its ecosystem, with a ton of open source libraries.
I only use emacs now for the fantastic org-mode, general text editing and writing bash/python scripts.
XML configs everywhere
I haven't configured XML in Java in like 10 years.
hard to write code without bloated IDE with tons of plugins.
Yeah, but those plugins are awesome. Emacs also has a ton of plugins (elisp packages), which are essential for using Emacs and make it superior to lighter weight editors like vi (fight me). It's funny to think that this was also a criticism of Emacs (Eight Megs and Constantly Swapping), similarly by people who used "lighter" editors.
2
u/Freyr90 Apr 20 '21
Emacs also has a ton of plugins (elisp packages)
It's a spectrum. VS Code or Emacs are not plain dummy text editors, but they are far from bloated IDE either, and considering VS Code popularity, it seems to be way closer to sweet spot than big IDEs.
I haven't configured XML
What do you mean by that? That you don't use tooling that uses XML or that IDE has a GUI easing the pain? Many tools in Java world are configured with XML, which is painful to edit manually.
But, in Java, I can navigate source code with ease
You can navigate with ease with nearly any text editor with LSP support. In Emacs there is standard xref frontend for such stuff.
The problem is that with Java you need much more than Completion/Navigation, since there is a lot of code generation and you need a direct support for it to ease the pain.
In most other languages all you need is basic completion and navigation, hence VS Code/Sublime/Vim/Emacs popularity outside Java world.
6
u/throwaway32908234972 Apr 21 '21
Many tools in Java world are configured with XML, which is painful to edit manually.
Longtime Java dude here. Maven is the only tool I use regularly with XML. And its config is a single file. We have a 1,000,000+ line project and pom.XML is the only XML file in it. Granted, we used to have a lot of XML but converted to newer formats years ago when tools added support for modern config options. If your project is XML heavy its 10+ years old. That's just a testament to how maintainable Java projects are.
The problem is that with Java you need much more than Completion/Navigation, since there is a lot of code generation and you need a direct support for it to ease the pain.
All the libraries we use that have generated code you would want to look at use Annotation Processors, which is part of the language itself and works with every build tool. The generated classes all get put into a folder on build and you can go look at them in notepad if you want.
There's some libraries that generate code in the background, like Lombok and Jackson, but there's never a reason to debug this unless there's a bug in the library itself.
1
u/Muoniurn Apr 21 '21
How is it weak and not very expressive? It’s not Haskell, but people created vavr with it and the like. Lombok has nothing to do with expressivity, it’s for boilerplate reduction. And spring is a really complex framework with functionality for everything. It uses DI and the like for modularity. Hell, being able to create such a DI fw is a plus for Java’s strength.
2
u/eled_ Apr 21 '21
That's my personal outlook on it. Since the introduction of lambdas, and to an even greater extent today, the language has gained a lot in expression potential.
Depending on the context you can have plain-old java style, spice it up with functional style, you can alleviate some parts with annotations and go ham on reflection, you can go with compile-time codegen.. There is a lot of variety in java nowadays, all these options are very accessible with extremely reliable tech underneath and very few catches, unlike many other languages that tend to have those huge compatibility gaps or annoying external tooling required.
1
u/Freyr90 Apr 21 '21
How is it weak and not very expressive?
It's so unexpressive that people have to use code generation to build basic stuff like immutable records without pain of creating Builders manually.
Lombok has nothing to do with expressivity, it’s for boilerplate reduction
Boilerplate is exactly the evidence of Java being a very inexpressive language. Patterns are features re-created with code.
When your language lacks important features, you adhere to patterns, hence boilerplate. C programmers use GObject, Java programmers write Builders etc.
The popularity of Lombok and alike proves that it's very hard and tedious to write Java without code generation facilities, helping with boilerplate.
1
u/Muoniurn Apr 21 '21
Expressivity and verbosity are two not entirely orthogonal axes. For example, both Haskell and Lisps are thought to be highly expressive (in the meaning that constructs not available in the language can be created and used as if they are “native”), but Haskell is arguably less verbose due to being able to express many things without parens, use (often strange and unreadable) symbols, etc.
Patterns are twofold. Some do come from lack of expressivity, eg Visitor pattern, which is equivalent to pattern matching in FP languages, but many others are rather architectural ones, that are not made obsolete by any other language.
Not having properties is absolutely not an expressivity problem but a (questionable) verbosity one, because it is trivial to accomplish their goal. On the other hand adding generics to C is simply not really possible (or some ugly satanic thing with macros at most), it is an expressivity problem. Java’s generics may be considered a verbosity problem due to not as strong type inference as eg Haskell.
→ More replies (1)1
u/pfarner Apr 21 '21
I've worked with Java since '97, and the only XML configs I can think of in that time are in the build instructions (maven, and before that ant) or places (typically a long time ago) where we chose to use XML in the application (which has nothing to do with the language).
What do you think goes into this supposed profusion of XML?
Doesn't your editor support XML (e.g. matching close brackets to opens) anyway?
4
3
u/Orffyreus Apr 20 '21
Relevant cleancoder.com article: https://blog.cleancoder.com/uncle-bob/2016/07/27/TheChurn.html
1
3
13
u/Gaarco_ Apr 20 '21
Quality package manager and build system[...]
I have to disagree, the split between many (Gradlethe nightmare, Maven, Ant, Bazel and counting) is not good in the first place and they are somewhat forced on you, like Gradlethe nightmare on Android.
12
u/daniu Apr 20 '21
What are good package managers in other languages? Honest question, I'm aware go and Rust include them in the language, but I haven't used them in practice so I can't really judge them. Python's is external I think?
I do have passive experience with npm, but that's more of a nightmare.
6
u/Log2 Apr 21 '21
I currently work with backend development in Python. I can tell you that by far, the biggest pain point we have is pip (the dependency manager). If it weren't for docker, shipping would be a tremendous effort. I'd kill to have something like Maven (ok, maybe with toml instead of xml) for Python.
4
u/eled_ Apr 21 '21
It isn't maven but it's a start, maybe you should look into poetry
1
u/Log2 Apr 21 '21
We've started using it in one of our projects already. It's indeed a massive improvement over pip. Though it insists on virtual environments, even if you want to deploy something on a docker image. It's meant more as a library publishing tool, in my opinion.
For now, we just configured it to not create the virtual environment, as we really don't need it. Otherwise, the experience has been good so far.
2
u/Blobos Apr 21 '21
I was so shocked going from Java back to Python and finding there is no good dependency manager or build tool in the Python ecosystem.
Poetry was the best I found but it's nowhere near Maven.
5
u/shponglespore Apr 20 '21
Rust's build system and integrated package management are a pleasure to use. Cargo feels like what Maven was trying to be, but with much less ceremony. Haskell has similar infrastructure to Rust, but it's split between the build system (Cabal) and the package manager (Stack).
8
u/helloiamsomeone Apr 20 '21
Cargo is terrible. It's repeating mistakes of the past for no good reason. The entire ecosystem built on top of static linking makes Rust an insane option in many scenarios.
3
u/throwaway32908234972 Apr 21 '21
static linking is the only solution to DDL hell. It also allows you to use LTO which significantly reduces binary size and increases performance.
This is why Go also uses static linking, and why modern Java projects all use UberJars
1
4
u/deadron Apr 20 '21
The problem is not really the package management portion, its the build portion. The dependency management portion is rock solid and almost the package managers use the same mechanism for resolving dependencies(I can't speak to bazel). However, once you get into the actual build, packaging, and other tooling in the build it becomes far more difficult. It's not easy to write your own plugins and existing plugins are difficult and hard to use. Gradle suffers from being in groovy and maven/ant suffer from being in XML with plugins that do not receive as much maintenance as you expect.
This is not unique to Java by any means. The only time npm is easy to use is if you keep strictly to small shell callouts within the scripts portion. I have nightmates about grunt/gulp scripts that grow more and more complicated.
0
Apr 20 '21
[deleted]
4
u/CyAScott Apr 20 '21
I have experience with both Maven and Nuget. Functionally they are basically the same. The only difference is the tooling, which is more of an IDE thing than a feature of the package manager.
→ More replies (6)3
u/forresthopkinsa Apr 20 '21
I'd take Gradle over Nuget 100x over. I guess it comes down to whether you want to be able to manually edit and understand the build config vs. wanting the IDE to do it for you.
14
u/Vidogost Apr 20 '21
Maven has introduced a really good structure for package repositories. Unlike some other languages, you don't need virtualenv to use desired dependency versions, and they are cached for the whole system (well, user home dir). Ant is deprecates, and gradle uses same repositories structure as maven. Bazel is somewhat exotic, I believe people don't usually consider it for small java projects.
3
u/Gaarco_ Apr 20 '21
Ant is used more than what you expect
→ More replies (2)4
11
u/Dr-Metallius Apr 20 '21
Gradle and Android Gradle plugin are two very different things. The latter sometimes has issues indeed, but there's nothing wrong with Gradle itself.
Also I see contradicting things. At first you complain about too many choices with the build system and in the same sentence you complain that there is no choice on Android. So I don't get it, do you want to see variety or not?
Besides, I'm not sure what you want Google to do with regard to Android build system. They picked one and have been developing a plugin for it - the most obvious decision. What else should they have done?
5
u/Gaarco_ Apr 20 '21
I want to see variety, but I want the freedom to choose the tool.
Gradle is terrible, you are forced to learn a useless language you won't be using anywhere outside of Gradle. Everything in the build system and language is implicit and you have to know everything to do the stupidest thing. Why not Java as language instead of that garbage Groovy is? If not Java, there are many languages out there better than Groovy.
On top of that there is the google plugin, it is just built on a bad platform and inherits all the flaws.
6
u/ljdelight Apr 20 '21
The Kotlin syntax with Gradle is really nice. I agree that if you don't do things the "gradle way" it'll be more difficult, but Gradle's opinionated decisions (and maven's) make it easy for users. For example, if you're nesting source sets you've done it wrong; or if you're making two jars from one source set via excludes, you've done it wrong.
4
u/Dr-Metallius Apr 20 '21
Why does everyone talk about Gradle forcing you to use Groovy, when Kotlin has been an option for a long time already? I dislike dynamic languages in general, but obviously I switched to Kotlin when it became stable and haven't looked back since.
3
u/ArmoredPancake Apr 20 '21
Gradle is terrible, you are forced to learn a useless language you won't be using anywhere outside of Gradle.
Only if you're Java web developer. On Android Kotlin is a primary development language.
If not Java, there are many languages out there better than Groovy.
Kotlin DSL is available since 2018.
5
u/dpash Apr 20 '21
If you're writing groovy, rather than using the DSL, something has gone very badly wrong. You should not be using imperative code in your build scripts.
Admittedly, there is a lot of articles and tutorials that teach the wrong thing to do.
6
u/ArmoredPancake Apr 20 '21
rather than using the DSL
DSL is a nightmare fuel without auto complete. Without Kotlin it's impossible to use Gradle unless you're full-time Gradle fiddler.
3
u/Orffyreus Apr 20 '21
Yes, you can write some insane Gradle build scripts from scratch with the help of auto complete in Kotlin, and I think you should be very careful nonetheless, because auto complete does not help to read those build scripts and it does not make people more confident to modify them.
5
u/forresthopkinsa Apr 20 '21
You should use Gradle a little more. It's wonderful. It's one of very few package managers / builders that is designed to work in general rather than for a specific language.
I really hope it catches on for other languages.
1
u/Orffyreus Apr 20 '21
Yes, you have to use Gradle for Android, but Gradle can use all the dependencies from your local maven repository (default location: ~/.m2/repository).
5
u/rer1 Apr 20 '21
Author mentions Scala being taught in university but having a different developer experience than Java. I would argue that this experience is even better.
Scala exhibits all of the advantages that the author points in favor of Java and many more. The major downsides of Scala over Java are compilation times, a (much) smaller job market, and a higher learning curve (Scala has a lot of additional features with the potential of abusing them).
Try Scala. You don't have to be a FP enthusiastic. You'll have fun :)
2
u/RichoDemus Apr 21 '21
Even though you don’t have to use it, sbt is crap. IDE support is worse for Scala, and there’s just something about Scala that encourages people to write clever AKA unreadable code :)
1
u/rer1 Apr 21 '21
I won't deny that SBT is not ideal, and that's why I use Gradle :) IntelliJ is a pretty solid IDE for Scala, I haven't found any major issues with it.
As for readable code -- yep, that's why I said that there's a higher learning code and more potential for abuse of features. This is a bit similar to Python, where the language provides many neat features and syntactic sugars that end up in "elegant" and completely unreadable code.
1
u/Shinosha Apr 23 '21 edited Apr 23 '21
Scala 3 is literally around the corner by the way, it's a good time to pick it up. It will teach you things most mainstream languages won't. Also you will enjoy smirking while the pleb go into raptures for basic type inference.
SBT isn't perfect, but now that I know it, I totally prefer it to Maven for example. Reading code is a lot easier than an XML wall and if you know how to inspect the build it's pretty easy to figure out what's going on. The only thing I hate is scope delegation, otherwise everything else isn't difficult. BSP support in SBT 1.4 is also helping a lot with IDE feedback and performance.
2
u/UltraRuminator Apr 20 '21
I would contend that the criminality 'lies' with other languages being vastly overhyped!!
4
Apr 20 '21
Pretty sure most people don't know that Java now supports 'var' keyword. You don't need to mention the datatype while declaration. Java is improving day by day.
12
Apr 20 '21
It is, but most companies are still on Java 8. No var there. Java 11 got some adoption, but anything past that has barely been touched. I'm excited about java 16. Lots of goodies there.
8
u/throwaway32908234972 Apr 21 '21
It depends on the industry. If you work on a tech team at a bank, probably Java 8 for the next decade. If you work at a tech company you're on Java 11 looking to upgrade to 17 soon.
At my company every project is on 11 now.
4
u/nutrecht Apr 21 '21
It is, but most companies are still on Java 8.
You have to be careful with interpretations of self reported statistics. Keep in mind that many companies have both older and newer systems and generally will be 'on' multiple Java versions. I can't remember when I worked for a company that only had one single Java application.
5
u/8igg7e5 Apr 20 '21
Actually migration past 8 has been picking up pace considerably.
Multiple sources put Java 11 adoption at ~20% in mid 2020. That's 18 months after release and we're now at 30 months so that number will have only grown.
And getting past Java 8 was a more difficult step than moving past 11 so I expect that Java 17 (Sep' 2021), the next one that Oracle will consider an LTS, will see an even quicker transition (there's arguably more benefit for every stakeholder in an 11-to-17 transition than there was in 8-to-11).
For Java 8, while you can probably say 'most companies' for a while, you might not be able to say 'most projects' for long. I expect many companies will have a project or two lagging but I expect the most actively support projects will have made the jump pretty soon as support dries up (unless you pay for Oracle extended support).
3
u/nutrecht Apr 21 '21
Those statistics will be heavily skewed with applications that are 'stuck' on Java 8 and will be sunset once they're replaced. I'm currently on such a project and for as long as the old system still needs to be in place we will be 'using' both 8 and <latest JDK>.
2
Apr 21 '21
I hope that Java 16 is considered as a suitable option rather than adopting Kotlin for a JVM based language.
1
Apr 21 '21
I haven't given Kotlin a fair shot because I'm lazy but it does seem like a very good language
1
1
u/paul_miner Apr 21 '21
I am curious why Java lost its hype in the first place.
I'd fault Java applets for souring many people's first encounter with Java. Sandboxing an executable is always a tall order, but it still left a negative impression to constantly hear of new exploits stemming from Java applets.
The other thing is that much of what makes Java great to work with long-term and large-scale, the explicitness, the verbosity, the strictness of the compiler, are things that may seem like pointless red tape to new programmers. All that extra structure isn't there to facilitate writing Hello World as expediently as possible, it's to make integrating that large third-party library into your large application possible while minimizing the opportunities for mistakes to crop up.
1
u/jaybyrrd Apr 21 '21
I love Java.
You’d be a criminal to pretend that it’s better than Scala though.
1
1
u/IanRae Apr 22 '21
Java before Java 8 was pretty creaky and had a lot of fussy and verbose syntax. Things have improved a lot since then, and the latest features are making it a very modern language.
1
u/BB1CC Apr 24 '21
I had courses that used Java. I think that your courses not choosing Java doesn't mean no other college is using/teaching Java. It gave you the wrong impression that nobody talks about Java.
1
u/ahelord Apr 27 '21
Hi, I'm sorry to get into the discussion so late.
I have read several of the comments and the topic is very important to me.
I have been a Javascript developer for 5 years mainly in startups, I recently decided to learn Java due to the need to achieve a higher position in large technology companies (improving my income) and because of the versatility I see creating mobile applications. I want to tell my story in three parts: 1. Developing super emotion in Java, 2. Software engineering and 3. Consideration of productive languages.
1.Developing superhyped in Javascript
I started in Javascript for about 5 years I have used frontends and backend frameworks and I find in javascript a lot of versatility to solve problems since there are many packages available for enterprises, these are key because the implementation time and costs are reduced by using a single language.
2. Software engineering
Over the years I was feeling that I was quite unfamiliar with software engineering and that I was unaware of the basic software development guides, design patterns and architecture patterns, what seemed curious to me was that I had been developing software for many years and had never needed them ( or so I thought). Reflecting recently I thought that language had never proposed it to me or simply in the forums I found ready-made solutions and implemented them (which is not bad). I want to improve my income and the current market offers me better income knowing Java.
3. Consideration of productive languages
So I learned Java, I realized that there are many benefits in OOP that I never consider in Javascript and perhaps because of the type of solutions that startups use (between 1 - 5 years of life) that are simple solutions with operations in CRUD (I have worked in two so far and I feel like it's the same). Doing a metaphor Javascript is like Lego any part fits all. Now learning Java I feel that I lose that versatility in the sense of making many type declarations, also writing many lines, it worries me since I come from Javascript where I do not need OOP or typing so the number of lines is less which translates into time, I understand that This time in the future is wasted with scalability problems (bad software engineering practices) but for a startup this does not matter as much as the solution itself, that's why I am going to learn Scala I feel that it still has a lot of Java teaching and allows me to be productive , It seems to me that it is the best attempt to improve Java (I have analyzed groovy and kotlin that it seems to me that it is still more focused on mobile applications and at the moment my focus is backend)
1
u/manishksolves May 05 '21
First know what is Java
Java is a high-level programming language developed by Sun Microsystems. Instead, Java programs are interpreted by the Java Virtual Machine, or JVM, which runs on multiple platforms. This means all Java programs are multiplatform and can run on different platforms, including Macintosh, Windows, and Unix computers.
1
1
u/umlcat Apr 21 '21 edited Apr 21 '21
tlrd ; Java v.s. Dynamic Script Programming Languages. I like and use both.
I didn't get if the idea of the article is to criticize or support Java.
I learnt several P.L., both due to work reasons, and also due to intellectual reasons.
And, hypes, trends, does affect the usage of P.L. (s).
These days the Java Ecosystem is not as trendy as the new dynamic typing, most functional paradigm P.L., independent of their real value of both.
I worry about newer developers are too "trendy" about the new P.L. and too "close minded" about the older ones.
I prefer explicit typing over type inference, static typing over dynamic, O.O. over Functional, yet that doesn't mean I don't use the later.
I occasionally met older developers that dislike dynamic (typing) P.L., yet they use a lot of SQL, which generates one or new schema type in each query
Most P.L. these days are hybrid / mixed paradigm.
I started designing my own typed javascript P.L., when Coffescript and Typescript appeared.
Because I like both ways to make a website.
Java is currently suffering from the same issue that brought it to life: Trends (Hypes).
I was there were Java was a "shinny new toy" trend, and now, the "wave is leaving".
Java Ecosystem, also suffers from others issues, lost their "oddfather / patron" ( Sun Microsystems ), and the new ( Oracle ) didn't knew how to handle Java well.
Also, didn't evolve well. Definitely, C# looks like the "Java it should be", and no, I don't like Microsoft, but Microsoft does get hurt by competition, and hires or buys good employees and companies.
And, Ximian and Icaza and his people, work hard to make C# become multi platform, the only missing main issue that Java was better.
I like to think "Java" as a Platform and Ecosystem, not just the Java P.L.
Java. V.M. 's Scala is a good proposal, but I still think we need another new Java competitor / proposal from the same Oracle, not from another company.
If this article link, supports Java v.s. the new P.L., it works well against the or hype, but still misses some tech issues.
But, to be honest, it's not the author culprit. Oracle should make their money invested in Sun more productive.
Summary
Developers should learn and use P.L., based on features and productivity, not on favorable or disfavorable trends ...
-2
-22
Apr 20 '21
Java simply feels good to write.
It doesn't feel that good when you try to read.
14
u/lessthanoptimal Apr 20 '21
What language do you think is the easiest to read, as it scales into very large projects? Python I think is great for small projects. C++ is about the same as Java, unless satan was in charge of the coding standards and decided everything must be auto and all classes must be templated.
→ More replies (13)9
Apr 20 '21
Exactly because of its verbosity I’ve yet to encounter any language which is MORE readable then java regardless of who wrote the code
1
1
Apr 20 '21
a Lisp
→ More replies (5)1
Apr 20 '21
I disagree. Functional languages have too much information density. Sure, there is no ceremony or boilerplate, but having the information spread out a bit more by easily recognizable structures like java has makes code easier to consume, at least for me
→ More replies (1)1
u/throwaway32908234972 Apr 21 '21
I used to think that. It was because I started with scripting languages like PHP and Perl.
Now I love Java's explicitness and strong typing. For large projects its a godsend.
1
Apr 21 '21
You must be kidding. Java is one of the easiest languages to read. A lot of that "verbosity" is essential verbosity. Unlike many other languages, Java is actually as easy to read as to write.
55
u/[deleted] Apr 20 '21
Oh great. I'm glad you discovered strong typing benefits. It is official: you are not a hipster programmer anymore