actionを分離する

この行為は賛成だけど

統合とはまた違う話のようだ

 

6.7あたりからそれを感じる

 

「Some of the student projects implemented the entire undo mechanism as part of the text class. The text class maintained a list of all the undoable changes. It automatically added entries to this list whenever the text was changed. For changes to the selection, insertion cursor, and view, the user interface code invoked additional methods in the text class, which then added entries for those changes to the undo list. When undo or redo was requested by the user, the user interface code invoked a method in the text class, which then processed the entries in the undo list. For entries related to text, it updated the internals of the text class; for entries related to other things, such as the selection, the text class called back to the user interface code to carry out the undo or redo.」

—『A Philosophy of Software Design, 2nd Edition』John K. Ousterhout著
https://a.co/bdHn5h6

 

多態性とか分割統治の文脈と同じように見える

 

 

特殊な部分を汎用的な部分から切り離すがやりたいこと

 

ステートパターンと同じと考えて問題なさそう

イフの排除を目的としている

 

「6.9 Conclusion Unnecessary specialization, whether in the form of special-purpose classes and methods or special cases in code, is a significant contributor to software complexity. Specialization can’t be eliminated completely, but with good design you should be able to reduce it significantly and separate specialized code from general-purpose code. This will result in deeper classes, better information hiding, and simpler and more obvious code.」

—『A Philosophy of Software Design, 2nd Edition』John K. Ousterhout著
https://a.co/bFi1rjY

 

 

特殊性の排除は困難であるため

特殊性は別途切り出しステートパターンなどを使用して優れた設計を選び対応すること