我的ASP.NET MVC应用程序是Anemic

时间:2022-09-05 04:13:04

I read Fowlers description of Anemic Domain and I believe I have those symptoms. I have several objects doing nothing but passing data around in different packages. I also have several Services that pretty much handle all the behavior (executive functioning). I am starting to lose track of why and what i did and where to find certain tasks.

我读过Fowlers对贫血领域的描述,我相信我有这些症状。我有几个对象什么都不做,只是在不同的包中传递数据。我也有几个服务,几乎处理所有行为(执行功能)。我开始忘记为什么和我做了什么以及在哪里找到某些任务。

The application does what I want, but i wonder if i just have a procedural program in oo disguise. Perhaps I can never shake my procedural programming past? should I?

该应用程序做我想要的,但我想知道我是否只是伪装的程序程序。也许我永远不能动摇我的程序设计过去?我是不是该?

In MVC, Should I eliminate my services and spread that responsibility to my Controllers and Model Objects?

在MVC中,我应该消除我的服务并将责任分散到我的控制器和模型对象中吗?

I appreciate analogies between MVC concepts and DDD conepts...

我很欣赏MVC概念和DDD conepts之间的类比......

2 个解决方案

#1


I think controllers should be relatively thin. Their job is mainly being taking the request, delegating it to the appropriate application services and determining the correct action result.

我认为控制器应该相对较薄。他们的工作主要是接受请求,将其委托给适当的应用程序服务并确定正确的操作结果。

If you're feeling that your domain entities are overly anemic I would suggest going over your Services and determine whether that functionality belongs on an Entity instead. I found this was my biggest problem starting with DDD was that I would push all behavior to Services rather than critically thinking about whether this was something more appropriate on the Entity.

如果您觉得您的域名实体过于贫乏,我建议您查看服务并确定该功能是否属于实体。我发现这是我从DDD开始的最大问题是我会将所有行为推送到服务而不是批判性地考虑这是否更适合实体。

#2


Why don't you try the Evans book as suggested in one of your previous questions?

为什么不按照之前的一个问题中的建议尝试埃文斯的书呢?

#1


I think controllers should be relatively thin. Their job is mainly being taking the request, delegating it to the appropriate application services and determining the correct action result.

我认为控制器应该相对较薄。他们的工作主要是接受请求,将其委托给适当的应用程序服务并确定正确的操作结果。

If you're feeling that your domain entities are overly anemic I would suggest going over your Services and determine whether that functionality belongs on an Entity instead. I found this was my biggest problem starting with DDD was that I would push all behavior to Services rather than critically thinking about whether this was something more appropriate on the Entity.

如果您觉得您的域名实体过于贫乏,我建议您查看服务并确定该功能是否属于实体。我发现这是我从DDD开始的最大问题是我会将所有行为推送到服务而不是批判性地考虑这是否更适合实体。

#2


Why don't you try the Evans book as suggested in one of your previous questions?

为什么不按照之前的一个问题中的建议尝试埃文斯的书呢?