# Refactoring: Improving the Design of Existing Code * 這本書可以讓 object-oriented code 變得更簡單維護 * 除了介紹 refactoring 外也提供許多改善 code 的小技巧 * 前面章節強調測試的重要性因為改善 code 後需要知道是否正常運作,接著討論完如何察覺 code 的 bad smell 後就會進入如何 refactoring 的技巧並提供改善前與改善後的 code 跟解釋 * Topics Covered: Refactoring, improving software code, redesign, design tips, patterns, unit testing, refactoring research, and tools. ## Foreword * Refactoring 讓 code 保持可讀性與易於維護 * Refactoring 是有危險性的,為了避免覆水難收的情況需要有系統性的 refactoring * 本書介紹 refactoring 的原則與 best practice 以及 refactoring 的時機 * 本書介紹的 refactoring 技巧可以一次改善一點點減少風險,所以可以將這些技巧馬上拿來用 ## Preface ### What is Refactoring? * Refactoring 是個在不改變外部的行為的前提下改善內部程式結構的過程 * 雖然 code 先寫好在 design 有點奇怪的過程,但 code 總是在工程師的 hack 之下慢慢沉淪 * 透過 refactoring 可以將 bad design 重製成 well-designed code,一點一滴的 refactoring 最終累積起來可以從根本上改善設計 ## What's in this book? * 這本書目標是提供可控制及有效的 refactoring,在不產生 bug 的同時有方法的改善內部結構 * Chapter 1 提供許多 example,把常見有設計缺陷的程式改成更 object-oriented 的程式 * Chaper 2 包含許多 refactoring 的通用性原則跟需要做 refactoring 的理由 * Chapter 3 描述如何找到 bad smell 並且透過 refactoring 改善 * Chapter 4 教導如何使用 Java testing framework 來測試 code * Chapter 5~12 是本書的核心,包含作者從以前到現在的心得, * Chapter 13~15 介紹其他人的研究心得 ###### tags: `reading`