4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

RailsのクラスとDDD・クリーンアーキテクチャ概念のマッピング

Last updated at Posted at 2022-02-13

はじめに

以前書いた以下記事の内容を表にあらわしてみました。

Railsとアーキテクチャ

Rails DDD Clean Architecture
ActionView UI層 Frameworks & Drivers(UI)
ActionController アプリケーション層 Interface Adapters(Controllers / Presenters) / Application Business Rules(Use Cases / Interactor)
ActiveModel::Model ドメイン層 Enterprise Business Rules(Entities)
ActiveRecord::Persistence インフラストラクチャ層 Application Business Rules(Repository) / Interface Adapters(Repository)

Railsとドメインモデル

Rails DDD Clean Architecture
ActiveRecord::ActiveModel Entities Entities, Repository
ActiveRecord::Aggregations Value Objects Entities
Module::Concerning Modules Entities
サービスオブジェクト / ActievRecord::Callbacks / ActiveRecord::Validations Domain Service Entities
ActionController / サービスオブジェクト / フォームオブジェクト / ActiveRecord::Observer(-Rails 4.0) / ActievRecord::Callbacks / ActiveRecord::Validations Application Service Use Cases / Interactor

Railsとドメインオブジェクトのライフサイクル

Rails DDD Clean Architecture
フォームオブジェクト Aggregates -
- Factories -
ActiveRecord::QueryMethods Repositories Application Business Rules(Repository) / Interface Adapters(Repository)

参考

最後に

独断と偏見に基づくため、明らかな誤りや異なるご意見についてお気軽にコメントいただけますと幸いです。

4
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?