docs(note): 补充技术笔记和主题配置

- Go map Swiss Table 实现说明
- MarkText 仿 onelight 暗色主题
- 布尔变量命名规范
- 更新网址收藏及跟踪 assets 资源
This commit is contained in:
张育新
2026-07-21 17:53:15 +08:00
parent a1156d6977
commit d4cad276e3
6 changed files with 501 additions and 3 deletions
+17
View File
@@ -0,0 +1,17 @@
## 命名规则
> [《布尔变量起名的艺术》](https://thatamazingprogrammer.com/posts/stop-naming-your-variables-flag-the-art-of-boolean-prefixes/)
### 使用正确的前缀
(1)**is**:描述事物的状态,后面跟形容词,比如 isActive,isDeleted,isEmpty。
(2)**has**:描述事物的所有权或包含关系,后面跟名词,比如 hasAccess,hasChildren,hasValidationErrors。
(3)**can**:描述事物的能力或权限,比如 canEdit,canDelete,canRetry。
(4)**should**:描述事物的意图或逻辑,比如 shouldRetry,shouldCacheResponse。
### 其他
永远不在布尔变量名中使用否定词,比如isDisabled,因为当使用在if语句中会让大脑进行双重否定运算