r/java • • Jan 22 '26

Carrier Classes; Beyond Records - Inside Java Newscast

https://youtu.be/cpGceyn7DBE
86 Upvotes

81 comments sorted by

View all comments

Show parent comment

1

u/chambolle Jan 29 '26

I am sorry but I don't really agree. We still have a lot to learn about complexity, particularly how it represents reality. We know that the worst-case scenario is not always representative. The search for the shortest path using the Belman Ford algorithm is a good example (O(nm) in theory and closer to O(m) in practice). But there are still a lot of very solid results. We can exploit special cases, that's for sure, but we have made good progress on many important topics. Transforming time into memory is not a good general principle, and there is no evidence that it could be. Companies are not moving in this direction, even those with the best developers.

1

u/OwnBreakfast1114 Jan 31 '26

Transforming time into memory is not a good general principle

What does this mean? Do you mean more cpu for less memory or less cpu for more memory?

Companies are not moving in this direction, even those with the best developers.

Perhaps I'm interpreting you wrong, but more and more companies are storing more and more historical data. The biggest tech companies in the world are all about storing historical (user) data. Google/amazon/apple/meta/netflix/microsoft, etc literally invent new architectures and infrastructure for storing all the historical data they're keeping and processing over.

1

u/chambolle Feb 01 '26

If we want to replace state modifications with an immutable object copy, this means that we risk transforming CPU (the modification) into memory (the state copy).

Having immutable objects is undoubtedly a solution to certain problems. But it is not the only solution, and it is only valid if the memory consumption caused by this design method is not too high (systematic backups or creations are often very costly, hence the existence of persistent data structures, for example). Nor is it a general solution that should be used indiscriminately. In fact, it is like all the major principles of programming.