Live data from Hacker News

Why I Like Java (2014)

blog.plover.com

81–90 of 152 posts

Re: Why I Like Java (2014)

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

OK, so I'm trying out maven central as people in this thread are recommending. As an example, I'm searching for a command line argument parser.

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.

Re: Why I Like Java (2014)

#82

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.

Maybe GP is talking about type erasure, or considering the mention of teaching, it might be something more obvious like reference type vs value type distinction, strings cannot be compared using ==, etc..

Re: Why I Like Java (2014)

#83
post #11

You can write a pretty trivial Java program to copy stdin to stdout but Java is still one of the enterprise languages and people writing enterprise applications don't tend to write this type of software (but they do tend to have log4j vulnerabilities). The strengths of Java are its mature dependency management system(s), its comprehensive standard library and the vast ecosystem of third-party libraries. A better test…

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

Err ... the npm authors (the CommonJS modules/packages spec writers for package.json) mention maven and CPAN in their design docs and discussions as reference. Many of the early Server-side JavaScript adopters (in the 2000's before Node.js but well after Netscape's server-side JavaScript) were, in fact, Java/J2EE dropouts longing for something simpler.

[1]: http://wiki.commonjs.org/wiki/Packages/1.0

Re: Why I Like Java (2014)

#84
post #63

Earlier quoted context omitted.

Well, the counterpoint is that you shouldn't have a team composed of rotating consultants. And if you have one, you can't expect it to deliver anything with any quality or productivity. 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.

This is the modus operanti from all Fortune 500 whose main business isn't shipping software, for them IT is a cost center.

As I said, there's a reason Java and C# are so popular.

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.

Re: Why I Like Java (2014)

#85
post #66
post #31

Earlier quoted context omitted.

The author makes it really hard to judge his tone, but I don't think you're reading it right. For example, if you peruse his other articles, it's clear he really likes Haskell (he certainly doesn't consider it evil). 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 lang…

I thought he summed up the tone pretty well earlier in the article: > 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 ineffici…

How do you measure "mediocre"? And what do you mean by inefficient? In any language you can code 99% of the things needed by 99% of most of the systems. Most of the "I love/hate this language" is usually subjective perception or strong preference for certain programming paradigms: people loving/hating OOP, people love/hating verbosity and so forth.

Re: Why I Like Java (2014)

#86

Java: plentiful well paying jobs, good/great tools, good/great runtime. Personally, I like boring, predictable, "easy" (referring to low cognitive overhead of statically typed languages in general) for work, and save the fun stuff (lisp/scheme in my case) for personal projects.

This is how I feel about C# and .Net - they are relatively easy to hold in your head, the tools are excellent for the language, and there are plenty of decent paying jobs.

Re: Why I Like Java (2014)

#87
I feel like people get what makes for the best programming language wrong in the same way they get the "fittest" wrong with darwinian selection of "survival of the fittest". It's not necessarily the prettiest (although that can help) or the fastest, or some subjective assessment of the best. It's what survives. Sometimes that's a stallion, other times it's a dung beetle but both are the best at what they do and if you put it in the wrong environment they die. Java's just doing what it does and it has survived where others have died.

Re: Why I Like Java (2014)

#88
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.

Wouldn't just wrapping System.in with the Scanner class handle this?

Re: Why I Like Java (2014)

#89
post #26

Earlier quoted context omitted.

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.

You need to register an event handler with `Runtime.getRuntime().addShutdownHook()`.

Re: Why I Like Java (2014)

#90
post #21

Earlier quoted context omitted.

The point being that at scale all code should be written the same way, in an environment where most teams are composed of rotating consultants.

Well, the counterpoint is that you shouldn't have a team composed of rotating consultants. And if you have one, you can't expect it to deliver anything with any quality or productivity. 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.

> But yes, if that's your team, then all code should be written the same way, all on the most boring way possible.

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.

Post reply on HN