以下の内容はhttps://tbpgr.hatenablog.com/entry/20120518/1337366138より取得しました。


書籍 Refactoring to Patterns | Protection| Replace Type Code with Class

パンくず

書籍 Patterns to Patterns
Protection
Replace Type Code with Class

概要

Replace Type Code with Classについて

使用する場面

タイプの指定ミスによるバグが想定される場合。

対応方法

Stateパターンを適用します

利点と欠点

利点

・不正なパラメータや比較対策

欠点

・通常よりも、多くのコードを必要とする

サンプル

サンプルはGoFデザインパターンStateパターン




以上の内容はhttps://tbpgr.hatenablog.com/entry/20120518/1337366138より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14