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

  Рет қаралды 4,703

CppCon

CppCon

Күн бұрын

CppCon.org
-
Presentation Slides, PDFs, Source Code and other presenter materials are available at: github.com/CppCon/CppCon2018
-
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.
-
Videos Filmed & Edited by Bash Films: www.BashFilms.com
*-----*
Register Now For CppCon 2022: cppcon.org/registration/
*-----*

Пікірлер: 15
@VivekNa
@VivekNa 5 жыл бұрын
That dynamic hot patching is amazing - this is as close to the convenience of a scripting language as you could get in C++
@zhaoli2984
@zhaoli2984 5 жыл бұрын
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?
@OperationDarkside
@OperationDarkside 5 жыл бұрын
I think, I didn't get it. Is it faster than virtual function calls? Maybe I need another look at it.
@llothar68
@llothar68 5 жыл бұрын
No it's slower because it's more flexible to use. I guess you don't know ruby or objective-c or any other modern script language with flexible object system. You can dynamically do things that look like changing the objects class type on the fly. And having a multiple inheritance system that is used like duck typing. As borislav said, you might need it or might not.
@OperationDarkside
@OperationDarkside 5 жыл бұрын
@@llothar68 Thank you. I haven't used the languages you mentioned. I really need to look it up, to understand it.
@jokinglimitreached1503
@jokinglimitreached1503 5 жыл бұрын
this seems interesting. I'm concerned about the quality of the library if it's made by one person
@onqtam
@onqtam 5 жыл бұрын
I'm not sure if I should take into account your nickname :D The internet is full of projects spread across the quality spectrum - from extremely high quality all the way down to dog#$&* (probably the majority) - regardless if they are made by one person or not. That is where our capacity for reason comes in - we should use our heads to evaluate each project on a case by case basis. Have a look at the code on GitHub - I'm one of its users and I've dug into it a number of times to propose improvements and I can say without a doubt - this is some of the most readable and well written C++ I've encountered.
@jokinglimitreached1503
@jokinglimitreached1503 5 жыл бұрын
@@onqtam и аз съм българин, предполагам че сте по името. I'm still a student so I can't really evaluate a library myself, but I really like the ideas in DynaMix. If the library could get evaluated by a committee or trusted developers, I would like to use it in my future career. (btw, my name is a joke, and each comment should be looked at case by case if it's sarcasm or not :) )
@onqtam
@onqtam 5 жыл бұрын
@@jokinglimitreached1503 Touché :D As far as being reviewed - it proved to be hard to grasp (it cannot be explained in a single sentence such as a "library for signals/threading/processes") and when it was submitted for peer-review to boost it was neglected for a few years until Borislav gave up on the idea. A review of this library would require more effort compared to most other libraries - this entire talk is just about the "What" and "Why" behind the creation of dynamix - the "How" (the implementation) is a longer discussion.
@bstanimirov
@bstanimirov 5 жыл бұрын
@@jokinglimitreached1503 Yes. Sadly no Boost committee member dared to review it :) Still, as I mentioned in the talk, the library has had its real world usages. There are teams out there who have reviewed the library and deemed it appropriate for their needs. This can be thought of as a committee, I guess. I would even dare to say that being used in a real world project is a more credible testament to the usability than a review, however thorough, done in isolation for the review's sake. Also there's this thing called MeetingC++ Certified Libraries. Sadly it's not popular, but nevertheless the library was reviewed there and was approved: meetingcpp.com/CertifiedLibraries/
@jokinglimitreached1503
@jokinglimitreached1503 5 жыл бұрын
@@bstanimirov Amazing! Thank you for answering. Късмет с популяризирането на DynaMix към повече девелопъри
@ace100hyper3
@ace100hyper3 5 жыл бұрын
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!
@bstanimirov
@bstanimirov 5 жыл бұрын
The use case is dynamic polymorphism. Component systems, as in entity-component-system, is not polymorphic. If you try using it to achieve dynamic polymorphism, you will end up with something similar to this library. For example the Interface to Component pattern or... pretty much this library. But yeah, I know people who hate duck typing and dynamic polymorphism exist and I can't change their mind. Religion is rampant in software development. Que sera sera
小路飞姐姐居然让路飞小路飞都消失了#海贼王  #路飞
00:47
路飞与唐舞桐
Рет қаралды 95 МЛН
ONE MORE SUBSCRIBER FOR 6 MILLION!
00:38
Horror Skunx
Рет қаралды 14 МЛН
CppCon 2018: Dan Saks “Making New Friends”
1:01:32
CppCon
Рет қаралды 9 М.
CppCon 2018: Fedor Pikus “Design for Performance”
1:03:40
What is a Monad? - Computerphile
21:50
Computerphile
Рет қаралды 591 М.
CppCon 2018: Andrei Alexandrescu “Expect the expected”
58:58
CppCon 2018: Richard Powell “How to Argue(ment)"
54:10
CppCon
Рет қаралды 11 М.
CppCon 2018: Jason Turner “Applied Best Practices”
1:03:19