C# 重構

    2009年,Sean Chambers在其博客中發表了31 Days of Refactoring: Useful refactoring techniques you have to know系列文章,每天發佈一篇,介紹一種重構手段,連續發文31篇,故得名“重構三十一天:你應該掌握的重構手段”。此外,Sean Chambers還將這31篇文章【即31種重構手段】整理成一本電子書, 以下是博客原文鏈接和電子書下載地址:

       博客原文:http://lostechies.com/seanchambers/2009/07/31/31-days-of-refactoring/

       電子書下載地址:http://lostechies.com/wp-content/uploads/2011/03/31DaysRefactoring.pdf


    Refactoring 1: Encapsulate Collection【重構第一式:封裝集合】

    Refactoring 2: Move Method【重構第二式:搬移方法】

    Refactoring 3: Pull Up Method【重構第三式:上移方法】

    Refactoring 4: Pull Up Field【重構第四式:上移字段】

    Refactoring 5: Push Down Method【重構第五式:下移方法】

    Refactoring 6: Push Down Field【重構第六式:下移字段】

    Refactoring 7: Rename(method,class,parameter)【重構第七式:重命名(方法,類,參數)】

    Refactoring 8: Replace Inheritance with Delegation【重構第八式:用委託取代繼承】

    Refactoring 9: Extract Interface【重構第九式:提取接口】

    Refactoring 10: Extract Method【重構第十式:提取方法】

    Refactoring 11: Switch to Strategy【重構第十一式:重構條件語句爲策略模式】

    Refactoring 12: Break Dependencies【重構第十二式:消除依賴】

    Refactoring 13: Extract Method Object【重構第十三式:提取方法對象】

    Refactoring 14: Break Responsibilities【重構第十四式:分離職責】

    Refactoring 15: Remove Duplication【重構第十五式:去除重複代碼】

    Refactoring 16: Encapsulate Conditional【重構第十六式:封裝條件表達式】

    Refactoring 17: Extract Superclass【重構第十七式:提取父類】

    Refactoring 18: Replace exception with conditional【重構第十八式:用條件語句取代異常】

    Refactoring 19: Extract Factory Class【重構第十九式:提取工廠類】

    Refactoring 20: Extract Subclass【重構第二十式:提取子類】

    Refactoring 21: Collapse Hierarchy【重構第二十一式:合併繼承層次結構】

    Refactoring 22: Break Method【重構第二十二式:分解方法】

    Refactoring 23: Introduce Parameter Object【重構第二十三式:引入參數對象】

    Refactoring 24: Remove Arrowhead Antipattern【重構第二十四式:去除複雜的嵌套條件判斷】

    Refactoring 25: Introduce Design By Contract checks【重構第二十五式:引入契約式設計驗證】

    Refactoring 26: Remove Double Negative【重構第二十六式:消除雙重否定】

    Refactoring 27: Remove God Classes【重構第二十七式:去除上帝類】

    Refactoring 28: Rename boolean method【重構第二十八式:重命名布爾方法】

    Refactoring 29: Remove Middle Man【重構第二十九式:去除中間人】

    Refactoring 30: Return ASAP【重構第三十式:儘快返回】

    Refactoring 31: Replace conditional with Polymorphism【重構第三十一式:用多態取代條件語句】


      在本系列文章寫作過程中,參考了麒麟.NET的翻譯版本《31天重構速成 :你必須知道的重構技巧》以及聖殿騎士(Knights Warrior)《31天重構學習筆記》


發佈了81 篇原創文章 · 獲贊 104 · 訪問量 131萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章