sla*_*kpl 4 architecture legacy domain-driven-design directory-structure
我正在处理遗留项目,试图改进项目结构。我的问题是我应该如何组织代码结构。我看到两个选择:
#1 业务域/层
app/
----accout/
--------application/
--------domain/
--------infrastructure/
----client/
--------application/
--------domain/
--------infrastructure/
----transfer/
--------application/
--------domain/
--------infrastructure/
Run Code Online (Sandbox Code Playgroud)
或#2层/业务域
app/
----application/
--------account/
--------client/
--------transfer/
----domain/
--------account/
--------client/
--------transfer/
----infrastructure/
--------account/
--------client/
--------transfer/
Run Code Online (Sandbox Code Playgroud)
哪种方法更适合遗留项目?根据您的经验,哪个更可取?
从我的角度来看,#1 将在进一步重构期间实现系统解耦。另一方面,对于遗留项目来说,#1 似乎更容易实现。
相应地,要在 php 中预订ddd ,您可以创建模块,在本例中,它将如下所示:
\n\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80src\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Application\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 Domain\n \xe2\x94\x82 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Model\n \xe2\x94\x82 \xe2\x94\x9c Account\n \xe2\x94\x82 \xe2\x94\x9c Client\n \xe2\x94\x82 \xe2\x94\x94 Transfer\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Infrastructure\nRun Code Online (Sandbox Code Playgroud)\n\n但是,如果您考虑在功能中创建微服务(如果您的项目非常庞大),您可以遵循选项#1,因为将它们拆分为单独的项目会更容易。
\n