Announcement

Collapse
No announcement yet.

OpenJDK Java 20 Released With Latest Vector API, Scoped Values

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #11
    Originally posted by caligula View Post

    Basically everyone uses JS and TS these days. Instead of GUIs we have web. Launch speed matters. That's why Python interpreter is a lot faster than Java jit.
    Everybody uses JS and TS because everybody now does programming. Most of those people don't actually know what they're doing. At best they followed a tutorial on YT and started typing something.

    Jit nowadays has a good startup time (an "hello world" in java just executes in 0.03 seconds against 0.01 of the python version).

    Meanwhile, Java is 2 orders of magniutudo faster during the program lifetime than python.
    Speed matters, yes.

    Comment


    • #12
      Originally posted by bug77 View Post

      I've been with Java since the beginning and there's no denying it's falling behind on every front. Language features? Kotlin and Scala are ahead and that's just JVM languages. Speed of development? It's all-out OOP, thus not good fit for a lot of projects. Code speed? It needs AOT yesterday, yet native image is still marked as experimental. Fit for cloud or IoT? It's got a huuuge runtime, so no.
      In spite of all that, it's rather easy to learn and it has a huge ecosystem built around it, so it's not going anywhere anytime soon.
      1. What features does Kotlin have that java don't?
      2. Scala has a completely different programming paradigm: comparing features between Scala and Java is meaningless.
      3. Speed of development was never mentioned before.
      4. The size of the runtime was never mentioned before.

      basically what remains and what we agree on is that Java is: "easy-to-use, comprehensible, robust, and performant"

      Comment


      • #13
        Originally posted by bachchain View Post

        Try again. I've been using Java for over ten years at this point. It's both my first and most experienced language. What about you?
        I've been using is since its first release in mid 90s.

        Comment


        • #14
          Originally posted by bug77 View Post

          I've been with Java since the beginning and there's no denying it's falling behind on every front. Language features? Kotlin and Scala are ahead and that's just JVM languages. Speed of development? It's all-out OOP, thus not good fit for a lot of projects. Code speed? It needs AOT yesterday, yet native image is still marked as experimental. Fit for cloud or IoT? It's got a huuuge runtime, so no.
          In spite of all that, it's rather easy to learn and it has a huge ecosystem built around it, so it's not going anywhere anytime soon.
          You mention Kotlin and Scala in the language features, but fail to mention that they build on top of the JRE, so they have even bigger runtime footprints.
          Runtime size can be reduced by using jlink to reduce it to only the modules your application needs.
          Code speed: Java's Hotspot C2 runs circles around most other runtimes (Python, Ruby, ...)
          Startup speed: a JVM Quarkus microservice starts in less than 1 second.

          Comment


          • #15
            The ga tag hasn't been added yet https://github.com/openjdk/jdk20u/tags

            Comment


            • #16
              Originally posted by nadirx View Post
              Startup speed: a JVM Quarkus microservice starts in less than 1 second.
              Isn't that... pretty bad? 1 second in the computer world is pretty damn close to an eternity.

              I haven't had the chance to use Java extensively, but from my limited academic experience, I found it pretty bad. Maybe it was the way I was taught, but I can't imagine working with it in the long term. It's possible to see it as: the best of both worlds (faster than most language and harder to shoot yourself in the foot compared to C++ with rich librairies), but I see it pretty much as the worst of both worlds.

              I don't always want speed in my programs, but when I do, I need every last drop of it. When I don't care about it, I might as well use some Python to ease development and reduce headaches.

              From my understanding the JVM is pretty rad, but the language itself makes me shiver.

              Oh well, everyone uses whichever language they prefer...

              Comment


              • #17
                Originally posted by kvuj View Post
                Isn't that... pretty bad? 1 second in the computer world is pretty damn close to an eternity.
                It depends: that may be bad for a lambda in a serverless environment, but for a process which will stay around for a while serving many thousand requests per second, that is irrelevant.

                Comment


                • #18
                  Originally posted by cynic View Post

                  1. What features does Kotlin have that java don't?
                  2. Scala has a completely different programming paradigm: comparing features between Scala and Java is meaningless.
                  3. Speed of development was never mentioned before.
                  4. The size of the runtime was never mentioned before.

                  basically what remains and what we agree on is that Java is: "easy-to-use, comprehensible, robust, and performant"
                  I agree with you but I'll make a go at the first two on the list.

                  1) Class Extentions still aren't in the Java language that mask static utilities in the IDE. Gosu does it better than Kotlin but Kotlin is ok.
                  • You can get this in a library for Java called Manifold (developed by the Gosu JVM language creators)
                  • So yeah, Java in 2023 has or has access to most of the things that made Kotlin on the JVM.

                  2) You could say that Union types aren't easy on Java without some help. There are reasons to run Union types in valilla Java. Any data structure that can represent "that OR that OR that OR (this AND that) OR..." is powerfull. I think this is the killer feature of Haskell and F# for domain driven design. You model the data types in code that any non-techie can read (in F#) and understand and lower the surface area of defects at the same time.
                  • You can easily implement an Either data structure in Java for a basic this OR that
                  • However, Currying is messy in Java using interfaces.
                  • You can get a lot of mileage out of a library like Vavr.io

                  Originally posted by kvuj View Post
                  Isn't that... pretty bad? 1 second in the computer world is pretty damn close to an eternity.
                  Not that the example given was a rule at all... but it all depends on what type of assurances you need
                  in your computing environment.

                  Originally posted by kvuj View Post
                  I haven't had the chance to use Java extensively, but from my limited academic experience, I found it pretty bad. Maybe it was the way I was taught, but I can't imagine working with it in the long term. It's possible to see it as: the best of both worlds (faster than most language and harder to shoot yourself in the foot compared to C++ with rich librairies), but I see it pretty much as the worst of both worlds.
                  Yes, it is your limited experience.

                  Originally posted by kvuj View Post
                  I don't always want speed in my programs, but when I do, I need every last drop of it. When I don't care about it, I might as well use some Python to ease development and reduce headaches.
                  I don't think this is the argument you are looking for. This is a debunked myth. Java is really fast when you need it to be. It may take extra deployment steps to get there, or tuning, but it gets there. The JVM is not slow and the language used to generate bytecode doesn't make it slow. There are Java tools to make startup dang near instant and their are tools to make the JVM perform the same consistently as it is running over extended periods of time. It is a matter of the developer choosing them, using them and the end user providing the target environment.

                  Originally posted by kvuj View Post
                  From my understanding the JVM is pretty rad, but the language itself makes me shiver.

                  Oh well, everyone uses whichever language they prefer...
                  I feel that you don't really understand the Java language enough. I find that Java syntax pretty damn good. There are points of contention I have with it, like checked Exceptions, but you just figure out a way around it that follows good data structure flow then you can live a happy life.

                  For instance, you can implement an Either object. You can use Vavr.io or you can write it yourself. It is a data structure from Haskell and Scala and their ilk that is easily transferable to Java.

                  instead of:

                  PHP Code:
                  try {
                  ...
                  } catch(
                  Exception e) {

                  You hide that detail in your method and expose the Exception as data, so it doesn't become a glut of GOTO statements.

                  PHP Code:
                  public Try<AnyExceptionMyExpectedResulttryGetResult(String arg) {
                      try {
                          var 
                  result someMethodThatThrowsCheckedException(arg);
                          return Try.
                  success(new MyExpectedResult(r));
                      } catch(
                  Exception e) {
                          return Try.
                  failure(new AnyException(e));
                      }

                  Then in your callsite code you'd do:

                  PHP Code:
                  var tryGetResult tryGetResult("123");
                  if (
                  tryGetResult.isSuccess()) {
                      
                  //happy path
                  } else {
                      
                  //unhappy path
                      
                  Logger.error(tryGetResult.getFailure().getMessage( ), tryGetResult.getFailure().getCause());

                  This last block doesn't really look like traditional Java code right? But it is if tryGetResult is a local variable.

                  Try in this case is a very specific variant of an Either object. Either is just a data structure that takes a 2 value tuple that puts some convention around it.

                  There are a few issues with doing it like this but they are mostly muscle memory stuff you should becatching in Unit tests anyways.

                  Would this make a Java developer who targets Java 6 in 2023 pass a kidney stone? Probably. But it may just re-invigorate them about programming and get them out of a boilerplate rut.

                  Does it suck that it has type-erasure... sure. But does that stop me from writing good, clean, performant code?

                  I am not trying to make the case why Java is better. You do you. If you someone likes Python or C# more power to you. They are all fine to use. Pick your favorite IDE or use Emacs, it doesn't matter to me.

                  But Java is in a pretty darn good state in 2023 language wise and platform wise.‚Äč

                  Comment


                  • #19
                    Originally posted by cynic View Post
                    1. What features does Kotlin have that java don't?
                    Coroutines, string templates, null safety, just to name a few.

                    Originally posted by cynic View Post
                    2. Scala has a completely different programming paradigm: comparing features between Scala and Java is meaningless.
                    It's not completely different, but even so, I fail to see why I shouldn't compare them. When I pick a tool for a job, I pick from all available tools, not just a particular set.

                    Originally posted by cynic View Post
                    3. Speed of development was never mentioned before.
                    4. The size of the runtime was never mentioned before.
                    So, if it wasn't mentioned, it doesn't count. I don't know how to respond to that.

                    Originally posted by cynic View Post
                    basically what remains and what we agree on is that Java is: "easy-to-use, comprehensible, robust, and performant"
                    I have my doubts about "robust", but hey, it carried us for over two decades so there's that. Performant... I couldn't name another language that's not interpreted that's slower than Java.

                    Comment


                    • #20
                      Originally posted by nadirx View Post
                      You mention Kotlin and Scala in the language features, but fail to mention that they build on top of the JRE, so they have even bigger runtime footprints.
                      That is a fair observation, but I was just mentioning the language itself is ahead on features.

                      Originally posted by nadirx View Post
                      Runtime size can be reduced by using jlink to reduce it to only the modules your application needs.
                      It can, but do you know many project that do that? Tooling around jlink is a pain. Many widespread libraries haven't been migrated to Java 16+, so you have to keep feeding it information about which packages to expose and things like that. Granted, that's not exactly Java's fault, but it is one aspect where its huge ecosystem is working against it.

                      Originally posted by nadirx View Post
                      Code speed: Java's Hotspot C2 runs circles around most other runtimes (Python, Ruby, ...)
                      See my point above: only interpreted languages are slower than Java. Also Cythin is way more mature than native image.

                      Originally posted by nadirx View Post
                      Startup speed: a JVM Quarkus microservice starts in less than 1 second.
                      It does, but it still doesn't make Java a good fit for lambdas (AWS) for example. Those need to run as fast as possible (charging per 100ms iirc) and then stop. Rinse and repeat. Java is the exact opposite of that: it needs to run for a while so the JIT can work its magic, before offering good performance. There's CDS to help with that, but that's another thing virtually nobody uses.

                      Comment

                      Working...
                      X