Harnessing Java 21 for Data Oriented Programming

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

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

  • @VerhoevenSimon
    @VerhoevenSimon 5 месяцев назад +4

    I loved Brian's article, too few people know about the sealed interface with multiple records inside it tidbit.

    • @talesfromthejarside
      @talesfromthejarside  5 месяцев назад +1

      Agreed. First time I saw the records inside the sealed interface, I thought it was a typo :⁠-⁠)

  • @Savatore83
    @Savatore83 5 месяцев назад +3

    very interesting how you did the sealed interface with two records inside

    • @talesfromthejarside
      @talesfromthejarside  5 месяцев назад +3

      Cool, right? Brian Goetz did it in his article and I didn't even realize that was legal until I saw him do it :⁠-⁠)

  • @kappaj01
    @kappaj01 5 месяцев назад +1

    Excellent video with plenty detail explanation.
    I do have one question though: With realtime systems we used to say - stay away from new object creations as much as possible. With records you do not have an option to adjust the data other than creating a new record, like you did in the beginning. With the improved GC's and serious horsepower we have nowadays, do you think it is still better to use a DTO with getter/setter and pass that around, or use records and simply return a new instance when you do need to adjust some data.
    Personally I find using records great as input and output carriers, and old-school DTO's inside the app between different services/layers (old old habits die hard!). As always not a hard rule.

    • @talesfromthejarside
      @talesfromthejarside  5 месяцев назад +1

      Yeah, that's a legitimate debate. A lot of it comes down to immutability being so useful when concurrency is involved, because shared mutable state is so hard to get right. But I understand your concern

  • @kamurashev
    @kamurashev 3 дня назад

    Nice 👍

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

    your content is very good

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

    Looks almost like Rust, nice😀One more thing that I love about records is using record patterns to deconstruct their values, e.g.
    case Result.Success(var astronautsByCraft) -> processor.printResults(astronautsByCraft) or
    case Result.Failure(var error) -> System.out.println("Error: " + error);

    • @talesfromthejarside
      @talesfromthejarside  5 месяцев назад +1

      Nice example of record patterns, thanks. As for Rust, never heard of it 😉

  • @costathoughts
    @costathoughts 3 месяца назад

    Looking this amazing example I question myself why the hell Java did not bring the either interface of Scala. It would make so powerful.

    • @talesfromthejarside
      @talesfromthejarside  8 дней назад +1

      Right, there are several monad-related interfaces similar to this (Try, Either, etc) that Java could use. Or maybe there will be a decent library at some point that will include them. I don't know what the delay is either (no pun intended).

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

    Not better. More efficient. 🤔 OOP foundation remain the same which make programming easier to manage. We tested these in my Data Analysis Course. The majority approved this conclusion. 😊