3
3
Clean Code concepts adapted for TypeScript.
4
4
Inspired from [ clean-code-javascript] ( https://github.com/ryanmcdermott/clean-code-javascript ) .
5
5
6
+ 将代码整洁的理念适配至 TypeScript , 灵感来自于[ 代码整洁的 JavaScript ] ( https://github.com/ryanmcdermott/clean-code-javascript ) 。
7
+
6
8
## Table of Contents
7
9
8
10
1 . [ Introduction] ( #introduction )
@@ -17,6 +19,20 @@ Inspired from [clean-code-javascript](https://github.com/ryanmcdermott/clean-cod
17
19
10 . [ Formatting] ( #formatting )
18
20
11 . [ Comments] ( #comments )
19
21
22
+ ## 目录
23
+
24
+ 1 . [ 简介] ( #简介 )
25
+ 2 . [ 变量] ( #变量 )
26
+ 3 . [ 函数] ( #函数 )
27
+ 4 . [ 对象和数据结构] ( #对象和数据结构 )
28
+ 5 . [ 类] ( #类 )
29
+ 6 . [ SOLID] ( #solid )
30
+ 7 . [ 测试] ( #测试 )
31
+ 8 . [ 并发] ( #并发 )
32
+ 9 . [ 错误处理] ( #错误处理 )
33
+ 10 . [ 格式化] ( #格式化 )
34
+ 11 . [ 评论] ( #评论 )
35
+
20
36
## Introduction
21
37
22
38
![ Humorous image of software quality estimation as a count of how many expletives
@@ -45,9 +61,29 @@ shaped into its final form. Finally, we chisel away the imperfections when
45
61
we review it with our peers. Don't beat yourself up for first drafts that need
46
62
improvement. Beat up the code instead!
47
63
48
- ** [ ⬆ back to top] ( #table-of-contents ) **
64
+ ## 简介
65
+
66
+ ![ 一张用你阅读代码时吐槽的数量来评估软件质量的搞笑图片] ( https://www.osnews.com/images/comics/wtfm.jpg )
67
+
68
+ 将源自 Robert C. Martin 的 [ * Clean Code* ] ( https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882 )
69
+ 的软件工程原则适配到 TypeScript 。 这不是一个代码风格指南, 它是一个使用 TypeScript 来生产
70
+ 可读的, 可重用的, 以及可重构的软件的指南。
71
+
72
+ 这里的每一项原则都不是必须遵守的, 甚至只有更少的能够被广泛认可。 这些仅仅是指南而已, 但是却是
73
+ * Clean Code* 作者多年经验的结晶。
74
+
75
+ 我们的软件工程行业只有短短的 50 年, 依然有很多要我们去学习。 当软件架构与建筑架构一样古老时,
76
+ 也许我们将会有硬性的规则去遵守。 而现在, 让这些指南做为你和你的团队生产的 TypeScript 代码的
77
+ 质量的标准。
78
+
79
+ 还有一件事: 知道这些指南并不能马上让你成为一个更加出色的软件开发者, 并且使用它们工作多年也并
80
+ 不意味着你不再会犯错误。 每一段代码最开始都是草稿, 像湿粘土一样被打造成最终的形态。 最后当我们
81
+ 和搭档们一起审查代码时清除那些不完善之处, 不要因为最初需要改善的草稿代码而自责, 而是对那些代
82
+ 码下手。
83
+
84
+ ** [ ⬆ 返回目录] ( #目录 ) **
49
85
50
- ## Variables
86
+ ## Variables
51
87
52
88
### Use meaningful variable names
53
89
0 commit comments