Bug 37095 - should be more explicit about the reversed-domain-name convention
Summary: should be more explicit about the reversed-domain-name convention
Status: RESOLVED FIXED
Alias: None
Product: dbus
Classification: Unclassified
Component: core (show other bugs)
Version: 1.5
Hardware: All All
: medium normal
Assignee: Simon McVittie
QA Contact: D-Bus Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-11 01:54 UTC by Simon McVittie
Modified: 2016-10-01 15:33 UTC (History)
6 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Write about best-practices for interface names in the same place they're defined (2.57 KB, patch)
2011-05-17 09:11 UTC, Simon McVittie
Details | Splinter Review
[PATCH 2/9] Formally define a unique connection name and a well-known bus name (1.69 KB, patch)
2011-05-17 09:12 UTC, Simon McVittie
Details | Splinter Review
[PATCH 3/9] Describe best-practices for naming well-known bus names (2.14 KB, patch)
2011-05-17 09:12 UTC, Simon McVittie
Details | Splinter Review
[PATCH 4/9] Describe conventional naming of methods and signals (1.11 KB, patch)
2011-05-17 09:12 UTC, Simon McVittie
Details | Splinter Review
[PATCH 5/9] Describe conventional naming of errors (1.20 KB, patch)
2011-05-17 09:12 UTC, Simon McVittie
Details | Splinter Review
[PATCH 6/9] Briefly mention why to namespace object-paths (1.71 KB, patch)
2011-05-17 09:13 UTC, Simon McVittie
Details | Splinter Review
[PATCH 7/9] Remove the old, vague Naming Conventions section (1.23 KB, patch)
2011-05-17 09:13 UTC, Simon McVittie
Details | Splinter Review
[PATCH 8/9] Describe best practices for property names, and recommend against dash-separated-words (1.85 KB, patch)
2011-05-17 09:13 UTC, Simon McVittie
Details | Splinter Review
[PATCH 9/9] Cross-reference from the glossary to interface names etc. (1.71 KB, patch)
2011-05-17 09:14 UTC, Simon McVittie
Details | Splinter Review
spec: Recommend against using ‘/’ for object paths (1.72 KB, patch)
2016-10-01 11:27 UTC, Philip Withnall
Details | Splinter Review

Description Simon McVittie 2011-05-11 01:54:04 UTC
The D-Bus Specification says:

    D-Bus namespaces are all lowercase and correspond to reversed domain
    names, as with Java. e.g. "org.freedesktop" 

but this is currently quite well hidden, and nothing really defines what we mean by "namespace".

Under "Valid Object Paths", we should mention that it's conventional, and recommended, to start with a reversed domain name (for the reasons mentioned in <http://0pointer.de/blog/projects/versioning-dbus.html>, and so that you can implement several D-Bus APIs designed by different people in the same service).

Under "Valid Names", we should mention that it's conventional and strongly recommended to start with a reversed domain name.

Under "Bus Names" we should mention the same thing for well-known names.
Comment 1 Simon McVittie 2011-05-11 01:55:00 UTC
See also <http://lists.freedesktop.org/archives/xdg/2011-May/011943.html>
Comment 2 Simon McVittie 2011-05-17 09:11:43 UTC
Created attachment 46820 [details] [review]
Write about best-practices for interface names in the  same place they're defined

I'm deliberately using a hypothetical API from example.com, rather
than a real API, to avoid perpetuating these over-simplifications any
further than they've spread already:

- "namespaces start with org.freedesktop"
- "namespaces start with org"
- "interfaces are defined by their sole implementation"
- "services have one object implementing one interface"
- "interfaces always behave like classes"
- "interfaces are always noun phrases"
- "there is a freedesktop.org D-Bus API for screensavers"
Comment 3 Simon McVittie 2011-05-17 09:12:05 UTC
Created attachment 46821 [details] [review]
[PATCH 2/9] Formally define a unique connection name and a   well-known bus name
Comment 4 Simon McVittie 2011-05-17 09:12:19 UTC
Created attachment 46822 [details] [review]
[PATCH 3/9] Describe best-practices for naming well-known bus names
Comment 5 Simon McVittie 2011-05-17 09:12:32 UTC
Created attachment 46823 [details] [review]
[PATCH 4/9] Describe conventional naming of methods and signals
Comment 6 Simon McVittie 2011-05-17 09:12:48 UTC
Created attachment 46824 [details] [review]
[PATCH 5/9] Describe conventional naming of errors
Comment 7 Simon McVittie 2011-05-17 09:13:03 UTC
Created attachment 46825 [details] [review]
[PATCH 6/9] Briefly mention why to namespace object-paths
Comment 8 Simon McVittie 2011-05-17 09:13:22 UTC
Created attachment 46826 [details] [review]
[PATCH 7/9] Remove the old, vague Naming Conventions section

The defining instance of each namespaced term now contains notes on
conventional naming.
Comment 9 Simon McVittie 2011-05-17 09:13:46 UTC
Created attachment 46827 [details] [review]
[PATCH 8/9] Describe best practices for property names, and  recommend against dash-separated-words

Related to <https://bugs.freedesktop.org/show_bug.cgi?id=20948> whose
conclusion seemed to be that anything is allowed, but CamelCase is
considerably more interoperable.
Comment 10 Simon McVittie 2011-05-17 09:14:05 UTC
Created attachment 46828 [details] [review]
[PATCH 9/9] Cross-reference from the glossary to interface names  etc.
Comment 11 Lennart Poettering 2012-02-09 16:35:32 UTC
Looks all good to me. 

Might be good though to add an explicit blurb about that people should never use the object path "/" (or is that already mentioned somewhere?). But maybe that's something to bring up in a different bug?
Comment 12 Simon McVittie 2012-02-10 02:51:18 UTC
(In reply to comment #11)
> Looks all good to me. 

Thanks, fixed in git for 1.5.10.

> Might be good though to add an explicit blurb about that people should
> never use the object path "/"

Yeah, perhaps. Leaving this open, I'll write some wording if you don't get there first.
Comment 13 Philip Withnall 2016-10-01 11:27:20 UTC
Created attachment 126931 [details] [review]
spec: Recommend against using ‘/’ for object paths

As discussed in http://0pointer.de/blog/projects/versioning-dbus.html and in https://dbus.freedesktop.org/doc/dbus-api-design.html, un-versioned object paths make it hard to work out which interface a signal was emitted from.

Clarify this in the specification to try and avoid people making this mistake.
Comment 14 Simon McVittie 2016-10-01 15:33:43 UTC
Thanks, applied. Fixed in git for 1.11.6 (spec 0.29).


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.