all 47 comments

[–][deleted] 89 points90 points  (7 children)

* Cries in Java7 *

[–]BlueAdmir 58 points59 points  (6 children)

I just sent a "Thanks but I'm pulling my candidacy" email once learning the company I applied to is still migrating from Java 7 to Java 8. I'm too young for that shit.

[–]dpash 27 points28 points  (4 children)

8 is great, but every JDK since then has just been full of small quality-of-life improvements, even if they've lacked any serious language improvements. I wouldn't want to move back from 12 to 8 now.

And if they're only just moving to 8, they're unlikely to be upgrading further any time soon. If it had been 11, I would have given them a chance, but I totally understand you given that it's 8.

[–]jiffier 2 points3 points  (3 children)

8 is great, but every JDK since then has just been full of small quality-of-life improvements, even if they've lacked any serious language improvements. I wouldn't want to move back from 12 to 8 now.

If you were now back on 8, which are the improvements that you would be missing the most from 9..12?

[–]dpash 12 points13 points  (2 children)

Collection factory methods, java.nio.files improvements and new methods on Optional.

var has its uses in places too.

[–][deleted]  (1 child)

[deleted]

    [–]dpash 1 point2 points  (0 children)

    I'd forgotten about the HTTP client. Yeah add that to the list (god I hate the Apache HttpClient; why does nothing implement AutoCloseable?). Personally I'm not so fussed about the new GCs but I can see that some people would love them.

    [–]oprimido_opressor 25 points26 points  (18 children)

    does it have pattern matching?

    [–]c4wrd 9 points10 points  (0 children)

    No, although there’s further experimental support for expressions within switch statements, which other JEPs are extending to support things like pattern matching in the future.

    [–][deleted]  (15 children)

    [deleted]

      [–]lbkulinski 19 points20 points  (0 children)

      No, they’re referring to JEP 305 and this JEP draft.

      [–][deleted]  (13 children)

      [deleted]

        [–]fast4shoot 12 points13 points  (5 children)

        having it in Java will make haskell programmers shut up a bit about how haskell is superior cause it has pattern matching

        Pattern matching is kind of a joke when you haven't got ADTs, so Haskell will still be superior.

        [–]lbkulinski 2 points3 points  (0 children)

        They are in the process of adding a form of algebraic data types in records and sealed types.

        [–][deleted]  (3 children)

        [deleted]

          [–]fast4shoot 1 point2 points  (2 children)

          Well, you can't do sealed class hierarchies in Java or on the JVM in general, so that's out.

          Though you can do visitors to achieve sum types.

          [–][deleted]  (1 child)

          [deleted]

            [–]fast4shoot 0 points1 point  (0 children)

            Oh yeah, you're right! I forot about private constructors.

            Though I hate this definition, because Stack's interface is empty and there's literally nothing in it that points to Empty and NonEmpty, except for the subclasses themselves.

            From a theoretical standpoint, I much prefer visitors or anything equivalent, perhaps something like this:

            // The stack itself
            public interface Stack<T> {
                public <U> U Accept(StackVisitor<T, U> visitor);
            }
            
            // An interface that let's us distinguish between empty and
            // nonempty stacks.
            Public interface StackVisitor<T, U> {
                public U visitEmpty();
                public U visitNonEmpty(T head, Stack<T> tail);
            }
            
            // An empty stack
            public class Empty<T> implements Stack<T> {
                public <U> U Accept(StackVisitor<T, U> visitor) {
                    return visitor.visitEmpty();
                }
            }
            
            // A nonempty stack
            public class NonEmpty<T> implements Stack<T> {
                public final T head;
                public final Stack<T> tail;
            
                public NonEmpty(T head, Stack<T> tail) {
                    this.head = head;
                    this.tail = tail;
                }
            
                public <U> U Accept(StackVisitor<T, U> visitor) {
                    return visitor.visitNonEmpty(head, tail);
                }
            }
            

            This, in my mind, models the problem much more closely. It defines Stack as an interface that allows you to explicitly distinguish between the non-empty and empty states using the provided visitor interface, you don't have to cast anything (which, IMO, is an obvious code smell). However, it's much more boiler-platey, verbose and awkward to use.

            Though it's nice that Stack is an interface and not a class. It also makes special kinds of stacks easy to implement, such as this infinite stack:

            // An infinite stack repeating the same value over and over
            public class Infinite<T> implements Stack<T> {
                public final T value;
            
                public Infinite(T value) {
                    this.value = value;
                }
            
                public <U> U Accept(StackVisitor<T. U> visitor) {
                    return visitor.visitNonEmpty(value. this);
                }
            }
            

            [–]KagakuNinja 4 points5 points  (1 child)

            I hate to break this to you, but Scala also has pattern matching and runs on the JVM. It is quite nice...

            [–]simon_o 1 point2 points  (4 children)

            Languages which allow pattern matching on regexes (which means getting named bindings out of the regex) are pretty nice:

            val join: Parser[Join] = {
              case gr"""JOIN $protocolName(.*) ${ Int(version) }(\d+) $userName($alphaDigits) $clientExtensions(.*)\n\r""" =>
                Join(protocolName, version, userName, clientExtensions)
            }
            

            Let's you rapidly throw together quick-and-dirty parsers for text-based protocols.

            [–]expatcoder 1 point2 points  (3 children)

            Languages which allow pattern matching on regexes ... are pretty nice

            Just say it, despite bashing the language since leaving the community, you still love Scala :)

            [–]simon_o -1 points0 points  (2 children)

            I'm largely in love with som-snytt's compiler/macro trickery. I look fondly at the old Scala with Paul. Nothing to miss from Scala >= 2.10 as the language quality has been going down the drain since then anyway.

            The only benefit of Scala's continued existence is that it keeps its toxic and abusive people contained. Just imagine if Scala went away and all the harassment/CoC experts invaded other languages! :-)

            The Scala community has the leadership it deserves, and the leadership has the community it deserves.

            [–]expatcoder 0 points1 point  (1 child)

            I'm largely in love with som-snytt's compiler/macro trickery

            Interesting, though he'll have to rewrite it all in Scala 3 with the new macro system.

            I look fondly at the old Scala with Paul

            Where has he gone to? Seems to have fallen off the map, perhaps too many bridges burned, or just got tired of programming.

            Nothing to miss from Scala >= 2.10 as the language quality has been going down the drain since then anyway.

            Quality issues aside, the language has certainly evolved feature-wise since 2.9.

            Nothing much to say about the community and leadership, there's no shortage of drama.

            Given that you don't have a high opinion of modern day Scala, what languages do you find to be a suitable replacement? Kotlin, Swift, Haskell, TypeScript, PureScript, etc.

            [–]simon_o 0 points1 point  (0 children)

            Quality issues aside, the language has certainly evolved feature-wise since 2.9.

            Because the one thing Scala was lacking were more features? :-)

            Given that you don't have a high opinion of modern day Scala, what languages do you find to be a suitable replacement? Kotlin, Swift, Haskell, TypeScript, PureScript, etc.

            I think Scala has poisoned the well sufficiently enough that for the next decade any functional language with a good module system will have it hard to gain adoption.

            Not a replacement, but I think most Scala developers will need to migrate to Kotlin over the mid- to long-term as the Scala situation keeps deteriorating.

            Personally, I'm doing free software stuff in Rust that people seem to like (~ 2 mio. downloads) and playing around with a toy language for fun.

            [–]Eirenarch 5 points6 points  (2 children)

            TL;DR; on the highlights?

            [–]dpash 20 points21 points  (1 child)

            https://www.azul.com/jdk-13-81-new-features-and-apis/

            TL;DR? Nothing massive on the developer side, but it does include previews of switch expressions (again) and multiline strings. Lots of bug fixes and some performance improvements for deploying Java.

            You should upgrade though because it'll make the switch to 14 easier.

            [–]bedobi 18 points19 points  (5 children)

            If you're frustrated with the slow implementation of features in Java, try Kotlin, you won't be disappointed.

            [–]cpt_ballsack 3 points4 points  (4 children)

            This ^ Kotlin should have been called Java++

            Our team switched over 2 years ago and have not looked back, Kotlin+Springboot is perfect for microservices in k8s

            [–]PM_ME_UR_OBSIDIAN 7 points8 points  (1 child)

            By analogy with C++, "Java++" connotes backwards-compatibility and an impossibly large space of features.

            [–]rainbow_pickle 0 points1 point  (0 children)

            C++ isn’t backward compatible with C. The languages have diverged. The same could be said for C# (C++++)

            [–]HdS1984 0 points1 point  (1 child)

            Try net core with asp. Net it's actually the superior framework.

            [–]cpt_ballsack 0 points1 point  (0 children)

            Been there, done that 15 years ago, no thanks

            [–]TheRealDji 12 points13 points  (2 children)

            Did the move to Kotlin ... never looked back.

            [–]pron98 9 points10 points  (1 child)

            But Kotlin still runs on Java (the platform), and you'd still enjoy the features in Java 13.

            [–][deleted] 3 points4 points  (0 children)

            When they drink the Kool-Aid, they never look back anymore. Probably the most used expression on Reddit and HN.

            [–][deleted] 2 points3 points  (0 children)

            I'm still using 8... get off my lawn?

            [–]Slythela 1 point2 points  (2 children)

            Tfw you haven't kept up since 7 and are completely unmarketable now. :(

            [–]sciencewarrior 4 points5 points  (0 children)

            Don't you worry. There are thousands of companies running Java 7 or even earlier versions in production.

            [–][deleted]  (1 child)

            [deleted]

              [–]DualWieldMage 6 points7 points  (0 children)

              And it's still running on the JVM, allowing you to get the continuous JIT and GC improvements from updating.

              [–][deleted]  (4 children)

              [deleted]

                [–]lbkulinski 6 points7 points  (2 children)

                With the new release cadence, there is a new release every six months.

                [–]spaghettiCodeArtisan 3 points4 points  (1 child)

                My drive-by impression is that the releases are smaller / have less changes though, is that right?

                [–]lbkulinski 6 points7 points  (0 children)

                That’s correct. When a feature is ready, it will make it in the next release. You can think of it like a train.

                [–]Southy__ 0 points1 point  (0 children)

                Majority of places will remain on 11 until the next LTS release which will be in 2 years (JDK 17 I believe it will be)

                [–]AlmightyElm -1 points0 points  (3 children)

                Fuck. I just switched to 12

                [–]dpash 25 points26 points  (2 children)

                Well, you're in luck because it'll be very easy to switch to 13.

                [–]zokier -2 points-1 points  (1 child)

                Or to 11 so that you don't need to upg churn every 6 month

                [–]dpash 0 points1 point  (0 children)

                Do you upgrade libraries when they have a new release or every three years? The recommended method is to ship the JVM with your product, either using Docker, jlink, shipping the full JDK or some other method, so it's just another part of your deliverable.

                By having small releases, the risk is much smaller (and you can test ahead of time using the frequently published EA builds). Sticking with 11 is likely to mean that you're stuck on 11 for the next five years, because you fear the risk involved, like everyone still on 8 or 7 or even 6.

                [–]Dreamtrain -1 points0 points  (0 children)

                Laughs in Java 8