Refactoring to Patterns (Hardcover)
暫譯: 重構與模式 (精裝版)

Joshua Kerievsky

買這商品的人也買了...

商品描述

Description:

With the highly anticipated Refactoring to Patterns, Joshua Kerievsky has changed our approach to design by forever uniting patterns with the evolutionary process of refactoring.

Intended for the more experienced student, this book introduces the theory and practice of pattern-directed refactorings: sequences of low-level refactorings that allow designers to safely move designs to, towards, or away from pattern implementations. Using code from real-world projects, Kerievsky documents the thinking and steps underlying over two dozen pattern-based design transformations. Along the way he offers insights into pattern differences and how to implement patterns in the simplest possible ways.

 

Table of Contents:

Foreword by Ralph Johnson.

Foreword by Martin Fowler.

Preface.

What Is This Book About?

What Are the Goals of This Book?

Who Should Read This Book?

What Background Do You Need?

How to Use This Book.

The History of This Book.

Standing on the Shoulders of Giants.

Acknowledgments.

1. Why I Wrote This Book.

Over-Engineering.

The Patterns Panacea.

Under-Engineering.

Test-Driven Development and Continuous Refactoring.

Refactoring and Patterns.

Evolutionary Design.

2. Refactoring.

What Is Refactoring?

What Motivates Us to Refactor?

Many Eyes.

Human-Readable Code.

Keeping It Clean.

Small Steps.

Design Debt.

Evolving a New Architecture.

Composite and Test-Driven Refactorings.

The Benefits of Composite Refactorings.

Refactoring Tools.

3. Patterns.

What Is a Pattern?

Patterns Happy.

There Are Many Ways to Implement a Pattern.

Refactoring to, towards, and away from Patterns.

Do Patterns Make Code More Complex?

Pattern Knowledge.

Up-Front Design with Patterns.

4. Code Smells.

Duplicated Code.

Long Method.

Conditional Complexity.

Primitive Obsession.

Indecent Exposure.

Solution Sprawl.

Alternative Classes with Different Interfaces.

Lazy Class.

Large Class.

Switch Statements.

Combinatorial Explosion.

Oddball Solution.

5. A Catalog of Refactorings to Patterns.

Format of the Refactorings.

Projects Referenced in This Catalog.

A Starting Point.

A Study Sequence.

6. Creation.

Replace Constructors with Creation Methods.

Move Creation Knowledge to Factory.

Encapsulate Classes with Factory.

Introduce Polymorphic Creation with Factory Method.

Encapsulate Composite with Builder.

Inline Singleton.

7. Simplification.

Compose Method.

Replace Conditional Logic with Strategy.

Move Embellishment to Decorator.

Replace State-Altering Conditionals with State 166

Replace Implicit Tree with Composite.

Replace Conditional Dispatcher with Command.

8. Generalization.

Form Template Method.

Extract Composite.

Replace One/Many Distinctions with Composite.

Replace Hard-Coded Notifications with Observer.

Unify Interfaces with Adapter.

Extract Adapter.

Replace Implicit Language with Interpreter.

9. Protection.

Replace Type Code with Class.

Limit Instantiation with Singleton.

10. Accumulation.

Move Accumulation to Collecting Parameter.

Move Accumulation to Visitor.

11. Utilities.

Chain Constructors.

Unify Interfaces.

Extract Parameter.

Afterword by John Brant and Don Roberts.

References.

Index.

 

商品描述(中文翻譯)

描述:

在備受期待的《Refactoring to Patterns》中,Joshua Kerievsky 改變了我們對設計的看法,將模式與重構的演進過程永遠結合在一起。

本書針對較有經驗的讀者,介紹了以模式為導向的重構的理論與實踐:一系列低層次的重構,讓設計者能夠安全地將設計移動到、朝向或遠離模式實現。Kerievsky 使用來自真實世界專案的程式碼,記錄了超過二十種基於模式的設計轉換的思考過程和步驟。在此過程中,他提供了對模式差異的見解,以及如何以最簡單的方式實現模式。

目錄:

Ralph Johnson 的前言。

Martin Fowler 的前言。

前言。

這本書是關於什麼?

這本書的目標是什麼?

誰應該閱讀這本書?

你需要什麼背景?

如何使用這本書。

這本書的歷史。

站在巨人的肩膀上。

致謝。

1. 為什麼我寫這本書。

過度工程。

模式的萬能藥。

不足工程。

測試驅動開發與持續重構。

重構與模式。

演進設計。

2. 重構。

什麼是重構?

促使我們重構的動機是什麼?

眾多的眼睛。

可讀性高的程式碼。

保持乾淨。

小步驟。

設計債務。

演進新的架構。

組合與測試驅動重構。

組合重構的好處。

重構工具。

3. 模式。

什麼是模式?

模式的快樂。

有許多方法可以實現一個模式。

重構到、朝向和遠離模式。

模式是否使程式碼更複雜?

模式知識。

使用模式的前期設計。

4. 程式碼異味。

重複的程式碼。

長方法。

條件複雜性。

原始類型迷戀。

不雅暴露。

解決方案擴散。

具有不同介面的替代類別。

懶惰類別。

大型類別。

切換語句。

組合爆炸。

奇特解決方案。

5. 重構到模式的目錄。

重構的格式。

本目錄中引用的專案。

一個起點。

學習序列。

6. 創建。

用創建方法替換建構子。

將創建知識移至工廠。

用工廠封裝類別。

引入多態創建與工廠方法。

用建構者封裝組合。

內聯單例。

7. 簡化。

組合方法。

用策略替換條件邏輯。

將裝飾移至裝飾者。

用狀態替換改變狀態的條件。

用組合替換隱式樹。

用命令替換條件調度器。

8. 一般化。

形成模板方法。

提取組合。

用組合替換一對多的區別。

用觀察者替換硬編碼通知。

用適配器統一介面。

提取適配器。

最後瀏覽商品 (20)