Avoid abbreviations generally (#600) · w3ctag/design-principles@9fc15ba
marcoscacere
·
2025-10-21
·
via Recent Commits to design-principles:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2199,6 +2199,7 @@ is a request, rather than a guarantee.
|
2199 | 2199 | <h3 id="string-constants">Use strings for constants and enums</h3> |
2200 | 2200 | |
2201 | 2201 | Use strings as the values for constants or sets of enumerated values. |
| 2202 | +See [[#naming-is-hard]] when choosing strings. |
2202 | 2203 | |
2203 | 2204 | Strings make it easier for developers to inspect values |
2204 | 2205 | and read code that uses those values. |
@@ -3825,7 +3826,7 @@ Names take meaning from:
|
3825 | 3826 | API naming *must* be done in easily readable US English. |
3826 | 3827 | Keep in mind that most web developers aren't native English speakers. |
3827 | 3828 | Whenever possible, names should be chosen that use common vocabulary |
3828 | | -a majority of English speakers are likely to understand when first encountering the name. |
| 3829 | +a majority of English speakers are likely to understand when first encountering the name. |
3829 | 3830 | |
3830 | 3831 | <div class="example"> |
3831 | 3832 | |
@@ -3836,6 +3837,9 @@ than `cardinality`.
|
3836 | 3837 | </div> |
3837 | 3838 | |
3838 | 3839 | Value readability over brevity. |
| 3840 | +Avoid abbreviations, |
| 3841 | +except in cases where an abbreviation is extremely common and easy to understand. |
| 3842 | +For example `UIEvent`, where "`UI`" stands for user interface. |
3839 | 3843 | Keep in mind, however, that |
3840 | 3844 | the shorter name is often the clearer one. |
3841 | 3845 | For instance, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。