@@ -24,6 +24,23 @@ Required IDs: using-http
2424
2525Link Defaults : html (dfn) queue a task/in parallel/reflect
2626</pre>
27+ <pre class="biblio">
28+ {
29+ "draft-ietf-oauth-sd-jwt-vc": {
30+ "href": "https://datatracker.ietf.org/doc/html/draft-ietf-oauth-sd-jwt-vc",
31+ "title": "SD-JWT-based Verifiable Credentials (SD-JWT VC)",
32+ "status": "Internet-Draft",
33+ "publisher": "IETF"
34+ },
35+ "vc-data-model-1.1": {
36+ "href": "https://www.w3.org/TR/vc-data-model-1.1/",
37+ "title": "Verifiable Credentials Data Model v1.1",
38+ "status": "REC",
39+ "publisher": "W3C",
40+ "deliveredBy": ["https://www.w3.org/groups/wg/vc"]
41+ }
42+ }
43+ </pre>
2744<pre class="link-defaults">
2845spec:css-cascade-5; type:dfn; text:inherit
2946spec:css2; type: property; text: line-height
@@ -3488,6 +3505,52 @@ While the best path forward may be to choose not to specify the feature,
34883505there is the risk that some implementations
34893506may ship the feature as a nonstandard API.
34903507
3508+ <h3 id="multiple-algorithms">Write only one algorithm to accomplish a task</h3>
3509+
3510+ When specifying how to accomplish a task, write a single algorithm to do it,
3511+ instead of letting implementers pick between multiple algorithms.
3512+ It is very difficult to ensure that
3513+ two different algorithms produce the same results in all cases,
3514+ and doing so is rarely worth the cost.
3515+
3516+ Multiple algorithms seem particularly tempting when defining
3517+ how to parse file formats,
3518+ but they are an equally bad idea in that context.
3519+
3520+ <div class="example" id="html-polyglot">
3521+
3522+ [[html-polyglot inline]] was an attempt to define a common subset of both XHTML and HTML
3523+ that could be parsed into equivalent DOM trees
3524+ using either the [[HTML#the-xhtml-syntax|XHTML parsing]]
3525+ or [[HTML#syntax|HTML parsing]] algorithm.
3526+ Authors who tried to use this syntax tended to produce documents
3527+ that actually only worked with one of the two parsers.
3528+
3529+ </div>
3530+
3531+ <div class="example" id="json-ld-polyglot">
3532+
3533+ The [[vc-data-model-1.1 inline obsolete]] and [[cid inline]] both endorse implementations
3534+ that use either JSON or JSON-LD to parse bytes into their data models.
3535+ Because JSON-LD provides many more ways
3536+ to assign properties to particular objects than JSON does,
3537+ these specifications had to add extra rules to both kinds of parsers
3538+ in order to ensure that each input document had exactly one possible interpretation.
3539+ [[vc-data-model-2.0 inline]] and [[draft-ietf-oauth-sd-jwt-vc inline]] fixed the problem
3540+ by defining different media types for JSON-LD vs JSON,
3541+ which means implementations are instructed to use exactly one of the algorithms.
3542+ The authors of [[cid inline]] have decided the extra specification work and testing
3543+ are acceptable prices to be able to allow both implementation strategies,
3544+ and they have partially mitigated the risks by explicitly stating that
3545+ if a single document can conformantly have multiple interpretations,
3546+ it's a specification bug.
3547+
3548+ </div>
3549+
3550+ Note: While [[rfc6838#section-6|structured suffixes]] define that
3551+ a document can be parsed in two different ways,
3552+ they do not violate this rule because the results have different data models.
3553+
34913554<h3 id="monkey-patching">Avoid monkey patching</h3>
34923555A <dfn export>monkey patch</dfn> layers new functionality on top of an existing specification in a way that extends, overrides, or otherwise modifies the existing specification's behavior.
34933556<a href="https://en.wikipedia.org/wiki/Monkey_patch">Monkey patching</a> <strong> is generally considered bad practice and should be avoided</strong> for the reasons listed below; but is sometimes unavoidable
0 commit comments