Tennis refactor kata
在github裡找到 一個不錯的Refactor kata
連結:https://github.com/emilybache/Tennis-Refactoring-Kata
基本上透過下列方法大概都能解決問題
- inline variable
- rename variable
- extract function
有趣的事情是原本很簡單的三個題目練習,在看過 Refactoring Principles 的Question後,才會想到如何比較平順地套用在目前的工作場合中
PS 超喜歡第一題:(True/False) Refactoring work should be planned and prioritized alongside user stories for the sprint.
搭配另一篇文章就更好玩了:4 Steps to Persuade a Product Owner to Prioritize Refactoring,
但是我還沒感受過refactor是團隊的事情就是了
有一個有趣的練習:Refactoring without tools
就算拿著eclipse的情況下也非常難寫,這時候就會發現91哥的極速開發課程很重要XD (eclipse已經不太適合在工作上使用了),不過這個練習很明確的說明工具的重要性,以更安全的方式很重要!
What's Next?
目前練習方式都是把Code改成自己喜歡的樣子,接下來會直接只做有問題的Code Smell好好的把Martin Flower說的Code Smell指出來