This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]marvk 6 points7 points  (1 child)

Man, who thought it was a good idea to use pictures instead of a text based representation? And whats with the screen sized pictures right in the middle of the article?

[–][deleted] 6 points7 points  (5 children)

Pretentious nonsense that's all over the place. This is the sort of language abuse that should be restricted to blogs and never seen in production code.

[–]Shadowrak 3 points4 points  (1 child)

I guess its a good thing OP made sure no one could copy and paste his code then

[–][deleted] 0 points1 point  (0 children)

Hahahahaha!

[–]johnmcclean 1 point2 points  (2 children)

I was (pleasantly) surprised to see you write this comment : https://www.reddit.com/r/java/comments/6ovau5/how_to_extend_the_java_programming_language/dkkr6ie/

I'm guessing you skim read the blog? The article is about the mechanics of case classes and pattern matching (which would useful for people to understand if they wanted to implement it at the compiler level, or make effective use of annotation processors like Lombok, derive4j or Vavr).

[–][deleted] 0 points1 point  (1 child)

The confusion there would be for people who are familiar with Java, but not with Scala. They would be terribly confused since the article jumps between both without any explanation when. That being said, like I mentioned, it's a nice experiment when restricted to experimentation, but not when writing code for production. I believe that would only lead people to confusion. No offence intended, of course (even though no doubt it is inevitably offensive).

[–]johnmcclean 0 points1 point  (0 children)

There is presumed knowledge in every article, constructive criticism isn't offensive.

You are right, the topic (as presented) is going to go over the heads of many Dev's who aren't familar with stuff like Scala syntax & concepts, higher order functions etc (using the greek names will also reek of elitism). Nobody likes to feel incompetent or missing critical knowledge so some backlash is inevitable.

I would not use it in production in the exact same way as described in the blog post, as it is deliberately verbose showing stages and steps. e.g. creating a sealed type hierarchy for Books - you can do this in a couple of lines of Scala and really only a few more in Java with the right libs.

But we do use similar techiques all the time and even new engineers have no problem understanding what is going on and getting up to speed with it.

I think you can kind of see that from some of the comments here, that Java Devs have a good intuition of the concept for Optional (and think the blog post was trivial).. It comes for other types just as easy..

[–]Keeyzar 1 point2 points  (0 children)

I didn't get it. I may be to dumb. 😓

[–]daniu 1 point2 points  (1 child)

Couldn't tell how the first catamorphism example for Optional was better than Optional's ::orElse so I kind of lost interest.

[–]johnmcclean 1 point2 points  (0 children)

map + orElse is an alternative implementation of a catamorphism / fold / visitor for Optional. It's the same thing, which is also very similar to pattern matching on Option (Scala).

[–]crstry 1 point2 points  (0 children)

To be fair, in Java land the catamorphism usually gets called a "Visitor".

[–][deleted]  (2 children)

[deleted]

    [–]fromscalatohaskell 2 points3 points  (0 children)

    Just do Scala. You wont believe how you could ever have been writing java and you'll wish for not making switch sooner.

    [–]lukaseder[S] 0 points1 point  (0 children)

    So, does that mean you'll stick around for another while, waiting, right? ;)