Hugoを使った技術ブログの作成

静的サイトジェネレータ「Hugo」と技術文書公開向けテーマ「Docsy」でOSSサイトを作る | さくらのナレッジ

 

【Hugo】ブログを作りたい?...5分もあれば十分だ

 

記事作成から公開までをGitHubで完結できる技術ブログ基盤作り - Visional Engineering Blog

 

上記が参考になる。

作ってみようと思う。

 

深いモジュールパススルーメソッド

「Figure 7.1: Pass-through methods. In (a), class C1 contains three pass-through methods, which do nothing but invoke methods with the same signature in C2 (each symbol represents a particular method signature). The pass-through methods can be eliminated by having C1’ s callers invoke C2 directly as in (b), by redistributing functionality between C1 and C2 to avoid calls between the classes as in (c), or by combining the classes as in (d).」

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

 

こういう説明を見るとサービス層でパススルーしているメソッドはdomainにあるinterfaceを継承したinterfaceでいいんじゃないかと想像する

 

そういうのが実際にあるかはここでは取り扱わない

ソフトウェは抽象化のレイヤーを順番に渡り歩いている

「Chapter 7 Different Layer, Different Abstraction Software systems are composed in layers, where higher layers use the facilities provided by lower layers. In a well-designed system, each layer provides a different abstraction from the layers above and below it; if you follow a single operation as it moves up and down through layers by invoking methods, the abstractions change with each method call. For example: In a file system, the uppermost layer implements a file abstraction. A file consists of a variable-length array of bytes, which can be updated by reading and writing variable-length byte ranges. The next lower layer in the file system implements a cache in memory of fixed-size disk blocks; callers can assume that frequently used blocks will stay in memory where they can be accessed quickly. The lowest layer consists of device drivers, which move blocks between secondary storage devices and memory. In a network transport protocol such as TCP, the abstraction provided by the topmost layer is a stream of bytes delivered reliably from one machine to another. This level is built on a lower level that transmits packets of bounded size between machines on a best-effort basis: most packets will be delivered successfully, but some packets may be lost or delivered out of order. If a system contains adjacent layers with similar abstractions, this is a red flag that suggests a problem with the class decomposition. This chapter discusses situations where this happens, the problems that result, and how to refactor to eliminate the problems.」

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

 

 

抽象化ののレイヤーを渡り歩いている

 

同じ抽象度の移動はどこかおかしい

匂いを感じたら対応しよう

 

わかる。

そこ本当にダメかわかっていないけどレイヤーがおかしそう

設計がおかしいし抽象化に失敗してるということなんだろう

 

見つかってからだと結構しんどい

 

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

 

 

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

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