设计模式 - 创建型 - 单例模式 发表于 2025-07-02 更新于 2025-07-03 分类于 Engineering 本文字数: 1.2k 阅读时长 ≈ 1 分钟 类型 Type 创建型 Creational 含义 IntentThe intent of the singleton pattern is to ensure that a class only has one instance, and to provide a global point of access to it. 阅读全文 »
代码整洁之道 - 函数 发表于 2025-06-30 更新于 2025-08-07 分类于 Engineering 本文字数: 4.3k 阅读时长 ≈ 4 分钟 短小 Small函数的第一条规则是要 短小,第二条规则是要 更短小 20 行封顶最佳 例子: 1234567public static String renderPageWithSetupsAndTearDowns(PageData pageData, boolean isSuite) throws Exception{ if (isTestPage(pageData)) { includeSetupAndTeardownPages(pageData, isSuite); } return pageData.getHtml();} 阅读全文 »
代码整洁之道 - 有意义的命名 发表于 2025-06-29 更新于 2025-08-07 分类于 Engineering 本文字数: 2k 阅读时长 ≈ 2 分钟 名副其实 Use Intention-Revealing Names如下是较好的例子(既有计量对象,也有计量单位): 1234int elapsedTimInDays;int daysSinceCreation;int daysSinceModification;int fileAgeInDays; 阅读全文 »