Home

Awesome

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:

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:

Created with DynaMix

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

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