Data Oriented Programming, Beyond Records
Robbe Pincket
robbepincket at live.be
Thu Jan 15 00:57:17 UTC 2026
> This is exciting stuff, ty vm Brian.
>
> There are multiple reddit threads linked to this post, and one recurring question is this -- now that we have this, what purpose do records serve? Funnily enough, the "breaking down of the cliff" looks so smooth now that a couple people are wondering what benefit there is in choosing records in the first place now. It appears that these "Carrier Classes" have entirely subsumed the functionality and capabilities of records.
>
> To be more direct, what are the functional, semantic pros and cons between these 2 lines of code? In what ways is choosing record better, if any?
>
> record Point2D(int x, int y) {}
> final class Point2D(int x, int y) {}
>
> Thank you for your time and help.
> David Alayachew
AFAIK `final class Point2D(int x, int y) {}` does not work? You need the following:
```java
class Point(int x, int y) {
private final component int x;
private final component int y;
}
```
So that's the benefit. No need to specify the fields a second time.
Kind regards
Robbe Pincket
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-observers/attachments/20260115/41230a4c/attachment-0001.htm>
More information about the amber-spec-observers
mailing list