Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when is IInterface necessary? #1

Open
xbaosong opened this issue Apr 2, 2023 · 1 comment
Open

when is IInterface necessary? #1

xbaosong opened this issue Apr 2, 2023 · 1 comment

Comments

@xbaosong
Copy link

xbaosong commented Apr 2, 2023

I have a question regarding the necessity of class IInterface.
As mentioned in the doc, all objects must implement IInterface, but on the other hand, all components must also implement IComponent. So, doesn't it make more sense to let IComponent inherite from IInterface?
Therefore simpler to just merge IInterface into IComponent?

Ps: I looked into the project pingnoo, seems IInterface is not used anyway.

@fizzyade
Copy link
Member

fizzyade commented Apr 2, 2023

As per the comment and also written in the README.md file it's for adding future functionality system wide.

By having IInterface you have a common base defined for every object in the component system.

With IInterface being the root object it is very easy to add new common behaviour across all objects, not just components, conversely if IInterface doesn't exist then it would be considerably more effort to do it.

It doesn't add any complexity to anything.

If you remove IInterface from IComponent then you break the common ancestor for all objects inside the component system.

    /**
     * @brief       The IInterface class is the root level object for all objects.
     *
     * @details     All objects that reside in the component system should inherit this interface for future
     *              compatibility.
     *
     * @class       Nedrysoft::ComponentSystem::IInterface IInterface.h <IInterface>
     */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants