ドメイン駆動設計: IDDDに登場するサンプルコードのModule構成をまとめてみた


> ### UPDATE 2013.04.16
> まとめてから気がついたが、GitHubの[VaughnVernon/IDDD_Samples]にIDDDのサンプルコードがあった。


ドメイン駆動設計で実際にどういうふうにディレクトリを切って、Moduleを構成するのか知りたかったので、[Implementing Domain-Driven Design] に記載さいれているサンプルコードからModule構成をかき集めて再構成してみた。

## Moduleの構成

```
com
└── saasovation
    ├── agilepm
    │   ├── application
    │   │   ├── ProcessService
    │   │   ├── ProductService
    │   │   └── TeamService
    │   ├── domain
    │   │   └── model
    │   │       ├── DomainEvent
    │   │       ├── DomainEventPublisher
    │   │       ├── DomainRegistry
    │   │       ├── DomainTest
    │   │       ├── product
    │   │       │   ├── BacklogItem
    │   │       │   │   └── BacklogItem
    │   │       │   ├── BacklogItemComitted
    │   │       │   ├── BacklogItemRepository
    │   │       │   ├── BusinessPriority
    │   │       │   ├── BusinessPriorityCalculator
    │   │       │   ├── BusinessPriorityRatings
    │   │       │   ├── BusinessPriorityTest
    │   │       │   ├── Product
    │   │       │   ├── ProductDiscussion
    │   │       │   ├── ProductDiscussionRequestTimeOut
    │   │       │   ├── ProductDiscussionRequested
    │   │       │   ├── ProductRepository
    │   │       │   ├── SprintId
    │   │       │   ├── Tenant
    │   │       │   ├── impl
    │   │       │   │   └── InMemoryProductRepository
    │   │       │   ├── release
    │   │       │   │   └── Release
    │   │       │   └── sprint
    │   │       │       └── Sprint
    │   │       ├── team
    │   │       │   ├── Member
    │   │       │   ├── MemberChangeTracker
    │   │       │   ├── MemberService
    │   │       │   ├── ProductOwner
    │   │       │   ├── Team
    │   │       │   └── TeamMember
    │   │       └── tenant
    │   │           └── TenantId
    │   ├── infrastrcuture
    │   │   └── messaging
    │   │       └── ProductDiscussionRequestedListener
    │   └── infrastructure
    │       ├── HibernateBacklogItemRepository
    │       ├── messaging
    │       │   ├── DiscussionStartedListener
    │       │   ├── ProductDiscussionRetryListener
    │       │   └── TeamMemberEnablerListener
    │       └── persistence
    │           └── CoherenceProductRepository
    ├── collaboration
    │   ├── application
    │   │   ├── AccessService
    │   │   └── ForumService
    │   ├── domain
    │   │   └── model
    │   │       ├── calendar
    │   │       │   ├── Calendar
    │   │       │   └── CalendarEntityRepository
    │   │       ├── collaborator
    │   │       │   ├── Author
    │   │       │   ├── Collaborator
    │   │       │   └── CollaboratorService
    │   │       ├── forum
    │   │       │   └── Forum
    │   │       └── tenant
    │   │           └── Tenant
    │   └── infrastructure
    │       ├── messaging
    │       │   └── ExclusiveDiscussionCreationListener
    │       ├── persistence
    │       │   ├── HibernateCalendarEntityRepository
    │       │   └── SpringHibernateSessionProvider
    │       ├── services
    │       │   ├── CollaboratorTranslator
    │       │   ├── TranslatingCollaboratorService
    │       │   └── UserInRoleAdapter
    │       └── servicies
    │           └── UserRoleToCollaboratorService
    ├── common
    │   ├── domain
    │   │   └── model
    │   │       └── process
    │   │           ├── Process
    │   │           ├── ProcessId
    │   │           └── ProcessTimeOut
    │   ├── media
    │   │   ├── OvationMediaType
    │   │   └── ReprensentationReader
    │   └── port
    │       └── adapter
    │           └── messaging
    │               └── rabbitmq
    │                   └── ExchangeListener
    └── identityaccess
        ├── application
        │   ├── AccessService
        │   ├── NotificationService
        │   ├── TenantIdentityService
        │   ├── eventStore
        │   │   ├── EventStore
        │   │   └── StoredEvent
        │   └── notifications
        │       └── PublishedMessageTracker
        ├── domain
        │   └── model
        │       ├── DomainRegistry
        │       ├── access
        │       │   └── Role
        │       └── identity
        │           ├── AuthenticationService
        │           ├── Group
        │           ├── GroupMember
        │           ├── GroupMemberType
        │           ├── Tenant
        │           ├── TenantId
        │           ├── User
        │           └── UserDescriptor
        └── infrastructure
            ├── persistence
            │   ├── GroupMemberTypeUserType
            │   ├── HibernateUserRepository
            │   └── SpringHibernateSessionProvider
            └── servicies
                └── DefaultEncryptionAuthenticationService
```

## 収集したクラス・インターフェイスの一覧

```
com.saasovation.agilepm.domain.model.DomainTest
com.saasovation.agilepm.domain.model.DomainRegistry
com.saasovation.agilepm.domain.model.DomainEvent
com.saasovation.agilepm.domain.model.DomainEventPublisher
com.saasovation.agilepm.domain.model.product.BacklogItemRepository
com.saasovation.agilepm.domain.model.product.BacklogItem
com.saasovation.agilepm.domain.model.product.Tenant
com.saasovation.agilepm.domain.model.product.SprintId
com.saasovation.agilepm.domain.model.product.BusinessPriority
com.saasovation.agilepm.domain.model.product.BusinessPriorityRatings
com.saasovation.agilepm.domain.model.product.BusinessPriorityTest
com.saasovation.agilepm.domain.model.product.BusinessPriorityCalculator
com.saasovation.agilepm.domain.model.product.BacklogItemComitted
com.saasovation.agilepm.domain.model.product.Product
com.saasovation.agilepm.domain.model.product.backlogitem.BacklogItem
com.saasovation.agilepm.domain.model.product.release.Release
com.saasovation.agilepm.domain.model.product.sprint.Sprint
com.saasovation.agilepm.domain.model.product.impl.InMemoryProductRepository
com.saasovation.agilepm.domain.model.product.ProductRepository
com.saasovation.agilepm.domain.model.product.ProductDiscussion
com.saasovation.agilepm.domain.model.product.ProductDiscussionRequested
com.saasovation.agilepm.domain.model.product.ProductDiscussionRequestTimeOut
com.saasovation.agilepm.domain.model.tenant.TenantId
com.saasovation.agilepm.domain.model.team.MemberService
com.saasovation.agilepm.domain.model.team.ProductOwner
com.saasovation.agilepm.domain.model.team.Team
com.saasovation.agilepm.domain.model.team.TeamMember
com.saasovation.agilepm.domain.model.team.Member
com.saasovation.agilepm.domain.model.team.MemberChangeTracker
com.saasovation.agilepm.infrastructure.persistence.CoherenceProductRepository
com.saasovation.agilepm.infrastructure.messaging.TeamMemberEnablerListener
com.saasovation.agilepm.infrastrcuture.messaging.ProductDiscussionRequestedListener
com.saasovation.agilepm.infrastructure.messaging.DiscussionStartedListener
com.saasovation.agilepm.infrastructure.messaging.ProductDiscussionRetryListener
com.saasovation.agilepm.infrastructure.HibernateBacklogItemRepository
com.saasovation.agilepm.application.TeamService
com.saasovation.agilepm.application.ProductService
com.saasovation.agilepm.application.ProcessService
com.saasovation.identityaccess.domain.model.DomainRegistry
com.saasovation.identityaccess.domain.model.identity.User 
com.saasovation.identityaccess.domain.model.identity.GroupMemberType 
com.saasovation.identityaccess.domain.model.identity.Group
com.saasovation.identityaccess.domain.model.identity.GroupMember
com.saasovation.identityaccess.domain.model.identity.TenantId
com.saasovation.identityaccess.domain.model.identity.AuthenticationService
com.saasovation.identityaccess.domain.model.identity.Tenant
com.saasovation.identityaccess.domain.model.identity.UserDescriptor
com.saasovation.identityaccess.domain.model.access.Role
com.saasovation.identityaccess.application.eventStore.EventStore
com.saasovation.identityaccess.application.eventStore.StoredEvent
com.saasovation.identityaccess.application.NotificationService
com.saasovation.identityaccess.application.AccessService
com.saasovation.identityaccess.application.TenantIdentityService
com.saasovation.identityaccess.application.notifications.PublishedMessageTracker
com.saasovation.identityaccess.infrastructure.persistence.HibernateUserRepository
com.saasovation.identityaccess.infrastructure.servicies.DefaultEncryptionAuthenticationService
com.saasovation.identityaccess.infrastructure.persistence.GroupMemberTypeUserType
com.saasovation.identityaccess.infrastructure.persistence.SpringHibernateSessionProvider
com.saasovation.collaboration.domain.model.tenant.Tenant
com.saasovation.collaboration.domain.model.forum.Forum
com.saasovation.collaboration.domain.model.calendar.Calendar
com.saasovation.collaboration.domain.model.calendar.CalendarEntityRepository
com.saasovation.collaboration.domain.model.collaborator.CollaboratorService
com.saasovation.collaboration.domain.model.collaborator.Author
com.saasovation.collaboration.domain.model.collaborator.Collaborator
com.saasovation.collaboration.infrastructure.persistence.HibernateCalendarEntityRepository
com.saasovation.collaboration.infrastructure.persistence.SpringHibernateSessionProvider
com.saasovation.collaboration.infrastructure.servicies.UserRoleToCollaboratorService
com.saasovation.collaboration.infrastructure.services.TranslatingCollaboratorService
com.saasovation.collaboration.infrastructure.services.UserInRoleAdapter
com.saasovation.collaboration.infrastructure.services.CollaboratorTranslator
com.saasovation.collaboration.infrastructure.messaging.ExclusiveDiscussionCreationListener
com.saasovation.collaboration.application.ForumService
com.saasovation.collaboration.application.AccessService
com.saasovation.common.media.OvationMediaType
com.saasovation.common.media.ReprensentationReader
com.saasovation.common.port.adapter.messaging.rabbitmq.ExchangeListener
com.saasovation.common.domain.model.process.ProcessId
com.saasovation.common.domain.model.process.ProcessTimeOut
com.saasovation.common.domain.model.process.Process
```

[Implementing Domain-Driven Design]: http://amzn.to/YmRhoC
[VaughnVernon/IDDD_Samples]: https://github.com/VaughnVernon/IDDD_Samples