Тёмный

Data-Oriented Programming in Java 

Java
Подписаться 188 тыс.
Просмотров 21 тыс.
50% 1

Опубликовано:

 

25 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 44   
@mr-fv9md
@mr-fv9md Год назад
Boilerplate free case classes, sealed hierarchies and exhaustive pattern matching are my favourite aspects of scala (and other analogous features found in more functional languages) I'm very happy to see these features finally make their way into the latest java versions. Nice talk!
@systemsincode7023
@systemsincode7023 Год назад
Scala lead the way several times I think..but always great to get these in to java eventually.
@alexandre8869
@alexandre8869 Год назад
Dear Mr. Bierman, thank you very much for clearly explaining to us the purpose of the Amber project and the relationship between the features that compose it to give Java the complementary dimension of data-oriented programming.
@NathanielMishkin
@NathanielMishkin Год назад
Nice presentation of the new ways to use Java and one of the best introductions I've seen to sealed classes--something that many people (me included) don't initially understand, or understand the point of, or know how and when to use.
@lukaszmachowski
@lukaszmachowski Год назад
A thing of sheer elegance and beauty. JSON in Java is as simple as it should be and no simpler. I’m loving this!!! Great job dear ninja architects. I want to be like you when I grow up.
@nevgeniev
@nevgeniev Год назад
They all are nice features. But I'm yet to see a connection with misleading video title. Data oriented programming is about organizing data and computations the way so it will be fetched by cpu in a most efficient way. This doesn't even try to scratch that topic :(
@lufenmartofilia5804
@lufenmartofilia5804 11 месяцев назад
I came exactly for this. And got disappointed 🫠
@DrewIsFail
@DrewIsFail 10 месяцев назад
@nevgeniev in the functional programming circles i travel in this use of the phrase "data oriented programming" fits. It more or less means data structures oriented programming, a good example being the last part of this video where the hidden json was traversed "without" statements. This is a long winded way of saying, his use of the phrase makes sense to me and likely many others.
@yadigarcaliskan6453
@yadigarcaliskan6453 3 месяца назад
Data oriented means in this context record as pure data container instead of traditional object oriented „object“. He is talking about business modeling not about performance issues. Project amber does not care about performance(at least directly). What you are looking for, is in project valhalla. Jose Paumard has a bunch of videos published about project Valhalla. There are very helpful
@sethbrown570
@sethbrown570 Год назад
Good Summary of the new features in Java- Thanks!
@onebeartoe
@onebeartoe Год назад
Thank you, this episode really helped me understand what I still was not 'getting' about the new patterns Project Amber features!
@PietervandenHombergh
@PietervandenHombergh Год назад
Good explanation and summary of the goodies of project amber.
@gsestream
@gsestream 2 месяца назад
so why is binary tree not default in java, it can sort number lists in O(n) as radix binary tree sort, just using insertions its O(n).
@ayanSaha13291
@ayanSaha13291 Год назад
Thanks for sharing this new concept. Quite enjoyed it.
@VisruthCV
@VisruthCV Год назад
Good presentation, I liked it. 💚💙💜💛🧡 Thanks!
@nathansgreen
@nathansgreen Год назад
Why Map instead of Map? If this was done intentionally, it should be explained, because it doesn't seem obvious at first glance.
@Rope257
@Rope257 Год назад
Is there any advantage/disadvantage of using say a pattern-matched switch case over the Visitor pattern? Aside from being less complicated. I've always worked under the assumption that one should avoid explicitly type-checking and instead use method overloading to determine the type you'd like to use for a specific action. Would like a reason to revisit that assumption.
@ennioVisco
@ennioVisco Год назад
I agree this mental change has been silently brought in without proper discussion. My understanding is that the Visitor pattern still makes a lot of sense when you want to make that boundary highly flexible, moving the decision to runtime, e.g. a plugin api for your software. Conversely, when you have very high cohesion on that boundary, you prefer to have type-based pattern matching, so that things immediately break at compile time without introducing any runtime reasoning (e.g. the calculator API shown must never allow you to define operators that don't have a proper routine to compute the result)
@gJonii
@gJonii Год назад
​@@ennioVisco Further, the whole issue is that Java doesn't support proper algebraic types(aside from exceptions for some reason), so this pattern matching seems like a crude hack to enable this basic feature with moderate amount of boilerplate so it works 99% of the time. It's still the same issue of language being broken fundamentally and all fixes are weird hacks that kinda remedy the issue rather than actually fixing it, so it's not gonna be the proper full solution, it's just one more hack on your toolbox to work around language limitations. That being said, I'm quite happy about this hack. You get tagged union types 99% of the time with acceptable amount of boilerplate. Boilerplate is always going to be an issue, and I think the 1% where the hack fails are not gonna be situations that would bother me that much. But seriously, Java has full tagged union support for checked exceptions, with *less* boilerplate, since forever. Why do they rather poorly try to reinvent the wheel and produce this square monstrosity, rather than just use the existing functioning one they use to carry the square wheels to the market?
@Blacklands
@Blacklands Год назад
​@@gJonii Some issues that I know of/things I have seen people complain about with checked exceptions in Java: - Don't really work with streams (afaik this can't really be fixed) - Can't be generic (which can't be changed due to how type erasure works) - Fairly ugly and annoying to use in code, if you have a bunch of them - A lot of people don't like them, to the point where some other JVM languages, like Kotlin, didn't even include them at all
@Rope257
@Rope257 Год назад
@@ennioVisco Thanks for that explanation. Much appreciated!
@Tony-dp1rl
@Tony-dp1rl 11 месяцев назад
Making Java do DOP seems so much more complex than in other languages. I would question the cost/benefit of using Java for the approach.
@DrewIsFail
@DrewIsFail 10 месяцев назад
What's the question? If you need to use Java, why not handle the problems he covers with the tools he presented? What do you think the downsides are?
@donwinston
@donwinston 3 месяца назад
You are being silly. Purity in a programming language is dumb. Pure OOP languages and pure functional programming languages are completely unnecessary. For example Java could make a small syntax change and support classical imperative style programming, OOP, and functional programming all in the same application or library. Scala has come close to doing this. The end result will not be a more complicated language but a more flexible and versatile one. It was a mistake for the creator of Java to force you to use classes.
@sjzara
@sjzara Год назад
Very useful presentation - thanks.
@java
@java Год назад
Glad you enjoyed it!
@yadigarcaliskan6453
@yadigarcaliskan6453 Год назад
very impressed! thanks
@PietervandenHombergh
@PietervandenHombergh Год назад
what about 'prefer polymorphism over if/else or switches' This is a new style, and one might want to see a bit more of motivation to reverse the concept in these cases.
@bobbycrosby9765
@bobbycrosby9765 Год назад
It's basically a more direct version of the visitor pattern. The point is to use it when you have a limited number of types but lots of operations on those types. The design challenge in using pure polymorphism is blowing up the interfaces of your limited number of types. The previous danger of type checking with if/else or switches without the compiler checks is you might accidentally miss a scenario. Thus the visitor pattern was born. Now when you have enums or sealed classes, you can confidently use switch expressions and not worry about silent failures - the compiler will let you know. It streamlines a style of programming that many problems are amenable to. Beyond that, I would imagine some of this is forward looking to Project Valhalla, and the JVM will be able to better optimize this pattern. But that's pure speculation.
@TheBigLou13
@TheBigLou13 Год назад
28:03 wouldn't it be more uniformly to write it like this?: if ( j instanceof JsonObject ? (pairs) ) { ... }
@TomEugelink
@TomEugelink Год назад
I'm somewhat worried; if the 'record Point(int x, int y)' is defined and a record pattern matches it with 'instanceof Point(int x, int y)' what happens if I decide to change the order of the record's constructor to '(int y, int x)'? I hope the compiler will detect that. Hmmm, need to run some test with these features.
@mihaiapostol7864
@mihaiapostol7864 Год назад
you'd face the same issue when using a regular constructor too - you'd have to change the parameter order everywhere you instantiated it in the program
@TomEugelink
@TomEugelink Год назад
@@mihaiapostol7864 Yeah, was afraid of that, and I think that is fragile. One of the things records lack IMHO is a very simple builder for all the constructor parameters; Point.x(...).y(...). The sequence is fixed and the last parameter-method is the 'build'. If you change the constructor's parameters, even the order, the compiler would require you to revisit all usages. Because Point(1,2) means something else now, and I need to write Point.y(...).x(...). I do not see an easy pattern for doing something similar with record patterns. Maybe the IDE's will pick this up.
@mihaiapostol7864
@mihaiapostol7864 Год назад
@@TomEugelink interesting solution with the builder :)
@TheDoppelganger29
@TheDoppelganger29 Год назад
Would appreciate if it was a dive into an actual example, I've seen these intros a lot on the channel.
@Tekay37
@Tekay37 Год назад
This is not Data-Oriented Programming. It lacks the core elements of Data-Orientation.
@encapsulatio
@encapsulatio Год назад
Which are......?
@Tekay37
@Tekay37 Год назад
@@encapsulatio (1) Not modeling data as objects (2) organizing data in memory so it can be iterated over quickly (e.g. instead of a list of vectors being laid out in memory as xyzxyzxyzxyz, have it xxxxyyyyzzzz). (3) Not thinking in terms of single objects, but in terms of objects as part of particle systems.
@nathansgreen
@nathansgreen Год назад
@@Tekay37 I agree it should probably be called Value-Oriented Programming or something. Lack of control over memory layout is the only thing that I consider to be missing. From the examples in the video, records do not seem to exhibit behavior, and they definitely lack internal state, so I don't see a reason to refer to them as objects in the OOP sense.
@Tekay37
@Tekay37 Год назад
@@nathansgreen They are "POJOs" (Plain old Java Objects), as Robert Martin would call them in his "Clean Code" and "Clean Architecture" books. I don't see anything new or non-OOP about them. They are just the kind of Object, you'd use to pass around data in an OOP system.
@lekretka
@lekretka Год назад
​@@Tekay37 I too got confused, but what you are talking about is "Data-oriented design" which is about speed, cache friendliness, data layout etc. There are other talks and videos about "Data-oriented programming" which I guess is just a fancy name for "functional programming", or at least the concepts are very similar. It has nothing to do with "DOD" and used only for readability and simplicity, not performance boost.
@ArthurSchoppenweghauer
@ArthurSchoppenweghauer 10 месяцев назад
This has nothing to do with data oriented design as layed out by Mike Acton.
@japhethjay4880
@japhethjay4880 Год назад
Are this not all the things Kotlin did hmmmm?
@Blacklands
@Blacklands Год назад
That's how Java works. It's a "last mover" language. The Java developers first look at how language features do in other languages, and whether they prove themselves over the course of (afaik) years, and what issues they might potentially have. And only then, it is considered whether Java adopts a feature as well, and if so what the best version of that feature might be (evaluating what was learned by how other languages implemented the feature). Innovation, on the other hand, does happen too, but it happens on the side of the Java Virtual Machine!
Далее
Java 21 Pattern Matching Tutorial #RoadTo21
23:28
Просмотров 26 тыс.
Data Oriented Programming in Java 21 by Nicolai Parlog
48:28
Java 21… and Beyond
48:30
Просмотров 24 тыс.
Java 21 API New Features #RoadTo21
16:48
Просмотров 43 тыс.
Data oriented Programming in Java - Ron Veen
53:22
Просмотров 1,6 тыс.
Modern Java in Action
50:32
Просмотров 38 тыс.