←back to thread

174 points chhum | 7 comments | | HN request time: 0.001s | source | bottom
1. izacus ◴[] No.44006382[source]
Because there was nothing else quite like it at the time most enterprise software was created or recreated.

And it's still stable, fast and reliable with a massive ecosystem of stable, fast and reliable libraries and software. With good developer tooling, profilers and debuggers to go with it. And big enterprise support teams from RedHat, Oracle, IBM, etc. throwing in their (paid) support services.

It might not be the best language in any of the categories (speed - runtime and compile time, tooling, ecosystem, portability, employee pool), but there's pretty much almost no languages that are as good in all categories at once.

And to top it off, JVM can host other languages so it can easily interoperate with more modern takes on language design like Kotlin while still running on pretty much all major operating systems used in the wild and most CPU architectures as well. It'll run on your car's SoC, your phone and on your server. In many cases, using the same libraries and same code underneath.

replies(1): >>44006505 #
2. js8 ◴[] No.44006505[source]
I believe there were alternatives at the time, but expensive. Java was free and also syntactically compatible with C++. I think that rather these properties (than being somewhat unique) are the main causes of its success.
replies(1): >>44009526 #
3. zabzonk ◴[] No.44009526[source]
> syntactically compatible with C++

Not. And certainly not semantically.

replies(1): >>44011012 #
4. Pet_Ant ◴[] No.44011012{3}[source]
That’s just obtuse. Compare Lisp, Forth, APL, Prolog, Ada, or Fortran. Java is just C++ with a few twists. You can literally write code that will compile in both.
replies(2): >>44011871 #>>44011990 #
5. js8 ◴[] No.44011871{4}[source]
That's exactly how I meant it. Another alternative to Java at the time was Smalltalk, with different syntax. Choosing C++ syntax for Java was clearly a marketing move (as it was for C++) - we shouldn't underestimate network effect of familiar syntax.

I think Java succeeded for the same reasons C++ succeeded - built on familiar syntax, reasonably free and "supported by" a large company. Java being a decent language is a consequence of its success more than of its original design.

6. zabzonk ◴[] No.44011990{4}[source]
> You can literally write code that will compile in both.

An example, please.

replies(1): >>44012039 #
7. Pet_Ant ◴[] No.44012039{5}[source]
int fibonacci(int n) {

    if (n <= 0) return 0;

    if (n == 1) return 1;

    int a = 0, b = 1, temp;
    for (int i = 2; i <= n; i++) {
        temp = a + b;
        a = b;
        b = temp;
    }
    return b;
}

...if only the return type was "Crow" then you could .eat() that...