Live data from Hacker News

Why I Like Java (2014)

blog.plover.com

71–80 of 152 posts

Re: Why I Like Java (2014)

#71
Java has a high bar for the amount of prerequisite experience it takes to write good code. In other words, it has too many pitfalls for beginners. It is a phenomenally poor choice of language for teaching beginners to code.

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.

Re: Why I Like Java (2014)

#72
Anytime I learn a new language (I regularly write code in several) I start asking how is testing done, where are the libraries, where is this, and how do I do that? I already have all of that and more at my fingertips. Also, Groovy is vastly underrated. It’s the most economical and easiest to understand language I know meaning I can do more with less code and faster in general.

Re: Why I Like Java (2014)

#73
post #2

> write a program that copies standard input to standard output 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.…

"protected" should be obvious, if you've worked on any non-trivial Java codebase. However, I've been working with Java for over 20 years now, and don't think I have ever actually used "volatile" once. The only reason I know anything about it is because I read "Java Concurrency in Practice" once upon a time, and have a really good memory. In my experience with concurrent code in the business world, it's more common to…

In my career, I have used volatile incorrectly many more times than I have used it correctly. :) For readers who are not deeply familiar with Java's volatile keyword, you can read more about it here: https://stackoverflow.com/questions/13688697/is-a-write-to-a...

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.

Re: Why I Like Java (2014)

#74
post #26
post #2

> write a program that copies standard input to standard output 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.…

It is rather non-trivial to write a program to copy input to output if one requires proper handling of a termination signal when the code flushes the already read data without waiting for more and exits without loosing any buffered data. Knowing how to do that is a good sign that the person really knows the language and it’s libraries.

Can this be done with vanilla Java? If yes, can you share a snip of code? I would curious to learn! Using POSIX C, I think I know the solution.

Re: Why I Like Java (2014)

#75

These sort of posts crack me up as it's another person jumping on a bandwagon they don't understand, but are also really sad, as it's taking a lot of otherwise talented people and ruining them. > 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…

> 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!

Re: Why I Like Java (2014)

#76
post #7

tangent: what are some modern java OSS codebases that you would recommend to read?

Caffeine caching Google's Guava JCTools

Nothing taught me as much about API design and testing as Google's Guava. I know there are lots of minor gripes with that library, but is it so incredibly consistent. It is also amazing that no one mentioned the Java Collections (ArrayList, LinkedList, HashSet, HashMap, TreeSet, TreeMap). They are some of the highest quality generic collections that exist anywhere. (For C++, I would say the same about an STL implementation by a high quality project like VCC/GCC/Clang.) For "Java high honors", try to understand how concurrent collections work, e.g., ConcurrentHashMap!

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

Re: Why I Like Java (2014)

#77

Java has a high bar for the amount of prerequisite experience it takes to write good code. In other words, it has too many pitfalls for beginners. It is a phenomenally poor choice of language for teaching beginners to code. 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 t…

I'm curious what these pitfalls are that you're referring to. Can you elaborate? It's been a long time since I was new to Java, and this sort of outside perspective is always a good thing.

Re: Why I Like Java (2014)

#79
post #25

Earlier quoted context omitted.

People say this but where do you find libs for Java? Python has pip, JS/Node has NPM

> JS/Node has NPM 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!

IMO maven is much better than gradle these days. Indeed maven or go dependency management is refreshing after you run create-react-app or shit like that.

Re: Why I Like Java (2014)

#80
post #13

If the infamous HN Dropbox comment didn't exist, this post would serve well as the canonical "facile dismissal". 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…

If people are unfamiliar with the "blub" programming language, you can read more here: https://wiki.c2.com/?BlubParadox Here is Paul Graham's original essay: http://www.paulgraham.com/avg.html To quote Wiki ( https://en.wikipedia.org/wiki/Paul_Graham_(programmer) ): > 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…

The mistake is thinking that blub paradox is one dimensional.
Post reply on HN