重構 (Refactoring) 學習心得筆記 – 壞味道 (Bad Smell / Code Smell)

20201205223013 17

何謂壞味道 (Bad Smell / Code Smell) 程式中需要進行重構的部分,被稱為壞味道或程式碼臭味 (Bad Smell / Code Smell) 當程式中有下列這些問題時,就可能存在壞味道: 難以理解 例:函式、類別名稱名命太籠統不明確;程式碼太長,或函式做太多事;Magic Number之類的神秘數 …

繼續閱讀