cpprussia C++ Russia 2019 SPb (31.10.2019 — 01.11.2019)

Squaring the circle: value-oriented design in an object-oriented system


Learn about how cursors and reactive lenses can help designing your code around value-semantics and functions, modernizing legacy code-bases and UI’s otherwise written in a referential, object-oriented style.

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.