org.fd.DBus.Introspectable.EnumerateObjects()
Thiago Macieira
thiago at kde.org
Thu May 13 06:31:53 PDT 2010
Em Quinta-feira 13. Maio 2010, às 13.17.04, David Zeuthen escreveu:
> > But I don't like giving people the ability to search for an interface.
> > That will lead to bad client code instead.
>
> [Citation needed] (I, for one, don't agree with your assertion. But,
> hey, I could be convinced if there's a good example....)
>
> Btw, if we wanted to make things more complicated, we *could* replace
> Lennart's interface string with a D-Bus Match Rule since it is already
> designed to match things. But I think that's a bit too much to require
> each client and/or binding to implement support for that. But it _is_
> more generic! :-)
Explanation:
For the past 4 years, I've been telling people that they have to know the
interface that they are talking to, including which objects it may be found
in. They must not scan running applications to find if an interface is present.
Or, alternatively, they add a method call to return a list of paths. But
that's exactly my recommendation looked from another angle: there's a well-
known interface, at a well-known path, that returns information you want.
But in this case, it's for a specific purpose.
Adding a method that returns all object paths that implement a given interface
is, in my opinion, a bad idea. It will lead to people writing client code that
scans applications for an interface, instead of thinking their problem
through. Worse, it may lead to people scanning ALL running programs for
existing instances of an interface. And there's an inherent race condition
involved: the object may disappear right after the call.
So, in summary: I like the splitting of dynamic information (the list of sub-
objects) from mostly-static information, the interface list.
If you want to take this one step further, you may also want to decouple the
many interfaces from one another. Add a method to
org.freedesktop.DBus.Introspectable that returns a list of strings, one with
the XML of each interface, instead of one big string with all interfaces
concatenated.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Senior Product Manager - Nokia, Qt Development Frameworks
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20100513/9ada9259/attachment.pgp>
More information about the dbus
mailing list