特殊性を上のクラスに持っていく

One way to separate specialized code is to push it upwards. The top-level classes of an application, which provide specific features, will necessarily be specialized for those features. But this specialization need not percolate down into the lower-level classes that are used to implement the features. We saw this in the editor example earlier in this chapter. The original student implementation leaked specialized user-interface details such as the behavior of the backspace key down into the implementation of the text class. The improved text API pushed all of the specialization upwards into the user interface code, leaving only general-purpose code in the text class.

—『A Philosophy of Software Design, 2nd Edition』John K. Ousterhout著 6.6

 

 

 

リポジトリには腐敗防止層という名前がついていてAPIクライアントやdaoと分離するように実装するけどそれとは別かな

 

全然別のものとしてリスキリングしないといけないと思うから一旦そのまま飲み込もう

 

上の層に特殊性を持っていきifをシンプルで統一的なシグネチャにするのが主張

 

次の文では下方に持っていくことが有効な場合もあると言っている

 

「Sometimes the best approach is to push specialization downwards. One example of this is device drivers. An operating system typically must support hundreds or thousands of different device types of devices, such as different kinds of secondary storage devices. Each of these device types has its own specialized command set. In order to prevent specialized device characteristics from leaking into the main operating system code, operating systems define an interface with general-purpose operations that any secondary storage device must implement, such as “read a block” and “write a block”. For each different device, a device driver module implements the general-purpose interface using the specialized features of that particular device. This approach pushes specialization down into the device drivers, so that the core of the operating system can be written without any knowledge of specific device characteristics. This approach also makes it easy to add new devices: if a device has enough features to implement the device driver interface, it can be added to the system with no changes to the main operating system.」

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

 

主張したいのはメソッドの統合で上か下かは関係ないようだ