Weitere ähnliche Inhalte Ähnlich wie 優化開發環境 無料提升戰鬥力 (20) Kürzlich hochgeladen (20) 優化開發環境 無料提升戰鬥力2. Maxis Kao
➔ Software Engineer at Yahoo
➔ Top Hack of Yahoo TW/JP Joint Hackday
➔ Winner of Yahoo Bot Challenge
9. ⾓角⾊色 / 需求
• RD:程式
• PM:時程
• Company:成本 + ⾵風險
• Client:產品
11. 很久很久以前
• PM:明天新功能上線!
• RD 1:⼤大部份都做好了,等等跟 RD 2 合併
• RD 2:我只差剩下的⼀一些⼩小 bug 待會修⼀一下就好
• QA:看起來還⾏行,但疑似有些 bug 無法重現 (reproduce)
• PM:沒關係,晚上衝⼀一下!明天開⼼心上線
13. RD
• RD 1:我們來合⼀一下 code
[ 經過漫⻑⾧長的半⼩小時,解 conflict ]
• RD 2:奇怪為什麼我的電腦上有錯你的沒有
• RD 1:等等!我現在⼜又跑出奇怪的 bug,先來速速解⼀一下
25. M A C B O O K P R O
蘋 果
I P H O N E
寫 很 滿 的 筆 記 本
搖 滾 樂 + 莫 扎 特
便 宜 的 咖 啡
在 講 設 計 的 書
很 普 通 的 鉛 筆
⼤大 桌 ⼦子
密 密 ⿇麻 ⿇麻 像 駭 客 ⼀一 樣
I K E A 的 檯 燈
39. “10+ Deploys per Day
Dev and Ops Cooperation at flickr”
- John Allspaw and Paul Hammond
45. – an angry ops guy
“It’s not my machines,
it’s your code!”
46. – an angry dev guy
“It’s not my code,
it’s your machines!”
49. DevOps key points
• automated infrastructure (⾃自動化集成)
• shared version control (共⽤用程式碼)
• one step build and deploy (持續建構/部署)
• feature flags (主幹開發)
• shared metrics (不藏私)
• IRC and IM robots (信息整合)
50. A survey
• 來源: RightScale
• 受訪者: 1,060 資訊⼈人員
• 42% 就職於超個 1,000 ⼈人的⼤大公司
83. – SJ Chou, Senior Engineer at Foxconn
“有事沒事就把⼤大家寫的 code 合起來
跑看看有沒有錯”
持續 整合
84. – SJ Chou, Senior Engineer at Foxconn
“有事沒事就把⼤大家寫的 code 合起來
跑看看有沒有錯”
持續 整合
85. – SJ Chou, Senior Engineer at Foxconn
“有事沒事就把⼤大家寫的 code 合起來
跑看看有沒有錯”
持續 整合
97. Long Parameter List.
Divergent Change.
Shotgun Surgery.
Feature Envy.
Data Clumps.
Primitive Obsession.
Switch Statements.
Parallel Inheritance Hierarchies.
Lazy Class.
Speculative Generality.
Temporary Field.
Message Chains.
Middle Man.
Inappropriate Intimacy.
Alternative Classes with Different Interfaces.
Incomplete Library Class.
98. Bad smells
• Duplicated Code
• Long Method / Large Class
• Long Parameter List
• Switch Statements
• Indecent Exposure
• Feature Envy
• Comments
100. Long Method / Large Class
• ⼀一個 main() 上萬⾏行
• 負擔過多責任
• Extract Class / Subclass / Interface
101. Long Parameter List
• Hard to understand
• Inconsistent
• set
(a,
b,
c,
x,
y,
z,
flag,
amount)
• set
(a,
b,
c,
y,
x,
z,
flag,
amount)
105. Comments
/*
*
This
is
a
add
function,
returns
a
+
b
*/
function
kerker
(a,
b){
return
a
+
b;
}
106. Comments
/*
*
Returns
a
+
b
*/
function
add
(a,
b){
return
a
+
b;
}
115. – SJ Chou, Senior Engineer at Foxconn
“有事沒事就把⼤大家寫的 code 合起來
跑看看有沒有錯”
持續 整合
116. version control
• 根據定義,可以⽤用以下 check list 判斷是否 version control
Version Control check list:
[ ] record changes over time
[ ] recall a specific version
117. version control
• 根據定義,可以⽤用以下 check list 判斷是否 version control
Version Control check list:
[v] record changes over time
[v] recall a specific version
126. * fde679b
-‐
very
hot
fix
<allen>
* d0ad381
-‐
Kerker.
<maxis>
* f007579
-‐
test
<jason>
* 09b9813
-‐
fix
bug.
<maxis>
* 2430918
-‐
fix
bugs
<allen>
* fde679b
-‐
abc123
<jason>
* b6c7ee1
-‐
hot
fix
<allen>
128. 7 rules of a great commit message
• Separate subject from body with a blank line
• Limit the subject line to 50 characters
• Capitalize the subject line
• Do not end the subject line with a period
• Use the imperative mood in the subject line
• Wrap the body at 72 characters
• Use the body to explain what and why vs. how
129. * fde679b
-‐
Fix
typo
in
the
Search
Box
<allen>
* d0ad381
-‐
Revamp
Search
Box
UI
<maxis>
* f007579
-‐
Add
new
Search
Box
UI
<jason>
* 09b9813
-‐
fix
bug.
<maxis>
* 2430918
-‐
fix
bugs
<allen>
* fde679b
-‐
abc123
<jason>
* b6c7ee1
-‐
hot
fix
<allen>
134. • Training - Ninja Kata
• DevOps - Docker
• CI/CD - Jenkins