Skip to content
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

アーキテクチャ・ディレクトリ構成のアップデート #145

Closed
9 tasks done
susatthi opened this issue May 24, 2022 · 3 comments
Closed
9 tasks done

Comments

@susatthi
Copy link
Owner

susatthi commented May 24, 2022

  • ディレクトリ構成を変更する

PXL_20220525_011736302

/config アプリ、ルーティング、テーマ、環境変数など
  - app.dart
  - router.dart
  - theme.dart

/presentation プレゼンテーション層、関心事毎にサブフォルダで分ける
  /common
    - error_page.dart
    /components
      - custom_button.dart
  /user
    - index_page.dart
    - view_page.dart
    - edit_page.dart
    /components
      - name_text.dart
      - name_text_state.dart
      - name_text_notifier.dart

/application アプリケーション層、関心事毎にサブフォルダで分ける
  /common
    - common_service.dart
  /app
    - app_service.dart
  /user
    - user_service.dart

/domain ドメイン層、関心事毎にサブフォルダで分ける
  /app
    /repositories
      - app_repository.dart
  /user
    /entities
      - user.dart
    /repositories
      - user_repository.dart

/infrastructure インフラストラクチャ層、DataSource毎にサブフォルダで分ける
  /hive
    - app_repository.dart
  /firestore
    - user_repository.dart
    /documents
      - user.dart

DDD を参考に下記の観点でリファクタリング

  • ドメイン層はどの層にも依存してはならない
  • インフラ層はドメイン層のみに依存する
  • プレゼンテーション層のNotifierはドメイン層のみに依存する
  • ownerエンティティは不要そう
  • アプリケーション層が必要にならないか?
  • ドメイン層のエンティティのEntityHelperというおおざっぱなextensionはやめて、ValueObject風に個々のValueのextensionにする
  • 例外の定義をインフラ層からドメイン層に移動する
  • ブラウザ起動処理をどこに書くか?
@susatthi
Copy link
Owner Author

ドメイン駆動設計・開発の実践

2009年の記事だけど、めちゃくちゃ詳しく、わかりやすい。

susatthi added a commit that referenced this issue May 25, 2022
susatthi added a commit that referenced this issue May 25, 2022
susatthi added a commit that referenced this issue May 25, 2022
susatthi added a commit that referenced this issue May 25, 2022
susatthi added a commit that referenced this issue May 25, 2022
susatthi added a commit that referenced this issue May 25, 2022
susatthi added a commit that referenced this issue May 25, 2022
@susatthi
Copy link
Owner Author

DDDの勉強になる。

https://qiita.com/kichion/items/aca19765cb16e7e65946

特に以下の部分。

CleanShot 2022-05-26 at 17 15 37@2x

susatthi added a commit that referenced this issue May 26, 2022
susatthi added a commit that referenced this issue May 26, 2022
susatthi added a commit that referenced this issue May 26, 2022
@susatthi susatthi reopened this May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant