何度考えても結論が出ないDDD問題

ドメインてなんや
model以上でアプリケーション以下のドメインという存在であらゆる設計が一貫性が失われる

https://guides.hanamirb.org/repositories/overview/

https://gist.github.com/practicingruby/4341122

https://gist.github.com/dhh

https://www.slideshare.net/justingordon/rails-conf-2014concernsdecoratorspresentersserviceobjectshelpershelpmedecideapril222014

https://www.slideshare.net/justingordon/rails-conf-2014concernsdecoratorspresentersserviceobjectshelpershelpmedecideapril222014



callbackでもなくFormObjectでもなくmvcで解決しきるDHHのすごさ
複数モデルをtransaction内で処理する
https://gist.github.com/dhh/9348053
https://amolnpujari.wordpress.com/2013/04/09/184/
https://qiita.com/joker1007/items/2a03500017766bdb0234
https://qiita.com/masuidrive/items/f2ae316dc8e98b4ff82a
https://amolnpujari.wordpress.com/2013/04/09/184/
https://qiita.com/kamohicokamo/items/e7c31f61c99c9fc0fe7f
https://techracho.bpsinc.jp/hachi8833/2017_11_06/47607
https://api.rubyonrails.org/classes/ActiveRecord/Transactions/ClassMethods.html
https://techracho.bpsinc.jp/hachi8833/2017_12_12/48367
https://api.rubyonrails.org/classes/ActiveRecord/Attributes/ClassMethods.html
この方針がめちゃくちゃいいような気がする
```
If you just need to update fields in the same model, use Callbacks. You can still do this for field updates even if you also need other patterns for more complex needs.
If you have a form with multiple models or with form-specific validation, use a Form Object. But I don’t recommend adding secondary effects to a Form Object.
If you have only few secondary effects that you use rarely, or that aren’t on the critical path, use General Decorators.
If you have secondary effects that aren’t on the critical path, and they’re always used, use Events.
If you have many secondary effects called from multiple places in different combinations, or if they’re on the critical path, use Service Objects.
If your Service Objects are getting complex or repetitive, you can have them use General Decorators or broadcast Events instead of calling secondary effects directly.
```
https://codingitwrong.com/2015/12/14/refactoring-patterns-for-secondary-effects.html

validationを複雑さなく書く
https://gist.github.com/dhh/9672827
https://gist.github.com/dhh/10649506

２つのモデルに紐づくモデルのcontrollerでの扱い
https://gist.github.com/dhh/10022098

authenticationの分割
https://gist.github.com/dhh/10880690

Gridカウントサンプル
https://gist.github.com/dhh/10882430

テストが設計を駄目にする
https://dhh.dk/2014/test-induced-design-damage.html
https://blog.cleancoder.com/uncle-bob/2014/05/01/Design-Damage.html

環境毎の設定をymlで
https://gist.github.com/dhh/9afdbfd67e3c42c9f09e



https://www.youtube.com/channel/UCdx5Dk3EWTe2i8YDA7bfl6g
youtubeよりコード例
<img width="1220" alt="Screen Shot 2019-10-11 at 15.41.48.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/53443/f9465084-7276-25c3-d243-35a9cd668851.png">
<img width="1221" alt="Screen Shot 2019-10-11 at 15.40.18.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/53443/605cad28-0fe2-adbc-530d-22d76edf6921.png">
<img width="1231" alt="Screen Shot 2019-10-11 at 15.39.06.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/53443/9232d2ee-58fe-640b-067c-ac6a1172da05.png">
<img width="1208" alt="Screen Shot 2019-10-11 at 15.37.03.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/53443/60d6ffe8-afce-c40b-c534-47f004599fd7.png">
<img width="1220" alt="Screen Shot 2019-10-11 at 15.35.46.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/53443/90d4ece8-5dbe-a2ca-a0f1-6ebc403112eb.png">
<img width="1219" alt="Screen Shot 2019-10-11 at 15.33.09.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/53443/6ff9ea03-42b0-6396-4556-77fd6b0e2a50.png">
<img width="1219" alt="Screen Shot 2019-10-11 at 15.32.07.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/53443/44cba092-6db3-ef41-a707-47e71eff1db1.png">
<img width="1230" alt="Screen Shot 2019-10-11 at 15.26.03.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/53443/c525997f-9261-194b-0352-2852a1d43a43.png">
<img width="1212" alt="Screen Shot 2019-10-11 at 15.24.16.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/53443/c8353b68-6f9c-1980-b812-aef6db91ca37.png">
<img width="1217" alt="Screen Shot 2019-10-11 at 15.23.14.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/53443/77372fb1-c6c0-2605-37c8-1bbe60b68aa2.png">