ProductPromotion
Logo

C++ Programming

made by https://0x3d.site

GitHub - iboB/dynamix: :fish_cake: A new take on polymorphism
:fish_cake: A new take on polymorphism. Contribute to iboB/dynamix development by creating an account on GitHub.
Visit Site

GitHub - iboB/dynamix: :fish_cake: A new take on polymorphism

GitHub - iboB/dynamix: :fish_cake: A new take on polymorphism

DynaMix

Language Standard License Build

IMPORTANT v2 is here. It is a big change. The last v1 release was v1.4.0

DynaMix (Dynamic Mixins) is an alternative take on object oriented programming and dynamic polymorphism. It lets users compose and modify polymorphic objects at run time. The main target language is C++, but C is also supported.

The library is a means to create a project's architecture rather than achieve its purpose. It helps with extensibility, readability, scalability and interoperability. It focuses on maximal performance and minimal memory overhead.

DynaMix is applicable for the software architecture of systems with complex objects including, but not limited to:

  • Games (especially role-playing ones or strategies)
  • CAD systems
  • Enterprise systems

The library uses the type dynamix::object as a placeholder, whose instances can be extended with existing classes (mixins), thus providing a particular instance with the mixin features of all those types. Likely the most important types of mixin features are messages: functional objects which in C++-OOP terms can be thought of as methods. Mixin features are overridable and use late binding and singular dispatch. Unicasts and multicasts are possible.

Here is a small example of what code may look like using the library:

    // assuming my_objects.get_ally(0); is a way to get an ally to the
    // main character in a game
    dynamix::object& obj = my_objects.get_ally(0);

    // now let's make the object think some positive thoughts about the
    // main character

    think(obj); // C++ doesn't allow us to have obj.think().
                // DynaMix's messages are like standalone functions

    // composition
    mutate(obj, dynamix::add<flying_creature>());

    // object can now respond to fly()

    fly(obj); // ...instead of obj.fly()

    // mutation
    mutate(obj
        , dynamix::remove<ally>()
        , dynamix::add<enemy>()
    );

    think(obj); // the same object now thinks negative thoughts about the main
                // character, since it's no longer an ally, but an enemy

Here are some of the key features of the library:

  • Compose objects from mixins at run time
  • Physically separate interface and implementation
  • Non-intrusive – mixins don't need to have a common parent or any special code inside
  • Mutate "live" objects by changing their composition at run time
  • Use std::polymorphic_allocator to allow fine-tuning allocations and achieving cache locality in critical parts of the code
  • Create shared libraries and plugins which can enrich or modify objects, without modifying (or even rebuilding) the executable.
  • Add "hotswap" to a project while developing
  • Have complete runtime reflection by symbols or strings
  • Messages:
    • Fast polymorphic calls – comparable to std::function
    • Have multicast messages, which are handled by many mixins within an object
    • Thread safe message calls – as thread safe as the underlying methods.

Created with DynaMix

The following projects are known to use DynaMix as a key piece of their software architecture:

  • A3I by ViewRay (Released 2022) - A medical system for cancer treatment. Uses v2
  • huse - a polymorphic serialization library. Uses v2
  • Heroes of the Dark by Gameloft (Released 2021) - An RPG for Android, iOS, and Windows. Uses v1
  • War Planet Online: Global Conquest by Gameloft (Released 2017) - An MMORTS for mobile devices and PCs. Uses v1
  • Blitz Brigade: Rival Tactics by Gameloft (Released 2017) - A multiplayer RTS for Android, iOS, and Windows. Uses v1
  • Swords & Crossbones: An Epic Pirate Story by Epic Devs LLC (Released 2014) - A strategy/exploration game for Android, iOS, and PC. Uses v1
  • Earthrise by Masthead Studios (Released 2011) - An MMORPG (no longer supported). Uses an early proprietary prototype version of the library with a similar interface and a different implementation.

Documentation

The documentation is part of the repo in the doc/ directory.

Contributing

Contributions in the form of issues and pull requests are welcome.

License

License

This software is distributed under the MIT Software License.

See accompanying file LICENSE or copy here.

Copyright © 2013-2024 Borislav Stanimirov, Zahary Karadjov

Logo

License: CC BY 4.0.

The DynaMix logo is licensed under a Creative Commons Attribution 4.0 International License. Copyright © 2018 area55git

V1

DynaMix v2 is a complete rewrite and though it has the same idea as v1, it is incompatible with it, and has a different interface, and different implementation for most features, and different terminology for some.

The last release of DynaMix v1 was v1.4.0. The documentation is available here

A list of the most notable differences between v1 and v2 can be found here.

Boost.Mixin

DynaMix was initially developed as Boost.Mixin but is now a separate library that doesn't depend on the Boost libraries Collection.

Footer

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory