web-platform-dx / web-features

Exploring how to present Web platform features adoptability
Apache License 2.0
336 stars 63 forks source link

Guideline for API names and descriptions #822

Open foolip opened 5 months ago

foolip commented 5 months ago

In https://github.com/web-platform-dx/web-features/pull/810 and https://github.com/web-platform-dx/web-features/pull/752 we have some names and descriptions that feel a bit quirky compared to how most resources talk about them.

Should the name be:

Should the description start with:

Considerations:

foolip commented 5 months ago

https://github.com/web-platform-dx/web-features/pull/762 is another feature we might want to revisit.

foolip commented 5 months ago

And https://github.com/web-platform-dx/web-features/pull/771, which I just merged with the description "The PressureObserver API ..."

ddbeck commented 4 months ago

OK, I've been thinking over this general problem of "never say API".

For feature names, I think we made the right choice: we do not want to create features that have the appearance of having "completed" an API. Suppose the Media Session API acquires new and interesting capabilities. A "media session" feature is still usable, even if the whole of the Media Session API is not implemented. Naming "Media Session API" makes it harder to draw that distinction.

That said, I'm thinking that "Device Posture API" or "Media Session API" would be very good groups (and will inevitably appear in snapshots).

That leaves descriptions: I'm more comfortable with descriptions being a moving target. So initially any feature could start with "The Special API does …" or similar. When follow-on features appear, those descriptions can change to reflect that without losing the stability of the feature name.

foolip commented 4 months ago

API in group names sounds reasonable, and groups would tend to more often match whole specs and their names. I've sent https://github.com/web-platform-dx/web-features/pull/861 for Web Speech API.

This does put additional pressure on capitalization though. "Web speech API" looks very opinionated about capitalization when we're taking extra steps to disagree with the spec name. Looking back at https://github.com/web-platform-dx/web-features/pull/549, I think most names aren't made worse with title capitalization. The borderline cases are where we've had to mint a name, and when capitalizing it makes it feel more "official" than it is, like "Background Gradients". But I think it will raise fewer eyebrows than our sentence capitalization.

We should still use sentence caps in descriptions I think, so there might be some new tricky cases there.

Allowing backticks in names would also help a bit to distinguish names that are entirely lowercase because they're syntax.

ddbeck commented 4 months ago

FWIW, I suggested lowercase names when there were no groups or snapshots. A big part of my motivation was maintenance: it's easier to be consistent with one, consistent rule. We longer have that anyway, so I'm less inclined to fight for it.

cc: @Elchi3 maybe you have a take on this.

ddbeck commented 4 months ago

Allowing backticks in names would also help a bit to distinguish names that are entirely lowercase because they're syntax.

It'd be good to talk to consumers about what they'd like to see from us on string formats, whether they'd prefer unformatted plaintext, Markdown, or HTML.

foolip commented 4 months ago

I think we should generate plaintext and HTML from Markdown, and publish only those, not the source Markdown. So both name and nameHTML, description and descriptionHTML.

foolip commented 4 months ago

Alternatively we make it part of an API, so that we can also support linking between features and generating the right descriptions given a URL template or something.