-
Notifications
You must be signed in to change notification settings - Fork 0
プロジェクトのファイル構成を修正 #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
プロジェクトのファイル構成を修正 #58
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
cc99bd9
refactor: docコマンドのコードをリファクタ
mochi-yu a833572
refactor: 設定の保存処理を、表示機能から分離
mochi-yu 6385fd2
fix: config.yamlの挙動を修正
mochi-yu c27f677
fix: モデルの名前をsuggestModelに変更
mochi-yu 378104d
refactor: コミットメッセージの作成処理を、suggest_cmd_serviceとして切り分け
mochi-yu be69e70
doc: コメントを追加
mochi-yu cf05d15
refactor: コミットを実行する処理を`suggest_cmd_service`に移植
mochi-yu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コンストラクタ関数 (New〇〇~)はcmdとかのエントリポイントで呼んで欲しい
色々なところで呼び出したらレイアードアーキテクチャの意味がなくなりそう
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
自分の中のレイヤードアーキテクチャーの目的は、プログラムの責務の分離だけどそれで同じですかね?
この変更の意図は、APIの接続先を選択するロジックを、コマンドの表示周りの処理と分離すること。
cmdディレクトリはCUIの表示とか、操作とかに関する処理だけにとどめたい。どのAPIにアクセスするかの選択は表示とかとは無関係で、cmdディレクトリ内のプログラムでは面倒を見ないようにしたい。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コンストラクタ関数は一箇所にまとめて保守性をあげたかったのが目的。
構造体の中に、該当のサービスを入れたら済む話なのかなと思った。
レイヤードアーキテクチャの目的は文脈
次第だと思うけど、リファクタしても影響範囲を出にくくするのと可読性を上げる事だと思う。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
保守性を上げることは、処理をまとめて同じところに書くよりも、各プログラムの責務を明確に分けることで生まれると僕は思うけど。
CLI上での表示をいじりたければ全て
cmd\suggest.go
を見る。万が一他の部分を変えたとしても、表示以外に影響を及ぼさない。中の処理を変えたければinternal\service\suggest_cmd.go
を見る。というのが保守性を高めることじゃないですかね?「リファクタしても影響範囲を出にくくするのと可読性を上げる事」は、全てのアーキテクチャが考えられている目的で、中でもレイヤードアーキテクチャの目的は、レイヤごとに責務を分けて、他のレイヤの役割を混ぜないことじゃないですかね。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コンストラクタ関数をエントリポイントでまとめた方が依存関係が全部わかって保守性が上がるって意味でいいたかった。
今回は、cmdが実質インターフェースだから特殊だけど。
そこはNewContainerとかでDIだけ別パッケージに切り出すとかで対処できそうかも。
コンストラクタ関数をまとめるのは、まとめるのが目的でなくコード規約てきなものだとイメージしてた。
レイヤ責務を分ける目的はどんな事だと考えてる?