Hacker News new | ask | show | jobs
by NovaX 1771 days ago
> In Java it would be a nest of SortComparator interfaces and SortAlgorithm implementors, which would act to hide the algorithm itself.

That is odd because when I look at the Java style, DualPivotQuicksort [1], it seems that the language authors did not do that. This is so very strange! Their methods are long, complex, and highly documented. Maybe they must be really incompetent Java programmers? I mean, they did put this obtuse abstraction by hiding it in Arrays. That's super crazy, just look at this monstrosity!!!

    public static void sort(int[] a) {
      DualPivotQuicksort.sort(a, 0, 0, a.length);
    }
Maybe you need to have an intervention with them? Somehow, in some crazy world, even Java programmers are capable of writing good and efficient code. Its like bad developers might do an awful in job in whatever language they used? Can't be true...

[1] https://github.com/openjdk/jdk/blob/master/src/java.base/sha...

1 comments

The "enterprise" programming culture which has emerged around Java doesn't impinge on all java code. But it is still a real thing. The fact that openjdk authors can rise above it and write clean, reusable Java code is obviously good. The fact that there is something that needs to be risen above is unfortunate.

I think the same about Javascript, though the specifics are different. I've been writing JS for years, but I've been moving away from it lately because increasingly I feel like an odd duck in the JS world. Most javascript programmers have much less experience (in any language) than I do. When I mention I write a lot of javascript professionally, people assume I'm an fresh faced bootcamp grad. Its sometimes hard to find high quality libraries on npm because the average quality there is reasonably low. Eg good luck finding a password generator which doesn't use Math.random(). Or finding an email parsing library which preserves the order of email headers. (This has semantic content!)

Does there exist high quality java + javascript code? Sure. But even macdonalds makes good food sometimes. That isn't enough to make me a regular customer.

Sometimes the right call is to fight for the ecosystem you're a part of and help it improve. I've done a lot of that. But you don't have to fight for high quality software if you just go where the high quality software is being made. Its easier to switch languages than change a culture.

... I'm being a bit sloppy and judgemental here. Maybe it would be better to say, each ecosystem has a set of values. Javascript values programming velocity, accessibility to new programmers and simplicity. Java has a different list. Insomuch as you're living inside an ecosystem, you don't get to simply ignore and dismiss those influences when you don't like them. It sucks writing Go if you hate gofmt. It sucks writing rust if you don't even want the borrow checker. And it sucks writing Java if you hate dealing with AbstractIteratorFactoryImpl. Even if there's some redeeming code in openjdk.

The "enterprise" programming culture did not emerge around Java.

It was already been there regardless of the language.

I am old enough to have done Enterprise C, Enterprise C++, Enterprise VB, Enterprise Delphi, Enterprise xBase, ...

I've seen and worked with enterprise golang code. Ugh.
A language's core values is not determined by a small, vocal, subculture of its ecosystem. In Java's case, it was set early on to be a "blue collar" language [1]. If programmers fail to follow the spirit of the language then it will be awkward.

"So, how does Java feel? Java feels playful and flexible. You can build things with it that are themselves flexible. Java feels deterministic. You feel like it’s going to do what you ask it to do. It feels fairly nonthreatening in that you can just try something and you’ll quickly get an error message if it’s crazy. It feels pretty rich. We tried hard to have a fairly large class library straight out of the box. By and large, it feels like you can just sit down and write code."

Please do not push the programming community towards a tribal, us vs them, hostile environment where one belittles their neighbor. We can have interesting, fun, insightful technical debates! There's no reason to devolve into bigotry to "win" an argument, it's a lot more fun to learn from each other and do cool, new things.

[1] https://www.win.tue.nl/~evink/education/avp/pdf/feel-of-java...

I don’t see it as winning and losing. I see it as deciding where to stand and where to contribute in my technical life. How do you personally trade off velocity (code fast) vs correctness, completeness or performance? Javascript generally values velocity over generalisability. (“It’s better to implement something quickly and worry about adapting it to other problems later”) compared to most Java code. It’s not necessarily better and worse. It’s a question of fittedness with your own values and the values of your project.

If you consistently write code which fights the ecosystem your code is written inside of, it’s quite painful. Writing Lua without ever blocking is hard. Writing javascript with large, deep class hierarchies is awkward. I’ve seen people write pure functional Java, but if that’s what you’re into you should probably consider just using a different language.

And to name it, Java does not feel playful and flexible to me. Not compared to ruby, Haskell, python and javascript.

> Java feels playful and flexible.

Insane that anyone could say this with a straight face

>Javascript values programming velocity, accessibility to new programmers and simplicity.

You are joking aren't you?

No, I'm not. Or at least, not as I see it.

How would you describe javascript's values, compared to other languages? This is a great chart / explanation of this kind of thinking from Bryan Cantrill:

https://www.youtube.com/watch?v=2wZ1pCpJUIM

No integers. What's the difference between == and ===. Why do I need to learn two ways to declare a class. What module system should I use and why are they all different. Why isn't there much of a standard library. WTF is Grunt, NPM, etc. Just explain 'this' to me again. What is the distinction between null and undefined. What is the difference between for/of and for/in.

JavaScript is far from accessible to new users neither is it simple.

You're arguing that javascript doesn't succeed at being accessible to new programmers. I'm not arguing that. I'm saying that javascript nominally values about being accessible to new programmers. There are way more novice programmers using javascript than (almost?) any other language. This isn't an accident.
>This isn't an accident.

No, it's because it's effectively the only option in the browser. If you are going to write front end code then you will end up writing JavaScript in some form or another.

And being popular doesn't necessarily mean it is accessible nor simple. If it had been I doubt we would have seen Python becoming the dominant language in education.

I agree with most of your points. But the distinction between null and undefined is an important one. Its absence is a legitimate complaint about SQL.