Skip to content

Commit 86be0ac

Browse files
LeaVerouhobercynthia
authored
Add text for low-level vs high-level APIs (related to #117) (#291)
* Add text for low-level vs high-level APIs (related to #117) * Update index.bs Co-authored-by: Theresa O'Connor <[email protected]> * Update index.bs Co-authored-by: Theresa O'Connor <[email protected]> * Reorder sentences, per @hober's feedback * Remove old paragraph * Remove "disproportionately" per @cynthia's syggestion Co-authored-by: Sangwhan "fish" Moon <[email protected]> * Update index.bs Co-authored-by: Sangwhan "fish" Moon <[email protected]> * Emphasize font picker accessibility and privacy As requested by @atanassov Co-authored-by: Theresa O'Connor <[email protected]> Co-authored-by: Sangwhan "fish" Moon <[email protected]>
1 parent e28ac9f commit 86be0ac

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

index.bs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,52 @@ See also:
285285

286286
* [[LEAST-POWER]]
287287

288+
<h3 id="high-level-low-level">Resolving tension between high level and low level APIs</h3>
289+
290+
<!--
291+
See "High level or low-level APIs?"
292+
https://github.com/w3ctag/design-principles/issues/117
293+
-->
294+
295+
High-level APIs allow user agents more ability to
296+
intervene in various ways [on behalf of the user](#priority-of-constituencies),
297+
such as to ensure accessibility, privacy, or usability.
298+
299+
<div class=example id=font-enumeration>
300+
301+
A font picker (high level API)
302+
[was recommended by the TAG](https://github.com/w3ctag/design-reviews/issues/399)
303+
over a Font Enumeration API (low level API)
304+
as it addresses the bulk of use cases,
305+
while preserving user privacy,
306+
as it is free from the the fingerprinting concerns that accompany
307+
a general Font Enumeration API.
308+
A native font picker also comes with accessibility built-in,
309+
and provides consistency for end users.
310+
311+
</div>
312+
313+
Low-level APIs afford authors room for experimentation
314+
so that high level APIs can organically emerge
315+
from usage patterns over time.
316+
They also provide an escape hatch when the higher-level API
317+
is not adequate for the use case at hand.
318+
319+
Lower level building blocks cannot always be exposed as Web APIs.
320+
A few possible reasons for this are
321+
to preserve the user's security and privacy,
322+
or to avoid tying Web APIs to specific hardware implementations.
323+
However, high level APIs should be designed in terms of
324+
building blocks over lower level APIs
325+
whenever possible.
326+
This may guide decisions on how high level the API needs to be.
327+
328+
A well-layered solution should ensure continuity
329+
of the ease-of-use vs power tradeoff curve
330+
and avoid sharp cliffs
331+
where a small amount of incremental use case complexity
332+
results in a large increase of code complexity.
333+
288334
<h3 id="name-thoughtfully">Name things thoughtfully</h3>
289335

290336
Name APIs with care.

0 commit comments

Comments
 (0)