In DDD Architecture where do I keep helper classes?

*爱你&永不变心* 提交于 2019-12-20 02:07:14

问题


I'm working in a DDD project where contains these layers: UI, Application, Domain and Infrastructure.

Where should the helpers classes live?

Update:

I'm talking about a Object Dumper Helper for example.


回答1:


It depends on what kind of helper you are talking about.

If it's a Helper that format a value in a friendly display format, then it would fit better in the UI. If you are talking about a SqlServer helper, then it goes to Infra.




回答2:


Classes like [Something]Helper, [Something]Manager and [Something]Util are too generic and often indicate the fact that nobody really thought about a proper name and their responsibility. They tend to grow over time accumulating random pieces of code. So instead of finding the right place for your 'Helper' you should probably rename it and it will become clear whether they belong to Infrastructure or elsewhere.

Note that every .NET object already has a method for diagnostics and logging. So you may not need 'Object Dumper Helper':

ToString is intended to be used for general display and debugging purposes.




回答3:


Assuming Infra stands for Infrastructure, that's where.



来源:https://stackoverflow.com/questions/7436366/in-ddd-architecture-where-do-i-keep-helper-classes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!