13 ms·
Love It or Hate It, Java Continues to Evolve
- taneq 7y agoI think the reason so many people have mixed feelings about Java is that "Java" is actually several things: - The Java language - The Java API (and/or whatever set of libraries you're using) - The Java ecosystem, tooling, etc. - The sorts of work typically done these days with Java It's perfectly possible for one person to feel strongly one way about some of those aspects while feeling strongly the other way about others. For instance, I'm quite fond of the Java language, I mildly dislike the Java API (in how bloated it's become), I'm ambivalent about the ecosystem, and I do my best to avoid the "Enterprise Software" CRUD-churn that Java development often entails (although this might have changed, it's been a while since I did Java commercially.)
- schpaencoder 7y agoNot a die hard java/go-or-anything entusiast, but replace the name Java with Go and you have the exact same thing.
- vijaybritto 7y agoBut with Go you can iterate quickly compared to java as the compilation time is very small. This difference is massive in big projects. This is an important reason why I took up Go for many projects.
- sgift 7y agoCan you give a few numbers what counts as "very small" here? Most of my big java projects take less than two minutes for a full compile and incremental compile of the whole project is usually in the range of 10 secs. If you run the whole test suite it can take longer depending on the tests, but that's not what I'd count as "compile time".
- deleted 7y ago[deleted]
- Nursie 7y ago> "Enterprise Software" CRUD-churn I did some Java in the late 90s at university, and a tiny bit in about 2001, pre-dating a lot of the enterprise stuff. I've come back to it in the last three or four years and it's currently my main language. I think I manage to miss the enterprisey stuff. I remember J2EE happening to other people, and then for a while everything was Spring. Somehwere in there were 'Beans' Now ... I was pleasantly surprised to come back to it. There are a lot of building blocks and interfaces to use in the various maven-centric public repositories, development is rapid, expressive (I <3 lambdas, which I never thought I'd say) and ... yeah. I'm having fun. Part of this might be because I did (mostly) C for a decade!
- gplusplus 7y agoIf you have a strong background in both C and Java, I’d encourage you to give Go a fair shot. I also had long runs with C and Java, but ever since I’ve tried Go, it has become my favorite Swiss Army knife. Basically, it’s my default language until I have a reason not to use it.
- Nursie 7y agoYeah thanks - I've been meaning to give it a go, but my personal coding time tends to be taken up more by "I want to do this" than "I want to explore this" and I haven't had the chance to use Go professionally yet. Go and Rust are definitely on the list of things I want to learn though.
- flukus 7y agoThere's also: The java thing you have to install before using a desktop app that is somehow still incredibly slow and laggy even though you have a top of the line computer in 2019. At least that's been my latest experience with Oracle SQL Developer (glorified text editor), despite 20 years and eleventy bajillion dollars invested in the JVM, java is still a terrible option for the desktop.
- dmix 7y agoWhy are the links larger than the body text on mobile? It’s so annoying trying to read this whole article. Especially when one of the links is pushing their commercial support of Java. Good design and java rarely go hand in hand. These small details matter. I don’t think it’s a mistake that Ruby, JS, Rust, Elixir, etc attract people with good design sensibilities which is reflected in their blog posts, websites, and also API designs, documentation, etc. But otherwise this articles content is not bad, I think we all know why Java and C++ are so popular. It’s one of the first questions every programmer learns their first year programming. This article is a good summary of why. The fact both C++ and Java got things like Lambdas and other modern stuff in recent years is great, but they are obviously incredibly late to the game. Which makes you wonder how long until the other good things will take. Maybe that whole backwards compatibility with decades of some questionable code being a dead weight dragging down the language is one of the reasons why people hate it? You can repaint a broken down house but that doesn’t mean it’s as good as the new house next door.
- yardstick 7y agoIt’s not the language that is the problem. It’s more to do with just how many people use Java, and it being so ubiquitous results greater numbers of poor quality coders. Lesser known/adopted languages tend to be picked up by those who are already good at developing and designing.
- ehnto 7y agoWhilst I agree, it's language features are meant to reduce some of those issues. The rope you have to hang yourself with is a bit shorter than you have in other languages. At least in theory.
- gmueckl 7y agoIn practice, the language gives you enough rope if you don't think or care about design at all. This is a typical beginner's problem once they get past their first toy programs and try to write something useful.
- intothemild 7y agoMy only problem with Java is how it’s written. Enterprise java tends to be abstracted to absurd levels. I prefer a more direct approach.
- boyter 7y agoNothing stopping you from doing that. For HTTP some of the newer frameworks like javalin or spark encourage it and get close to flask or Go levels of simplicity. Chose you own JSON parser, connection pool etc...
- hamilyon2 7y agoMost poorly written java project I saw was incredibly poorly abstracted, it was basically maps with strings as keys and values all over the place.
- kjeetgill 7y agoAs a fan of Java I absolutely agree. Having worked with python and C codebases as well, I think every language has its own particular "degraded mess" version. A sublanguage of hacks built up over years of deadlines, inconsistent bugfixes and evolving paradigms. One nice thing about Java (compared to C and python at least) is that you have quite a bit more tools to refactor and despegettify codebases incrementally.
- signal11 7y agoYes @ absurd level of abstraction, EnterpriseFizzBuzz even manages to laugh at this old-school 'Enterprise' style of writing code[1]. Some enterprises have managed to move away from this though -- DevOps in the enterprise is real and it looks pretty similar to DevOps elsewhere. I've worked with teams in very conservative enterprises that have automated tests and CD pipelines, and release 100s of times a day, and support their own code. And with their newfound autonomy -- no more diktats about "use J2EE" from up top -- these developers did what smart developers do: simplify and reduce dependencies and tech debt. Lots of vanilla JS (or maybe React at most), plain old Java, even Kotlin and Clojure where possible (microservices made polyglot development really easy). I've always thought this was a big reason Oracle dropped J2EE. Their most conservative customers weren't interested as J2EE had become irrelevant for their needs. Here's a public video of how one institution (JP Morgan) managed to modernize[2]. [1] https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpris... [2] https://www.youtube.com/watch?v=Tyev4Ti9Xsc https://www.youtube.com/watch?v=Tyev4Ti9Xsc
- Forellen 7y agoOnly a person who loves something would start with "Love it or Hate it", FYI.
- ragerino 7y agoMost people don't even know why they hate Java. And the rest hates it because their Chief Architect taught J2EE is a great idea.
- yoz-y 7y agoPersonally I developed a dislike for it because of Eclipse, Android Studio, Swing and JavaDoc.
- jtdev 7y agoThose are at the top of my list as well... in addition to Hibernate. Maven appears near the top of my list too, I mean can we please chill out with the copious XML already? Not to mention naming a real construct a "bean" rather than something that actually describes what it is, annotations and other magical shit (AOP anyone?) scattered throughout many Java codebases.
- boyter 7y agoIn my experience most people don't like Java due to experiences they had before Java 8. This means they were used to the bloat, config as XML style world which made Java a pain to write and slow to run. Once I show them Java 11 with var keyword, lambda's and streams they start appreciating how modern the language has become. Then you throw in frameworks like javalin or sparkjava and suddenly they are not as hostile as they were before. Honestly the only things I would really like out of Java these days are data classes and possibly native runtime compilation out of the box. Containers solve the latter issue, but id love to just build a binary and run it. Do that and its on the same level as Go in many ways which nailed the tooling and deployment model, even if the language has issues. Java already has the tooling. I suppose a decent syntax highlighter library like pygments or chroma would be nice too.
- vmurthy 7y ago> I suppose a decent syntax highlighter library like pygments or chroma would be nice too. Could you clarify this? I last worked on Java in 2016 but even at the time, we had eclipse settings that had Syntax highlighters. Am I missing something?
- boyter 7y agoHave a look at http://pygments.org/ http://pygments.org/ or https://github.com/alecthomas/chroma https://github.com/alecthomas/chroma where you can pass code into a library and it returns highlighted HTML. You can use Pygments in Java using Jython but its performance is questionable and can be incredibly slow when highlighting lisp code for example. Its a very edge case for most people, but seeing as I am working on a searchcode.com upgrade I need a fast highlighter. Currently I am spawning a background Go process using Chroma to take care of this for me, but if there was a decent Java library I would use it. None exist I am aware of that are even slightly up-to date.
- ngrilly 7y ago> Once I show them Java 11 with var keyword, lambda's and streams they start appreciating how modern the language has become. I wrote a lot of Java, but it was a long time ago. Could you share a bit of code representative of the modern Java 11 style you mentioned (var keyword, lambdas, streams, etc.)?
- vmurthy 7y agoStack Overflow yearly survey[1] mentions that ~40+% developers who took the survey use Java. Not very surprising if you look at how long ago Java came into being (24 years ago!). I, for one am happy that it continues to evolve. At the very least it shows that the developers of the language are still taking lessons from the programming languages ecosystem :-) [1]https://insights.stackoverflow.com/survey/2019#most-popular-technologies https://insights.stackoverflow.com/survey/2019#most-popular-...
- 0xferruccio 7y agoThe only reason I like Java is that it allows you to sneak in Clojure code. “I’m going to build a solution that runs on the JVM”
- oulu2006 7y agoI made Clojure a first class citizen at my startup :)
- sbov 7y agoJava 8 made it an "okay" language for me to use. It's a lot better nowadays, but historically the biggest problem with Java has been the 3rd party libraries. They tended to be written with extensibility in mind at the expense of usability. Extensibility is great, but it's not the only important thing in a design. I'm not a huge fan of annotations. It makes the language feel a bit magical and hard to debug in some places. It can be difficult to track down how a given library actually treats an annotation - or even a set of annotations since you can put more than one on a given thing. It puts the language in a strange place: sometimes both boilerplate-heavy and magical. > The introduction of annotations in JDK 5 has made enterprise Java development a whole lot simpler by allowing things like dependency injection. This is a bit weird - you don't need annotations to do dependency injection. And you don't need a DI framework either. One thing I don't quite understand is the infatuation with DI frameworks in Javaland. I prefer to just do it by hand where both necessary and plausible.
- rurounijones 7y ago99% of the time I see DI used in Java it is solely to enable mocked dependencies in unit testing rather than injecting different production implementations depending on environmental differences or something like that. I have had Code Reviews where "This is all good, but you should use Guice to mock X" where X is the one time I might have a package-private test only constructor with a NullObject for the one dependency I need to mock out in a commit and Guice is not currently used in the package at all. Personally I think DI has reached cargo cult status in Javaland.
- miohtama 7y agoDynamic languages like Python do not have this issue as you can mock any method runtime for the duration of test. This can done via "monkey patching". It is unclean, but the development cost of having a framework to do just this is a tad high. The only downside is that if you parallel test you need to run them in separate processes (which you usually want to do.any case).
- jesseschalken 7y agoYou're right. Java is a decent language with a decent type system (bar the lack of null safety and some other quirks). It's all the annotations and reflection and XML and magic that creates most of the pain, and that's the fault of the library and framework developers, not Java itself.
- imtringued 7y agoI'd like to see a JVM with a garbage collector that isn't designed to always consume the maximum amount of memory before it starts collecting. If you configure the JVM to have at most 400MB and it's current heap size is 120MB and you allocate 0.5MB every second or simply allocate 400MB of temporary objects that could be collected right away, it will allocate more GC heap until it hits the maximum 400MB and only then it decides to start a collection cycle. This makes the JVM useless for anything that isn't a web server that uses the entire RAM anyway. Although Shenandoah looks promising but it's pretty telling that even in 2019 the JVM only has a single good garbage collector and it's still experimental. 23 years of history my ass. Other than the awful JEE ecosystem, the JVM is probably the worst part about the Java ecosystem. You can't fix it with a language that runs on top of it. It's slow (mostly startup performance), the GC is awful and it gobbles up a huge amount of memory. Obviously my company doesn't care because 8GB of RAM for a webserver costs them almost nothing. It wouldn't surprise me if a WebASM implementation will take over one day, because the JVM is such a failure.
- miskin 7y agoI'm not sure what your real world experience with Java is, but GC is actually quite good and in server side Java I had no issues for years. G1 evolves and I had no issues with it. In Java 12 there is ZGC that have similar goals as Shenandoah, too. It is not like Shenandoah is something that is intended to be mainstream in Java. While G1 is optimized for throughput, Shenandoah is sacrificing performance for very short stop-the-world phase. It really depends on your requirement which one is better. There were multiple GCs before and alternative vendors have their own, for sure. What is your current pick and why is it so much better? JVM is really good tech, it allows ecosystems like Scala, Kotlin, Clojure etc to exist. Since Java 8 there is class data sharing that may reduce your startup time and memory requirements a lot, especialy if you run multiple instances with same classes on same server. Java ahead of time compilation was experimental since Java 9 and GraalVM should also help a lot if startup time is critical.
- miskin 7y agoAnd, of course, even G1 does not fill all memory before it starts collecting. Even generational GCs before G1 divide memory into smaller areas and try to collect garbage quickly to get rid of short lived objects, so we're speaking about Java 6 timeframe. Example from my real world server - most of objects are collected at young generation, so gc costs are minimal, very few objects get promoted to old generation and full GC runs are very sporadic (and they are sub 1sec).
- vitro 7y agoOne thing I would really love to see is a better way how you manipulate strings. Variable interpolation would be nice and you wouldn't have to have all that ugly string concatenation all over the place.
- cutler 7y agoDon't forget regular expressions. How anyone puts up with having to escape all backlashes is beyond me. But, then, I'm used to Perl and Ruby. Scala, Clojure and Kotlin don't have this problem so why is the Emperor Without Clothes That Is Java having such a hard time?
- pts_ 7y ago"James Gosling, the Father of Java, described it as a Blue collar programming language." I wonder what can be considered a white collar programming language which is actually used a lot. Erlang? ES6 with ever changing front end frameworks?
- _pmf_ 7y agoThere has been about a 7 year window of opportunity for Oracle to really push JavaFX as cross platform UI, but they insisted on making it hard to legally use even for desperate Java Swing developer. Almost every Java Swing shop I know is either still on Swing, switched to .NET or switched to web shit. Why, why, why did they not make JavaFX on Android a first class citizen?
- pjmlp 7y agoYou have to ask Google why, not Oracle. Oracle has made JavaFX open source and available to everyone that wishes to work on it. https://openjfx.io/ https://openjfx.io/ https://openjdk.java.net/projects/openjfx/ https://openjdk.java.net/projects/openjfx/ https://gluonhq.com/products/mobile/javafxports/ https://gluonhq.com/products/mobile/javafxports/ Naturally Google prefers to push Android J++.
- javathrow3030 7y agoWhich lib/framework to use today for a webapp backend development in Java ? (I am senior dev, some past java7/8 core server experience, FE will probably be React and then mobile)
- rudolph_codes 7y agoVert.x + RxJava is great :)
- gplusplus 7y agoMy biggest issue with Java isn’t even the language, it’s the culture. I feel like typical Java solutions are just layers upon layers upon layers upon layers of abstractions, frameworks inside of frameworks, and stack traces taller than skyscrapers. It’s just too much! It seems like the Java community has lost the art of coding without a framework. It feels incredibly bloated and entirely too magical. But this has more to do with the ecosystem and philosophies of the community, rather than the language, or even runtime, itself. From a purely language and runtime perspective, I think it’s fine. But I don’t enjoy it. Every time I need to work on a Java project, it’s like it’s a form of punishment. I’d rather do basically anything else.
- bollockitis 7y agoIt's interesting how differently developers respond to languages and their ecosystems. While I don't love Java, i think it's fine. The documentation is very good and interoperability is excellent. Far from a punishment. Punishment for me is PL/SQL which, despite its charming Pascal-like syntax, is painful to work with due to the lack of good tooling and it's awkward constructs (string handling, exceptions, etc.) Honestly, despite its popularity, I feel the same way about Python. Working in Python on anything larger than simple scripts is difficult due to the packaging mess, the 2/3 issue, it's sometimes unintuitive idioms (think "".join(...)). Ruby is probably the most pleasant ecosystem I've worked with but I find dynamic typing a challenge on large projects. Point being, if I were starting a project in a corporate environment, Java (or at least the JVM) would be my default choice. Java seems to occupy a space where it's good enough or "least offensive" to the majority of the team.
- Nursie 7y agoTo me you're talking about the java of a few years ago. It's really not the case now. The enterprise-y types are no longer dominant in the space.
- xboxnolifes 7y agoBut the Java of a few years ago will still need to be maintained for many years to come.
- packetpirate 7y agoWhen I first went to college for my Associate's Degree, we learned C++ and had the option to choose between Java and Visual Basic. I chose Java, obviously, because who the hell wants to know Visual Basic? I really liked Java back then because C++ had always been a struggle, not because of pointers or anything like that... but because I always found project management, figuring out how to link libraries, and build my projects, to be overly complicated. With Java, I only had to import a library, and that was it. I didn't need to link external libraries because Java's standard library was large enough that it had most of what I needed at the time, and adding external libraries wasn't nearly as difficult as C++. However, over the years, I feel like I've kind of grown apart from it and have started to want to migrate back towards C++ and Python. I still use Java because it's the language I know best and it's the language I'm writing my game in, but after I finish my game, I think I'll be using it significantly less. The bulkiness of the code, the complications from the JVM, and the lack of good options for deploying executable code is just getting more and more frustrating. Also, as I was working on my Bachelor's Degree, filling in the gaps of knowledge left by a "meh" education at my previous school, I could see that Java is just not good for writing good, fast code. That said, Java 8 did make me like Java a lot more when it came out, but they're starting to deploy new versions so frequently now I feel like 8 is the last version I will bother learning.
- apta 7y ago> and the lack of good options for deploying executable code GraalVM is a way to resolve that: https://quarkus.io/ https://quarkus.io/, https://micronaut.io/ https://micronaut.io/ You might want to check out C# as well. .NET Core is coming along nicely, and you get to work in a safe environment, with the ability to drop down to pointers if needed, unlike the unsafety that is inherent to C++. There is also a C# to C++ compiler that the Unity people wrote, worth checking out.
- suyash 7y agoI love Java, it's awesome language!
- oftenwrong 7y agoI both love and hate it. I love the high quality libraries and ecosystem, reasonable performance, simple semantics. I hate the annotations and reflection magic, bloated frameworks, type erasure, lack of null safety, build systems. Luckily, it is possible to avoid some of that by not jumping on the bandwagon's standard stack. Leave that framework on the shelf, and Just Write Java. Unfortunately, many existing Java projects you come across in the wild are trainwrecks.
- KorematsuFred 7y agoWhat kept me away from Java was mostly configuration rather than language itself. You had to manually place jars in some lib folder, have things like "classpaths" and lot of this shit was glued together using XML files. But once gradle came into picture along with IntelliJ I totally moved to Java.
- ryuukk_ 7y agoproblem is it evolves way to slow that alternatives already emerged and are used by a lot of people who were looking for alternatives so yeah, evolving in an empty ocean