@@ -285,6 +285,52 @@ See also:
285
285
286
286
* [[LEAST-POWER]]
287
287
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
+
288
334
<h3 id="name-thoughtfully">Name things thoughtfully</h3>
289
335
290
336
Name APIs with care.
0 commit comments