Juan Pedro Bolívar Puente - Squaring the circle: value oriented design in an object oriented system
ฝัง
- เผยแพร่เมื่อ 6 ก.พ. 2025
- Ближайшая конференция - C++ Russia 2025, 20-21 марта, Москва + online. Подробности и билеты: jrg.su/9Sszhd
- -
. . . In this talk, we will present a new open-source library of cursors. Cursors are inspired by functional lenses and reactive streams to provide composable and modular facades to "single atom" value storages. We will see how this can be used to navigate the tension between object-oriented and value-oriented design, and build an example interactive application using Qt and QML against a value-based data-model.
Value-oriented design reconciles functional and procedural programming by focusing on value semantics. Like functional programming, it promotes local reasoning and composition - it is, however, pragmatic and can be implemented in idiomatic C++. In previous talks, the speaker has discussed how immutable data-structures help use value semantics at scale, and how the Unidirectional Data-flow Architecture (Redux, Elm) provide a solid foundation for designing interactive software based on values and functions.
However, we rarely have the luxury of starting from scratch. We are often embedded in legacy codebases with Frankensteinian designs crystalized over decades of multi-paradigm evolution. Also, it's hard to build serious interactive software without frameworks like Qt or Juce that, with all its power, also impose a Javaish object-oriented approach at the boundaries of our system. In this talk we will learn how novel abstractions and design methodologies can help modernize real world code-bases, incrementally migrating them to a value-oriented design. - วิทยาศาสตร์และเทคโนโลยี
8:00, infinite recursion? I guess the val f() would call obj f(), right?
And talking about immutable data-structures (8:30), let's say there was here a 3rd f(), which only wants to read the light from the kitchen, is there a performance difference between passing 'h' by const reference vs passing only the 'light' variable directly, by const value?
10:15, I guess 'room_' is 'r'?
14:14, the problem is that, depending on the project, 1 is forced into a spaghetti architecture. Take the game industry, for instance. Immutable data-structures are uncommon (to not say rare), because everything can change according to what user will do. Worse, the f() chain to be called vary according to values in variables. Hence, it's crucial to keep them locked in a bunker. And to also keep a flexibility, OO is welcomed.
18:30, you should put set() in nonpublic mode, and attach a list of friends to call it. The way it is, you will be lost in the middle of a crossfire, like a Java guy.
20:40, if you want to turn on the light of the N-th room in a house, in real life, you will need to know how to get there. I don't see any issue in that. And since the user can click randomly at any room, it's fair to give the f() the number of which 1 was clicked.
23:45, this is catastrophic! You are exposing confidential content!