[VDZ22] 9 Java Patterns that Kotlin made obsolete by Sebastian Brunner

Поделиться
HTML-код
  • Опубликовано: 26 ноя 2024

Комментарии • 42

  • @aortizc82
    @aortizc82 11 месяцев назад +3

    Straight to the point, easy to remember, easy to apply IRL. 😊

  • @MrKenalik
    @MrKenalik 2 года назад +8

    I was so excited after the first "takeaway" and started thinking that I need to watch the video to the end and then later to show it somebody else to discuss.
    Compile time error NPE check is really strong feature. I think in java it can be done by extending the pom.xml with some extra plugins (I am pretty sure). I would really like to have it built in.
    Others "takeaways" are more like a syntax sugar or features that incline you, or even forgive you when you write poorly designed code (I mean the method overloading + default values).
    I don't want to offend some touchy software engineers but I see only one strong argument here (takeaway#1) and I don't see how it convinces the "business" to start using it.
    I am talking only about enterprise level java I am not sure how it works in android world.
    Thanks author anyway!

    • @Seppjos
      @Seppjos 2 года назад +6

      Hi and thanks for the feedback!
      I guess I set the bar too high with the first takeaway and it is of course Kotlin's main selling point over Java (especially to the business).
      However, from my experience devs tend to underestimate the power and fun that comes from this syntax sugar.
      It's just more fun to code in Kotlin than Java and it opens up and provides more freedom to developers.
      I've had great success convincing the business (in a big bank) to switch to Kotlin by mentioning that it's interoperable with Java so you don't need to rewrite all the code at once.
      Of course Kotlin has many more feature that unfortunately did not fit into my 20 min talk ;)

    • @mattdoestechstuff
      @mattdoestechstuff 2 года назад +1

      @@Seppjos This is exactly what I did too at my work too when convincing them to move to Kotlin (I work in a big Bank too in Australia). All business wants to hear is that developers prefer it, that it's interoperable with Java and that it will reduce development time.

    • @Qrzychu92
      @Qrzychu92 Год назад +1

      I am a C# programmer, but this looks WAY better than Java. Saying "it's just syntactic sugar" is like saying tha async/await is only sugar - which in reality it is just that, but it is SO MUCH better than callbacks. Embrace Kotlin, seems like a great lnaguage to work in!

    • @deepakbisht4957
      @deepakbisht4957 10 месяцев назад +1

      ​@@Qrzychu92
      Exactly!
      I like java hut I'm not right like some java and ja fanboys.
      Around 2018 when I started using Kotlin in my Android project it say immediate changes the code readability and concise Kotlin syntax.
      The sugarcoat thse java fanboys talk about is actually kotlin frontend in it's syntax and it made it that way to concise things and make code more readable.
      Now I'm using Kotlin In Spring boot project and so far it's a wonderful experience...
      Java developers don't need to hate kotlin because it's just better java.
      I myself defend java when js developer don't understand Java design principles, OOPs & SOLID principles but I don't blindly say java is good with everything...

  • @kqvanity
    @kqvanity 8 месяцев назад +1

    18:24
    I"ve indeed come across snippets/repos out there that still write them manually in Kotlin, with lots of clout, because, well, it was aesthetically highlighted

  • @donwald3436
    @donwald3436 2 года назад +3

    Optional is even funnier becauses it causes NullPointerException as well as ArrayIndexOutOfBoundsException.

  • @mattdoestechstuff
    @mattdoestechstuff 2 года назад +2

    Fantastic talk 👏 This is now going to be one of my go to videos when training the Java Devs in Kotlin at work!

  • @zerettino
    @zerettino Год назад +5

    #8 is not a good example in my opinion : when you read "four < five" you don't what the comparison is based on. To understand what is going on, you have to read all the code to see where "compareTo" is defined. "four.releasedBefore(five)" would be a much better way to write this so that it's easier for the reader to understand.

    • @vladimirkraus1438
      @vladimirkraus1438 8 месяцев назад

      yeah, the example was not the best one. but i guess this was just to illustrate the feature.

  • @bizoitz86
    @bizoitz86 2 года назад +4

    I wonder what “looking OO (Object-Oriented)” means.

  • @thilankaliyanaarachchi984
    @thilankaliyanaarachchi984 4 месяца назад

    Java version of factory method expresses the programmers intention clearly than the Kotlin version

  • @deepakbisht4957
    @deepakbisht4957 10 месяцев назад

    I still don't get it why people are still saying kotlin is just a sugarcoat and nothing else.
    You just need to see last slides and it sums up everything.
    "Kotlin isn't just fancy syntax, it's a different kind of programming"

  • @fabricioaraujo7642
    @fabricioaraujo7642 2 года назад +3

    So kotlin is basically a scala with a good marketing...

    • @deepakbisht4957
      @deepakbisht4957 10 месяцев назад +1

      Nope it's a programming with fun.
      Best for the java developers. They don't need to hate kotlin. They should just try to use it...

    • @AntonArhipov
      @AntonArhipov 9 месяцев назад

      No. Kotlin is Scala without the nice things ;) (quoting Andrey Breslav's "Standing on the shoulders of giants" talk)

  • @SirWolf2018
    @SirWolf2018 2 года назад

    Spring has recently released `andExpectAll` for its `ResultActions` API, so it's slightly less annoying now to make sure all assertions are reported when at least one fails.

  • @zerettino
    @zerettino Год назад +2

    #9 is also not good in my opinion. The strategy pattern is still useful, and what is presented is not a good use of the pattern. The strategy pattern is not about implementing interfaces. And implementing a FlyBehaviour with "I cannot fly" makes no sense : if you cannot fly, you don't implement the FlyBehaviour.
    That being said, delegation is super handy, but we have to find another argument to sell it ;-)

  • @jordan7831
    @jordan7831 2 года назад +9

    Why Kotlin users always spit on Java ? Just move on, and appreciate Kotlin features

    • @HerbertLandei
      @HerbertLandei Год назад +2

      That's just our PTSD speaking, which kicks in once you overcome the Stockholm syndrome.

    • @deepakbisht4957
      @deepakbisht4957 10 месяцев назад +1

      Bruh this love for the language is everywhere 🤦.
      JS developers are also lole that. Why can't you simple use everything it's not hard to code in these languages. Just use things what works best for the current solution instead of favouring any language...

    • @HerbertLandei
      @HerbertLandei 10 месяцев назад

      @@deepakbisht4957 There are examples where one language is at least as good as another one in every regard. Kotlin is as good as Java or better in all regards, TypeScript is superior to JavaScript. There are silly language wars like C# vs Java, where it's not clear which one is better, but in some cases it just is.

    • @kqvanity
      @kqvanity 8 месяцев назад +1

      Any superset technology has to be mentioned with respect to its now-inferior predecessor.

  • @HAAAAAA614
    @HAAAAAA614 7 месяцев назад

    This feels like it was created by a 1st year comp sci major that listened to their favourite influencer about java bad
    Nullability is the only thing Kotlin has over Java and maybe I've not written enough java to get frustrated (I have) but getting null pointer errors, in 2024, with powerful IDEs is most definitely a skill issue.
    Extension functions in large code bases make code unreadable. Good luck finding the definition when you're not viewing from an IDE
    The only major difference between factory pattern and the Kotlin code is ... literally nothing. The Kotlin code eventually does the same thing the factory pattern does. Is your definition of Obsolete ... reinventing the wheel?
    Again, the DSL shown isn't that much different from the Java code.
    The maps? They look almost the same. Why was that even added? Lol
    Iterator? Just use Streams?
    Think of the reader, and not the writer? If I'm reading a code from an intern, and I see four < five, and four and five are not numbers, they're getting queried because how does that even make any sense??
    Giving it actual movie names to makes no sense either from a readbility POV. It's much more readable if you do something like .premieredBefore(). Being fancy doesn't mean readability
    For the strategy pattern, why didn't you put all the kotlin code in one screen like you did for Java? You're not trying to exploit some human bias right? Right? Almost like you're trying to trick your viewers into reinforcing the believe that java is more verbose (which is right but not in this scenario).
    Did you intentionally try to make the java code more verbose? The final keyword isn't needed. The public keyword isn't needed since the class is package private. Given the context, instantiating a new Behvaiour isn't needed either. new BehaviorTypeHere().fly() in the fly method would have been enough
    Istg the only people that love kotlin are those that like to feel "smart" or "fancy when coding.
    Kotlin is just good PR team. If you're gonna hate on Java, at least bring up Golang. Apple didn't choose kotlin as the main language for their new language lol
    This was fun to do. Good video. Now I go back to writing stupid c# so I can have somewhere to live

  • @sarabwt
    @sarabwt Год назад

    I almost cannot believe that operator overloading was followed by think about the reader :D the example given is a way to brainfuck everyone reading it, even yourself after 3 months away. Saying movie1 < movie2 has a huge question mark of what you are even comparing. Year of release, number of cast members, movie rating, etc?

    • @deepakbisht4957
      @deepakbisht4957 10 месяцев назад

      It's not a question mark it's just you are restricting your mind to compare only primitive numbers like int or something but it's OOPs and we should think like that way and create our own objects and operate them according to the real world things...

    • @sarabwt
      @sarabwt 10 месяцев назад

      @@deepakbisht4957 This was two months ago, reading the comment and seeing movie1 < movie2, I have no idea wtf it's comparting xD
      It's not about restricting your mind, it is about information hiding and context dependence, that is bespoke to your program, not to mention, that you can never change it in case you were wrong the first time. I can easily imagine two movie codebases, that use same operators for different purpose. And that is incredibly shitty reading experience.

  • @ZelenoJabko
    @ZelenoJabko 2 года назад +3

    All these things kotlin stole from scala. Wow such revolutionary

    • @guai9632
      @guai9632 2 года назад +9

      Scala didn't invent those either

    • @ZelenoJabko
      @ZelenoJabko 2 года назад

      @@guai9632 not all of them, but many

    • @guai9632
      @guai9632 2 года назад +1

      none at all

    • @mattdoestechstuff
      @mattdoestechstuff 2 года назад +1

      Quite a few things actually existed in C# many years ago. But what does it matter, if langauges didn't learn from other languages and take what's good here and there, we would have langauges so seperated that evolve way slower

    • @patrikeriksson8410
      @patrikeriksson8410 2 года назад

      Sure most things have been stolen, but unfortunately you're incorrect: Scala still doesn't even have #1 from the talk non-nullable types and nullable types with compiler-check, you have to do it the tedious way like Java and wrap with Optionals.. Scala is great but such a pain to code in sometimes

  • @jimishukurow2286
    @jimishukurow2286 4 месяца назад

    Map.of() hit me