Reputation: 315
I am working on legacy project trying to improve project structure. My question is how should I organize code structure. I see two options:
#1 business-domain / layer
app/
----accout/
--------application/
--------domain/
--------infrastructure/
----client/
--------application/
--------domain/
--------infrastructure/
----transfer/
--------application/
--------domain/
--------infrastructure/
or #2 layer / business-domain
app/
----application/
--------account/
--------client/
--------transfer/
----domain/
--------account/
--------client/
--------transfer/
----infrastructure/
--------account/
--------client/
--------transfer/
Which approach would fit better for legacy project? Which is preferable from your experience?
From my point of view, #1 will enable system decoupling during further refactoring. On the other hand, #1 seems easier to achieve for legacy project.
Upvotes: 4
Views: 4181
Reputation: 17051
Accordingly to book ddd in php you can create modules, and in this case it will looks like:
└──src
├── Application
├── Domain
│ └── Model
│ ├ Account
│ ├ Client
│ └ Transfer
└── Infrastructure
But, if you consider to create microservices in feature (in case when your project is really huge) you can follow your option #1, because it will be easier to split them to separate projects.
Upvotes: 5