CppCon 2018: Borislav Stanimirov “DynaMix: A New Take on Polymorphism”

preview_player
Показать описание


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.

Borislav Stanimirov, Bulgaria

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 languages.


*-----*
*-----*
Рекомендации по теме
Комментарии
Автор

That dynamic hot patching is amazing - this is as close to the convenience of a scripting language as you could get in C++

VivekNa
Автор

Nice, my favorite of CppCon2018 so far (haven't finished all of them). Does the library use function pointers underneath and stores them in a 2D array, then those macros are used to invoke the right function?

zhaoli
Автор

I think, I didn't get it. Is it faster than virtual function calls? Maybe I need another look at it.

OperationDarkside
Автор

this seems interesting. I'm concerned about the quality of the library if it's made by one person

jokinglimitreached
Автор

I'm sorry but these ideas are just bad on a conceptual level.
People don't use scripting languages because of their loose take on OOP. That's just lying nonsense. They use them for fast iteration time, simplicity and because users cannot mess with memory. Those users don't necessarily know what OOP is.
* Duck typing interfaces are horrible. Never use this. Interfaces are the specification, otherwise you're programming by convention.
* Dynamic mixins have no business in a statically typed language. They are a way to monkey patch functionality for flimsy dynamic languages.
* This library basically takes a perfectly fine static language and turns it into dynamic poop. You are trading compile time errors for runtime errors.
* UFCS is the worst thing ever. It's a confusing way to achieve nothing.
* The use case this is supposed to solve has been worked out, used and improved throughout the past 20 years in game development. It's called Component System, search for it.
Yuck!

acehyper