Refactoring to Patterns
パンくず 書籍 Refactoring to Patterns Utilities 概要 Utilities、ユーティリティーに関するリファクタリング ユーティリティーに関するリファクタリング Refactoring リファクタリング Chain Constructors コンストラクタの連鎖 Unity Interface インター…
パンくず 書籍 Refactoring to Patterns Accumulation Move Accumulation to Visitor 概要 Move Accumuration to Visitorについて 使用する場面 1つのメソッドが異種のオブジェクトから情報を累積する場合 対応方法 Visitorパターンを使用する 利点と欠点 利…
パンくず 書籍 Refactoring to Patterns Accumulation Move Accumulation to Collecting Parameter 概要 Move Accumulation to Collecting Parameterについて 使用する場面 一つのローカル変数に対する変更をまとめて行なっている一つのメソッドがあるなら、…
パンくず 書籍 Refactoring to Patterns Accumulation 概要 Accumulation、蓄積に関するリファクタリング 蓄積に関するリファクタリング Refactoring リファクタリング Move Accumulation to Collectiing Parameter Collecting Parameterによる累積処理の書…
パンくず 書籍 Refactoring to Patterns Utilities Extract Parameter 概要 Extract Parameterについて 使用する場面 委譲の利用時に他のオブジェクトのインスタンス生成のための パラメータが必要な場合。 対応方法 Extract Parameterを適用する。 サンプル…
パンくず 書籍 Refactoring to Patterns Utilities Unity Interface 概要 Unity Interfaceについて 使用する場面 複数の子クラスに、共通するシグニチャのメソッドがあるがインターフェース もしくは抽象基底クラスにインターフェースが用意されていない。 …
パンくず 書籍 Refactoring to Patterns Utilities Chain Constructors 概要 Chain Constructorsについて 使用する場面 複数のコンストラクタの内容が重複している。 対応方法 Chain Constructorsを適用する。 全体に共通するコンストラクタを用意し、各コン…
パンくず 書籍 Patterns to Patterns Protection Introduce Null Object 概要 Introduce Null Objectについて 使用する場面 大量のNullチェックがある場合 対応方法 Null Objectを導入します 利点と欠点 利点 ・Nullロジックの重複を防ぎ、Nullエラーを防ぐ …
パンくず 書籍 Patterns to Patterns Protection Limit Instantiation with Singleton 概要 Limit Instantiation with Singletonについて 使用する場面 パフォーマンスやメモリーの、都合でひとつのインスタンスにしたい場合 対応方法 Singletonパターンを適…
パンくず 書籍 Refactoring to Patterns Protection 概要 Protection、保護に関するリファクタリング 保護に関するリファクタリング Refactoring リファクタリング Replace Type Code with Class クラスによる型コードの置換 Limit Instantiation with Singl…
パンくず 書籍 Patterns to Patterns Protection Replace Type Code with Class 概要 Replace Type Code with Classについて 使用する場面 タイプの指定ミスによるバグが想定される場合。 対応方法 Stateパターンを適用します 利点と欠点 利点 ・不正なパラ…
パンくず 書籍 Patterns to Patterns Generalization Replace Inplicit Language with Interpreter 概要 Replace Inplicit Language with Interpreterについて 使用する場面 シンプルだが組み合わせが多いような問題の解決が必要。 対応方法 Interpreterパタ…
パンくず 書籍 Patterns to Patterns Generalization Extract Adapter 概要 Extract Adapterについて 使用する場面 複数バージョンをサポートしなければならない場合。 対応方法 Adapterを適用する。 利点と欠点 利点 ・API,ライブラリ、コンポーネントの異…
パンくず 書籍 Patterns to Patterns Generalization Unify Interface with Adapter 概要 Unify Interface with Adapterについて 使用する場面 ・2つのクラスが似ているがインターフェースが異なる場合。 ・サードパーティの製品等、制約の関係上インターフ…
パンくず 書籍 Patterns to Patterns Generalization Replace Hard-Cord Notification with Observer 概要 Replace Hard-Cord Notification with Observerのリファクタリングについて 使用する場面 1つのReceiverしか受け取らないNotifierがあり、ハードコー…
パンくず 書籍 Patterns to Patterns Generalization Replace One/Many Distinction with Composite 概要 Replace One/Many Distinction with Compositeのリファクタリングについて 使用する場面 あるクラスがひとつのオブジェクトと多数のオブジェクトを扱…
パンくず 書籍 Patterns to Patterns Generalization Extract Composite 概要 Extract Compositeのリファクタリングについて 使用する場面 2つ以上の似たクラスを保持している場合 対応方法 Compositeパターンを適用する。 利点と欠点 利点 ・子の格納と処理…
パンくず 書籍 Patterns to Patterns Generalization Form Template Method 概要 Form Template Methodのリファクタリングについて 使用する場面 サブクラスに変数となる箇所と非変数となる箇所が混ざっている場合、非変数となる箇所はサブクラスで重複して…
パンくず 書籍 Refactoring to Patterns Generalization 概要 Generalization、汎化に関するリファクタリング 汎化に関するリファクタリング Refactoring リファクタリング Form Template Method Template Methodの形成 Extract Composite Compositeの抽出 R…
パンくず 書籍 Patterns to Patterns Simplification Move Embellishment to Decorator 概要 Move Embellishment to Decoratorのリファクタリングについて 使用する場面 核となる機能に飾るような機能を追加する場合、 既存のクラスに特定のケースのみ動作す…
パンくず 書籍 Patterns to Patterns Simplification Replace Conditional Logic with Strategy 概要 Replace Conditional Logic with Strategyのリファクタリングについて 使用する場面 Martin Fowler曰く「プログラムの複雑性のもっとも一般的なものの一つ…
パンくず 書籍 Patterns to Patterns Simplification Compose Method 概要 Compose Methodのリファクタリングについて 使用する場面 雑然とした長い処理のメソッドなどがある場合 対応方法 同レベルの粒度でExtract Methodを適用する。 役割を表す分かりやす…
パンくず 書籍 Refactoring to Patterns Simplification 概要 Simplification、単純化に関するリファクタリング 単純化に関するリファクタリング Refactoring リファクタリング 補足 Compose Method メソッドの構造化 ーー Replace Conditional Logic with S…
パンくず 書籍 Patterns to Patterns Creation Inline Singleton 概要 Inline Singletonのリファクタリングについて 使用する場面 Singletonitisは、Singletonパターンを適用することと定義します。 Singletonの目的はインスタンスが一つしかないことを保証…
パンくず 書籍 Patterns to Patterns Creation Encapsulate Composit Builder 概要 Encapsulate Composit Builderのリファクタリングについて 使用する場面 複雑化したCompositeを含む生成ロジックをクライアントから切り離したい場合 対応方法 Builderを作…
パンくず 書籍 Patterns to Patterns Creation Introduce Polymorphic Creation With Factory Method 概要 Introduce Polymorphic Creation With Factory Methodのリファクタリングについて 使用する場面 複数のクラスを同一の型で扱うFactory Methodにした…
パンくず 書籍 Patterns to Patterns Creation Encapsulate Classes with Factory 概要 Encapsulate Classes with Factoryのリファクタリングについて 使用する場面 一つのインターフェースを実装したクラスが複数あった場合に、 必要最低限のクラスのみ外部…
パンくず 書籍 Patterns to Patterns Creation Move Creation Knowledge to Factory 概要 Move Creation Knowledge to Factoryのリファクタリングについて 使用する場面 オブジェクトの生成にいくつか設定が必要であり、 生成のための処理を各クライアント側…
パンくず 書籍 Patterns to Patterns Creation Replace Constructors with Creation Method 概要 Replace Constructors with Creation Methodのリファクタリングについて 使用する場面 オーバーロードした多数のコンストラクタが存在し、 クラスを利用する側…
パンくず 書籍 Refactoring to Patterns Creation 概要 Creation、生成に関するリファクタリング 生成に関するリファクタリング Refactoring リファクタリング Replace Constructors with Creation Method Creation Methodによるコンストラクタの置換 Move C…