Loading…
CppCon 2018 has ended

Sign up or log in to bookmark your favorites and sync them to your phone or calendar.

• Polymorphism and Type Erasure [clear filter]
Tuesday, September 25
 

09:00

DynaMix: A New Take on Polymorphism
Software with very complex business logic, such as games, CAD systems, and enterprise systems, often needs to compose and modify objects at runtime - for example to add or override a method in an existing object. Standard C++ has rigid types which are defined at compile time and make this hard. On the other hand languages with dynamic types like lua, Python, and JavaScript make this very easy. Therefore, to keep the code readable and maintainable, and accomplish complex business logic requirements, many projects use such languages alongside C++. Some drawbacks of this approach include the added complexity in a language binding layer, the performance loss from using an interpreted language, and the inevitable code duplication for many small utility functionalities.

DynaMix is a library which attempts to remove, or at least greatly reduce, the need for a separate scripting language by allowing the users to compose and modify polymorphic objects at runtime in C++. This talk will elaborate on this problem and introduce the library and its key features to potential users or people who might benefit form the approach with an annotated example and a small demo.

Speakers
avatar for Borislav Stanimirov

Borislav Stanimirov

Software Engineer, ViewRay
Borislav has been a C++ programmer for 15 years. In the past 11 he has been programming video games. He has worked on C++ software for all kinds of platforms: desktops, mobile devices, servers, and embedded. His main interests are software architecture and design, and programming... Read More →


Tuesday September 25, 2018 09:00 - 10:00
Winter Park (406)

15:50

yomm2 - Fast Orthogonal Open (Multi) Methods
Have you ever felt your life would be simpler if you could just add virtual functions to a class hierarchy whenever you needed to (e.g., to persist an object or render it in JSON), but refrained because you did not own the classes and it would violate the principle of separation of concerns? Have you toiled on a Visitor class once again? Did you struggle to get double dispatch right because you needed to implement binary operations for polymorphic classes?
Open methods solve all these problems, while requiring you to write much less code -- and they deliver superior performance.

Open methods are virtual functions that are defined outside of a class. Given a method declaration and a set of specializations, the most specific version is selected depending on the dynamic type of one or more arguments. Open methods make it possible to add polymorphic behavior to existing hierarchies of classes, without needing to modify them. They provide a superior alternative to the Visitor pattern and a solution to the problem of cross-cutting concerns. Since more than one argument can participate in the selection of the specialization, open methods also solve the binary (or multiple) dispatch problem.

Circa 2007, Pirkelbauer, Stroustrup and Solodkyy wrote several papers about open multi-methods methods for C++, but the idea has failed to gain acceptance so far. My yomm2 library provides an implementation that is both fast (close to virtual functions), elegant and non intrusive.

yomm2 is available on GitHub (https://github.com/jll63/yomm2).

I will give a follow up to this talk, delving in the internals of yomm2, in an open session the next day (Wednesday, September 26) at 12:30.

I wrote a series of articles on an earlier version of a library (yomm11), see https://www.codeproject.com/Articles/635264/Open-Multi-Methods-for-Cplusplus-Part-The-Case. Note, however, that yomm2 is a complete rewrite and improves significantly on the initial library. In particular, this version does not require changing existing classes to deliver good performance; methods are called via ordinary functions (overloading is now supported); specializations need not be in the method declaration's namespace.

Speakers
avatar for Jean-Louis Leroy

Jean-Louis Leroy

Senior Software Engineer, Bloomberg LP
I am the author of yomm2, a library that implements open multi-methods. See https://github.com/jll63/yomm2


Tuesday September 25, 2018 15:50 - 16:20
Keystone (404)
 
Wednesday, September 26
 

12:30

Inside yomm2
Earlier this week (Tuesday 15:50), I presented yomm2, a library that implements fast, orthogonal, open multi-methods. This talk looks under the hood and describes a few interesting techniques that make the library work, but are also useful in other contexts.

yomm2 is available on GitHub (https://github.com/jll63/yomm2).

Speakers
avatar for Jean-Louis Leroy

Jean-Louis Leroy

Senior Software Engineer, Bloomberg LP
I am the author of yomm2, a library that implements open multi-methods. See https://github.com/jll63/yomm2


Wednesday September 26, 2018 12:30 - 13:30
Keystone (404)
 
Thursday, September 27
 

15:15

Effective replacement of dynamic polymorphism with std::variant
This short talk presents how easy it is to replace some cases of dynamic polymorphism with std::variant. During the lecture, we will analyze and compare 2 implementations of the same simple Finite State Machine. It turns up that variant-based code is not only much faster but also it gives us the opportunity to define our interfaces and program flow much better. The talk will end up with the discussion of pros and cons of each approach and will try to give guidelines on when to use them.

Speakers
avatar for Mateusz Pusz

Mateusz Pusz

Chief Software Engineer | C++ Trainer, Epam Systems | Train IT
Software architect, chief developer, and security champion with more than 14 years of experience in designing, writing and maintaining C++ code for fun and living. C++ consultant, trainer, and evangelist focused on Modern C++. His main areas of interest and expertise are code performance... Read More →


Thursday September 27, 2018 15:15 - 15:45
Breckenridge Hall (1st Floor)

15:50

C++ Everywhere with WebAssembly
Slides Now Available at : https://nxxm.github.io/cppcon2018/
The elegance how a C++17 application can bind to HTML5 will be shown, while running a C++17 data-model on WebAssembly in the server and the browser.
While we will look at the useful libraries, tips and techniques C++17 offers in this context. We will weigh the gains and the pains of modern C++ applied to the HTML5 user experience.

The effective impact on maintainability, performance & lightness of web applications will be measured in comparison to typical web development techniques.

Speakers
avatar for Damien Buhl

Damien Buhl

Software Developer, nxxm
Damien is an enthusiast software developer with a strong focus on C++ & Javascript. Leading development & product releases with tight schedules in an 100 years old IoT and Building Automation company in beautiful Basel, Switzerland. Open Source contributor of Boost.Fusion and creator... Read More →



Thursday September 27, 2018 15:50 - 16:20
Steamboat (403)
 
Friday, September 28
 

08:00

Run-Time Polymorphism BoF
A thread has run through several talks this week (and one poster): Run-Time Polymorphism. In particular, how can we achieve the benefits of RTP without all the baggage of inheritance?

Several conversations have started, but we can bring those together, draw more people into them and decide how we can continue them. If you were interested in Dynamic, or yomm2, or Data-Oriented Design, or Funky Pools, or anything else related to RTP , please consider joining us.

Moderator
avatar for Norman Birkett

Norman Birkett

Financial Engineer, Ion Group / Reval
Automated regression testing; Unit tests; TDD; C++ test harnesses; Improving legacy codebases; Functional Programming

Friday September 28, 2018 08:00 - 08:45
Steamboat (403)