Data Oriented Programming in Java 21, Solving the Countdown game - JEP Cafe #22

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

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

  • @giovanninabil6950
    @giovanninabil6950 9 месяцев назад +19

    Finally, Java is flexing on its multi-paradigm design

    • @JosePaumard
      @JosePaumard 9 месяцев назад +14

      It actually started 18 years ago when Java started to embrace elements of Functional Programming.

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

      yup... making an enormous unmitigated mess of paradigms.

    • @Talaria.School
      @Talaria.School 9 месяцев назад

      ruclips.net/p/PLzzeuFUy_Cng0wZhqbnkvWAW0d2fdVfyQ&si=VnMrzYqgs7-fKmeW a combo functional java + french language. 2 for the price of one for free.

  • @mirogula
    @mirogula 9 месяцев назад +7

    Very good, in depth explanation. Thank you.
    I wrote similar algorithm for solving countdown numbers game long time ago, when I was still at university. It was challenging, but fun problem to solve. I spent couple of weeks on it, on and off, and in the end I come up with quite elegant general solution, although I don’t know if it was as efficient as the solution described in your video.

    • @JosePaumard
      @JosePaumard 9 месяцев назад +5

      It's indeed a funny problem to work on 🙂

  • @emileastih9006
    @emileastih9006 9 месяцев назад +5

    Great video as always José, with some truly insightful content! However, I personally miss the old format where you would code live and explain your thought process as you go.
    It helped me understand not just the 'what,' but also the 'why' behind each line of code.
    Looking forward to more great content!

  • @anyone-d4i
    @anyone-d4i 3 месяца назад +1

    Hi, guys! Why there are no more any new videos of Java Cafe? I'm so waiting for them :)

  • @christianschafer3724
    @christianschafer3724 9 месяцев назад +15

    That's one long coffee break...

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

      The boss is getting wise too.

  • @TehBrian
    @TehBrian 9 месяцев назад +7

    Is the DIV case at 21:24 supposed to have `resolve(left) % resolve(right)` instead of `resolve(right) % resolve(right)`?

    • @JosePaumard
      @JosePaumard 9 месяцев назад +7

      Indeed. Thanks for reporting this! The code in the Gist is correct.

    • @lolo101
      @lolo101 9 месяцев назад +1

      Also @ 22:40 all four operations are treated like Add

    • @JosePaumard
      @JosePaumard 9 месяцев назад +4

      @@lolo101 Oooops...

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

      Papermc discord?

  • @AleksandarT10
    @AleksandarT10 9 месяцев назад +11

    Great ideas but complex code in general :)

    • @JosePaumard
      @JosePaumard 9 месяцев назад +5

      Well the algorithm is more complex than the code imho.

  • @Ambusher306
    @Ambusher306 9 месяцев назад +2

    We should have another one where Java's support of Functional / Data-oriented programming paradigms is investigated. It can also detail which Java libraries are built on which paradigm, etc

    • @JosePaumard
      @JosePaumard 9 месяцев назад +1

      Good idea! Do you have a specific library in mind?

    • @Ambusher306
      @Ambusher306 9 месяцев назад +1

      @@JosePaumard Unfortunately no. I never taught about it before even recommending :

    • @JosePaumard
      @JosePaumard 9 месяцев назад +3

      @@Ambusher306 😄Let me think about it then.

  • @danwhitfield-wk3bf
    @danwhitfield-wk3bf 9 месяцев назад +2

    Where can I get that Java coffee cup? I can’t seem to find it anywhere!?

    • @giovanninabil6950
      @giovanninabil6950 9 месяцев назад +1

      just print one dude! it's not that hard nor expensive.

  • @kingajable
    @kingajable 9 месяцев назад +6

    Love from india you doing superb job

    • @JosePaumard
      @JosePaumard 9 месяцев назад +4

      Thank you, I appreciate it!

  • @Talaria.School
    @Talaria.School 9 месяцев назад +3

    Thanks a lot. ❤

    • @JosePaumard
      @JosePaumard 9 месяцев назад +1

      You welcome Khaled!

  • @jay_sensz
    @jay_sensz 9 месяцев назад +2

    28:23 I don't think you really need that initializer block, you might as well just assign the value in the field declaration directly, e.g. `Element previous = toBeInserted;`

    • @JosePaumard
      @JosePaumard 9 месяцев назад +3

      Yes, but it changes everytime it is called in the stream. In that way you don't use capturing variable.

    • @jay_sensz
      @jay_sensz 9 месяцев назад +2

      @@JosePaumard I don't understand what you mean. You're capturing the variable `toBeInserted` exactly the same way whether you use it in an initializer block or a declaration with assignment because it's all within the scope of the local/anonymous class. In both cases, `toBeInserted` needs to be effectively final for this pattern to function. The only way to avoid capture would be to assign the field after the object has been constructed, i.e:
      var state = new Object(){Element previous;};
      state.previous = toBeInserted;
      Please correct me if I'm wrong though.

    • @JosePaumard
      @JosePaumard 9 месяцев назад +5

      @@jay_sensz Yes you're right, my bad. In an earlier (unpubslihed) version, there was more code in this init block, reason why it's still there. But it's not needed anymore now.

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

    Where can we get that Java coffee mug ❤😊

  • @milosristic1111
    @milosristic1111 9 месяцев назад +5

    I couldn't wait!!!🙂🙃🙂

    • @milosristic1111
      @milosristic1111 9 месяцев назад +3

      It was very interesting video,I didn't jet arrive to this point in Java Programming,I am just a beginner with passed First Introduction To Java Programming Certificate,but,anyway it will be to me useful one day I hope!!!Cheers 🙂

    • @milosristic1111
      @milosristic1111 9 месяцев назад +1

      By The Way IT is so wide and excitful I couldn't even imagine!

    • @JosePaumard
      @JosePaumard 9 месяцев назад +3

      @@milosristic1111 Thank you, glad you liked it!

    • @milosristic1111
      @milosristic1111 9 месяцев назад +2

      When You made a bunch of similar videos notify me or I will see it on RUclips Channel to enjoy in Your entertainment of Lectures once again!!!See Ya Abroad as soon as possible

  • @ZelenoJabko
    @ZelenoJabko 9 месяцев назад +1

    Dynamic programming left the chat.

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

    when @Functional interface contains only one abstract method then why comparator interface contains two abstract methods

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

      One of the methods is `boolean equals(Object o)`, and `Object`defines an implementation for that method. Thus, you can target `Comparator` with a lambda/method reference that defines the other method, `int compare(T o1, T o2)`
      And from the JLS:
      9.8. Functional Interfaces
      A functional interface is an interface that has just one abstract method *(aside from the methods of `Object`)* [my emphasis]

  • @PositiveAlex
    @PositiveAlex 9 месяцев назад +2

    Aaawesome 😊

  • @AjayKumar-fd9mv
    @AjayKumar-fd9mv 9 месяцев назад +2

    Awsome

  • @alrianceanak2
    @alrianceanak2 5 месяцев назад

    I, m new again java

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

    Why does everything need to be a gimmick? What is wrong with just presenting the code and functionality? Adult programmers don't need gimmicks like coffee intro and backstory. Just get to the point please.

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

      Bro u have a cartoon profile pic and are throwing a tantrum in a RUclips video.

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

    😂 “Data” oriented programming. It’s just functional programming that is old as shit

    • @edmaphis9805
      @edmaphis9805 9 месяцев назад +3

      I think they use that term to contrast it with Object Oriented programming.

    • @ChannelCheesecake
      @ChannelCheesecake 9 месяцев назад +4

      @@edmaphis9805 it’s funny that a lot of OOP programmers recently when their languages started to get FP features began to introduce new terms such as “pipe oriented programming”, “data oriented programming” etc. and it’s just weird

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

      @@ChannelCheesecake It's actually a thing. Phil Wadler wrote and talked about it.

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

      Back to COBOL I go 😏

    • @JosePaumard
      @JosePaumard 9 месяцев назад +3

      @@KangoV Back to the roots! 😆

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

    Why compareElement(e1,e2) method has to rely on the premise e2 >= e1 in their implementation Integer.compareTo(e2,e1) ? Integer.compareTo(e1,e2) doesn't works