Archived

This forum has been archived. Please start a new discussion on GitHub.

facets versus CORBA multiple inheritance

I think I've developed a general question about facets that comes down to:

In which ways does facets represent something very functionally different from CORBA multiple inheritance?

From what I have been reading and working with, it looks like the difference is that there are multiple interfaces for registering, managing, and retrieving objects based off facet id. But none of this affects the ability to cast an object once you've gotten hold of it.

Thanks,

Comments

  • bernard
    bernard Jupiter, FL
    Ice supports multiple inheritance of interfaces (like CORBA and Java): facets are not a substitute for multiple inheritance.

    If you want to add a new interface to one of your objects, you have 3 options:
    • add this new interface to your interface inheritance hierarchy (for example to the most derived interface)
    • add a facet
    • reconsider and create a separate object (often the best approach)

    Augmenting the inheritance hierarchy is not always feasible or elegant. You could have a conflict in operation name, and lots of interfaces could make the implementation of the servant really complicated (especially if you want to reuse code from "base" implementations). And sometimes you want to keep your inheritance trees separate ... for example, say you have:
    module Store
    {
       interface Cart
       {
           void checkout();
       };
    };
    

    and you want to support the new version, Store2, with the same objects:
    module Store2
    {
       interface Cart
       {
           void checkout(bool oneClick);
       };
    };
    
    Even if you could use inheritance, it would not make sense!

    Facets also allow you to add interfaces dynamically to an object (no need to change the entire type of your object and recompile the slice definitions). Don't abuse this feature however: if you end up creating lots of facets dynamically, you're probably better off with new separate objects.

    Cheers,
    Bernard
  • thanks

    thanks, bernard.

    my interest came from security related issues. i was hoping that facets also allowed segmented authorized access. so that users could share the same object with different priveledges. {user A can use an objects services, user B can use services or stop the object from processing requests}

    seth