Question

Is an interface supposed to have the same members on all objects? Or is it OK for different objects to have different interfaces with the same name?

Was it helpful?

Solution

It won't technically break anything to have interfaces of the same name do different things in different objects. BUT, for the sake of clarity, if you have two objects and they both have an interface with the same name, it would make sense if both of those interfaces were the same.

Kind of like how all objects (as far as I know) have an interface named org.freedesktop.DBus.Introspectable and those interfaces all do the same thing regardless of which object they are contained in.

There is really nothing to be gained by doing it the way you're asking. It only adds confusion if you or anybody has to remember that my-interface behaves one way in object-A and behaves differently object-B. I'd give the interfaces names describing what they do. You'll be glad you did.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top