Why I Like Java (2014)
blog.plover.com
blog.plover.com
I spent much of my career writing Java code but have moved to Go - it's almost a return to my roots as an embedded systems engineer (without the memory management hassles of C) and it's vastly more economical to run Go applications in containers. I do find myself writing code that I used to pull in from a library though.
To a point. In many situations, a better test is whether a coder unfamiliar with said complicated application can maintain it relatively easily.
vast majority of mediocre libraries and one man libraries. We use Spring because it uses the best libraries, so the other ones are discarded.
Java being around for so long doesn't have a lot of convenience methods like others do languages do, like the ones I mentioned in the beginning.
So no, Java is a half assed programming language which C# and NET CORE should replace
Im not saying C# is bad as I don‘t have experience with it, just that Kotlin is a more realistic replacement for most Java shops.
I am happy to try different languages but I will never again support a Windows Server over a Linux VM.
So many other abandoned programs seem to become unbuildable pretty quickly.
It did set a new standard in a way that was very beneficial for the languages that came after it: you're not an ACTUAL language if you don't have a "good" standard library, and I can argue that "good" was defined by Java more than C++ or anything else at the time.
I also don't see any new languages, while more modernized, that have substantially pushed the envelope further to be the new gold standard of a minimum batteries included stdlib. All I could probably say is various threading/concurrency apis, but Java has added a lot of that too over the years.
https://github.com/kevin-wayne/algs4/tree/master/src/main/ja...
Python has pip,
JS/Node has NPM
Here is an example library from Google called "Guava": https://search.maven.org/artifact/com.google.guava/guava/31....
You can find the source code on GitHub: https://github.com/google/guava
On the right side of the page, you can find eleven (!) different wants to include this dependency (and) all of its transitive dependencies with just a few lines of configuration.
Here is a list of the Top 10 downloads of open source Java libraries: https://mvnrepository.com/popular?p=1
Everywhere, on the lib website, on GitHub, on Apache, etc. (including centralized places like Maven Central). You then put a ferences in your Maven or Gradle file like you would in your package.json.
In fact, because for 99% of the libraries you just need to have a jar (or more) in your classpath, you don't have to have all the ceremony that Python has, and all the installation mess, venvs, and other such shite.
If this isn't a joke, I'd suggest learning the Maven or Gradle build systems. NPM has such horrible dependency management that these Java systems will seem like magic!
The first thing I'm noticing is that there seems to be no way to judge the popularity of the libaries (an often-used proxy for quality, e.g. number of downloads, GitHub stars, etc).
I enter "argparse" and the first hit isn't even Java! It seems to be a npm package?? https://search.maven.org/artifact/org.webjars.npm/argparse
I enter "argument parser" and there are two hits. One with zero stars on Github and one with 1 star.
https://search.maven.org/artifact/com.github.easy-develop/ar...
https://search.maven.org/artifact/com.github.raphcal/argumen...
"command line" brings up another 0 star option: https://github.com/AlmondBranch/command-line-parser
I suppose the Java package ecosystem must be good if everyone says it is, but so far it looks to me like I'd find Maven Central very inefficient to discover high quality packages.
Searching for "command line argument parser java" immediately leads you to libraries and infact lists of libraries (see https://stackoverflow.com/a/7829772), of which most are going to be available on Maven Central.
Then you do your research that the library you are looking at looks valid and is trustable (!) by checking out the info available on it, maybe make another search to find opinions on it.
Then when you have decided to try it, look at its docs to find out where it s located on Maven Central and use it from there.
[1] https://mvnrepository.com/open-source/command-line-parsers
Also: Maven Central.
For the most part, anyway... Things are kind of gross if you are trying to use newer nuget packages on the old 4.8 .net framework...
You can search for libraries on mvnrepository.com, or your IDE can search the index. Also most libraries will include a section in the documentation that shows the details of the blob you have to put in your pom.xml / build.gradle file.
So much unnecessary hate and stereotyping. And I bet they were thinking they're tongue-in-cheek-but-still-sounding-clever.
Also, interesting choice of programming languages, neither Python, PHP nor C got any flack, Javascript was spared but Java, Perl and Haskell are evil and using them makes you a "mediocre drone that cares only about cranking the lever and spouting code" (I'm paraphrasing the article here).
Choose your technology, learn your tools...
> I enjoyed programming in Java, and being relieved of the responsibility for producing a quality product.
Although, with that mindset, maybe forego programming altogether.
I can't say I understand every one of his assertions, and trying to be funny/sarcastic makes it hard to truly understand the point of his article, which I think is: Java lacks focus and is a verbose language, and therefore you should probably pick something else to solve interview challenges. I tend to agree.
> Java is neither a good nor a bad language. It is a mediocre language, and there is no struggle.
To be more explicit - I think the point he is trying to make is that Java is not very powerful (in sense of expression), which has benefits (making it hard to fuck up badly) but at the cost of pushing the programmer towards mediocre, verbose and inefficient solutions (again due to lack of expressiveness, trying to come up with elegant and efficient solutions is too tiresome).
Perhaps it's the difference between a scalpel and a blunt club. You're not going to cut off your own fingers with the club, but you're not going to be able to perform brain surgery or fix someone's heart either. Not the best analogy because technically Java and any other language is turing complete, but they are not equal in how easy it is to coerce the machine into performing a particular computation, and expressing that humanly.
We can at least all agree there is difference in the efficiency of writing a program in binary opcodes for a specific architecture vs writing one in C... although quantifying it is impossible, and that's just one quality.
> I was a professional Java programmer for three years (in a different organization), and I have meant for some time to write up my thoughts about it. I am often very bitter and sarcastic, and I willingly admit that I am relentlessly negative and disagreeable, so it can be hard to tell when I am in earnest about liking something. I once tried to write a complimentary article about Blosxom, which has generated my blog since 2006, and I completely failed; people thought I was being critical, and I had to write a followup article to clarify, and people still thought I was dissing Blosxom. Because this article about Java might be confused with sarcastic criticism, I must state clearly that everything in this article about Java is in earnest, and should be taken at face value. Including:
> I really like Java
> ...
> So yes, I enjoyed programming in Java, and being relieved of the responsibility for producing a quality product. It was pleasant to not have to worry about whether I was doing a good job, or whether I might be writing something hard to understand or to maintain. The code was ridiculously verbose, of course, but that was not my fault. It was all out of my hands.
He says that about Java alone. He very clearly says it doesn't apply to Perl or Haskell.
Also, there is no judgement on the coder, he states that anybody, good or bad, caring or uncaring creates mediocre code on it.
And, well, it fits my experience.
Good overview here: https://advancedweb.hu/new-language-features-since-java-8-to...
And many other changes in the pipeline too..
I feel like they are chasing a aesthetic of conciseness, their perfect little haskell program, not recognizing that regularity and good api design are much more important.
What is beautiful for a 100loc program becomes ugly and wrong for a 100kloc program. Other aspects become much more important.
I'm not a huge fan of go, but it proved there is a necessity for boringness in cooperation.
Boring syntax does not mean the upper limit is mediocrity, saying that is revealing shallowness.
Clever code written in half-a-dozen Cool PL's is like driving for your life in sharply turning mountain roads with no guard-rails - something guaranteed to become cataclysmic as your number of issues/escalations rise and rise, your tech debt becomes an un-surmountable mountain and you watch your hair turn grey before you are middle-aged.
I know of nobody who would call Javascript or C++ boring ;). Or compare COBOL (boring) with Fortran if you prefer something from the past.
But yes, if that's your team, then all code should be written the same way, all on the most boring way possible.
There's a reason Java and C# are so popular.
I agree that code should be written to be "as boring as possible" but even then, it's not clear that a "boring" language helps. What you really want in your scenario is very extensive and up-to-date documentation, both of inter-module boundaries and within individual modules. Java and C# supposedly try to make this easy, but mostly fail. The real reason they're still so popular is that they're easy to "learn" up to some not-even-barely-tolerable standard for the average cheap consultant.
And it may not even be a bad thing, I don't know the overall impact. It does cut a lot of good developers that could be creating great software out of it, but it also opens space for a lot of people that wouldn't add value in a different environment. It also adds a great deal of costs due to the bad software, but it probably increases the amount of problems we can solve with software.
Code being predictable is a huge win, not only with other people but also with your own code from 10months ago.
It also makes change more calculable.
One of the most important modularity boundaries is dependencies on libraries written by others. So a good, easy to use dependency manager and a straight forward mechanism for creating and sharing libraries is crucial.
Java does really well in this regard.
One problem of large codebases is that they tend to be team efforts. Given a a sufficiently large and flexible language, each team member will find their own style and idioms for their code. This creates the subtle problem that team members are unfamiliar with each other's styles and when they touch the same pieces of code, they each extend the subset of used language features by whatever is required for their favorite idioms. Eventually, the resulting code gets too elaborate for its own good and maintainability goes down. A boring, simplified language ideally constrains the team to use more or less the same patterns and idioms and this side-steps the problem.
Do note these are more than a little flaky with many of the Java libs out there ;)
There's a bit of everything, good quality and poor Java code. It's just that there is so much of it out there, that a lot tends to be crud.
Also, you make it sound like Java -- in particular -- has a lot of poor open source libraries. I would say the same for Perl. I wrote it for many years, and I was constantly working around tiny bugs in open source libraries. This isn't a comment on Perl or people who contribute to open source Perl libraries. Rather, this is the reality of using a huge amount open source libraries. About 98 to 99% will be "good enough". Then, you need to hack around the last 1-2% buggy bits.
One thing I have noticed in general (JavaScript, Python, DotNet, Java, C++), in the last 10 years, there has been a dramatic rise in unit tests in open source libraries. Fifteen years ago, you were lucky to have any unit tests. Some of the best libraries now advertise their unit test code coverage on GitHub. It is great progress.
Also agreed, I'm sure other ecosystems share these problems. I know nothing of Perl, but I trust you on that.
We have a tendency to believe that everything we produce needs to be "high quality" but that is a subjective measure. Sometimes we just need to write a program that can be handed off and maintained by the next set of devlopers. For that, java is a useful tool.
Programming languages are just tools. You will have your favorite to use but that doesn't mean it's the one you should be using on most jobs.
#!/bin/bash
cat -
Java has come a long ways since 2014. You can now code in functional style pretty naturally, checked exceptions are fading from use, and tools like lombok have stripped away the worst boilerplate excesses (getters, equals/hashcode impl).This always riles people up, but I'll assert it again: An equivalent modern app that does something useful is shorter in Java than in Ruby or Python, largely because the type system enforces many of the things you would otherwise have to write explicit tests for.
This is pretty trivial in Java, just as in other languages. But most people don't ever need to learn the low level `System` methods needed to do it.
To me, this highlights the difference between a comprehensive approach to learning a language and a more piecemeal one. I learned Java by reading the canonical books from cover to cover, like Effective Java. But I think this is pretty rare. For example, I recall interviewing many experienced Java programmers who didn't know what things like `protected` or `volatile` mean.
In my experience with concurrent code in the business world, it's more common to enforce immutability rather than try to manage state updates. On the RARE occasions to the contrary (e.g. a "tripwire" flag of some kind?), accuracy is more important that maximum performance, so you would use an atomic class or something synchronized.
Really, I think this example more than anything else just shows that technical interviewing is a speed-dating crapshoot. You just have to interview at enough places to find an opportunity you're excited about, and where you happened to not stumble across any interviewer's personal bugaboos that don't match up with you.
I feel the same about robust, easy to maintain enterprise software: Just use a blocking queue (or disrupter circular buffer for speed freaks) and make all messages/requests immutable. It is a trivial concept to explain to new hires and all but guarantees "boring" thread-safe code can be written by junior devs.
I think I finally understood volatile (in a pratical setting) when I read the source code for class CopyOnWriteArrayList. To be honest, the first few times I read it... the pattern made no sense. I thought to myself: "Why use volatile?" After reading many times (and using volatile wrong many times), I finally understood the pattern.
However, using POSIX calls with C (select() and friends), yes, I could imagine a way to do it.
Deeper: Can you write a function to launch an external process then (a) write to its STDIN, (b) read from its STDOUT, (c) read from its STDERR -- all independently and without blocking? It's a hard problem!
From what I’ve seen of Java developers it’s more likely that they see it as an IDE pane that has filtering capabilities built in.
> being relieved of the responsibility for producing a quality product
I've seen this sort of elitism in candidates and I've made the mistake of hiring them. It turns out they're just not very good at all, and they blame their failures on anything but themselves, stunting their self-growth professionally and interpersonally.
If this is a trend for you, you're probably a bad hirer and in a toxic environment!
Reminded me of PG's essay about the "blub" programming language.
But, in this case, I'd like to reverse the use of the concept: it's not that Java is a blub programming language, but that the OP has only reached a blub-state of understanding it and its potential, and produced a blub (generic and derivative) argument against it.
Having programmed in Java for... what, 15+ years? I do agree with him about his assessment. Trying to solve an interview challenge in Java is to handicap yourself, unless it's the only language you know.
So, my assessement wasn't about the OP in general, but the OP as revealed by this particular post.
The post is based on the cliche early/mid-00s J2EE style of coding, that hasn't been in fashion for 15 years, and has been derided widely for at least 12.
There are amazing apps and libs written in Java, and Java as a language was not a problem for their development and design (even when it was far more restricting and ceremonious). Lucene for one. Vert.x. Jetty. XOM, ...
Here is Paul Graham's original essay: http://www.paulgraham.com/avg.html
To quote Wiki (https://en.wikipedia.org/wiki/Paul_Graham_(programmer)): << Graham considers a hypothetical Blub programmer. When the programmer looks down the "power continuum", they consider the lower languages to be less powerful because they miss some feature that a Blub programmer is used to. But when they look up, they fail to realise that they are looking up: they merely see "weird languages" with unnecessary features and assumes they are equivalent in power, but with "other hairy stuff thrown in as well". When Graham considers the point of view of a programmer using a language higher than Blub, he describes that programmer as looking down on Blub and noting its "missing" features from the point of view of the higher language. >>
In my experience, it sounds like a very cool idea, until the first time you see someone programming DirectX using Excel/VBA. (Yes, it can be done.) My point: When you see someone using a "dumb" language (in your humble view), first ask if you are ignoring a Chesterson's Fence! For the avoidance of doubt, no, I am not seriously suggesting it is a good idea to program DirectX using Excel/VBA in 2022.
https://docs.oracle.com/javase/9/docs/api/java/io/InputStrea...
Sure took them long enough.
Well that explains it. For me, I’m not going to touch Java unless I’m being paid to do it. IMO it’s a travesty that Java is the language of the AP test, because it really leaves the impression in young people that all of programming is Java. If that were the case, I’d be as far away from programming and computers as I could get.
Though I prefer Clojure where that's possible.
The only thing about it I personally find very unpleasant is its idiomatic approach to concurrency. In the world of Futures and go routines continuations are such an outlier.
I find it hard to remember more than one company I have interviewed with in the last ten years using Clojure. It was hyped together with Erlang in 2009 or so and nobody remembers either.
Java, in many respects, is the COBOL replacement created in the 90s that will live on in the Enterprise for decades to come. Just as COBOL lives on.
On the other hand, a lack of beginner-friendliness could also be seen as a lack of effective static analysis. Of course, this is a very Java programmer point-of-view.
Others: "you shouldn't need to have that"
Java programmers: "but I do have that"
If you are in a position to pick tools for your organisation, think about how your choices would accommodate beginners. Not all of your tools can be or should be easy for beginners to use, but it is an important quality to consider.
Slightly confusing comment to me ... Java has on the one hand a relatively simplistic static typing system but on the other hand some of the best static analysis support that you can find (I don't think it's a coincidence; the relatively simple type system and lack of ways to hack around it facilitates the strength of the analysis that can be done).
I'm talking about things like, add a parameter to a method in a library and eclipse automatically not only deterministically renames it everywhere that its called in the library but in every dependent project, all in milliseconds. And a dozen other similar types of operations.
Without static analysis tools like error-prone, findbugs, nullaway, checker framework, sonar, PMD, IDE-provided analysers, et cetera, it is easy to write problematic Java.
On the other hand, the Java ecosystem has an abundance of such tools available and almost everybody is using them. (Hence, "but I do have that")
Speaking of beginners, I'd venture to say that Java has the largest library by now. From Core Java to Java Concurrency in Practice, pretty much everything was well described years ago. The same is true about Design Patterns/Refactoring/DDD-related literature which was originally popularized mostly in the Java world.
I actually agree that JVM-like platforms should not be used for teaching beginners. Something like Python (or TypeScript?) is probably appropriate for high school usage. In my time it was Borland Pascal which was a nice first real language and a great IDE. All on a single floppy disk :))) I
System.out << System.inGoogle's Guava
JCTools
For highly specialised containers, try: (1) https://labs.carrotsearch.com/hppc.html, (2) https://github.com/OpenHFT/Chronicle-Queue, and (3) https://github.com/LMAX-Exchange/disruptor
Since not being a pro at it and not planning to be, I'd rather toy with other things. The job market is diverse in its technical needs. :)
What do I win?
System.in.transferTo(System.out);>9
Cool. I didn't know about that one. I also learned about the new system logger since log4shell happened. I should make a project to see how much I can do with just the Java standard library in 17. Maybe I don't need any dependencies.
Too much OOP forced upon you. Too much boilerplate. Too much verbosity.