富域模型的接口 [英] Interfaces for Rich Domain Models

查看:72
本文介绍了富域模型的接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Rich Domain Models是否应具有在单元测试期间(例如,在测试使用该模型的服务时)帮助隔离的接口?

Should Rich Domain Models have interfaces to assist with isolation during unit testing (e.g. when testing a service that uses the model)?

还是Rich Domain Model行为参与任何相关的单元测试吗?

Or should the Rich Domain Model behaviour be involved in any related unit tests?

编辑:

通过Rich Domain Model,我专门指域包含逻辑(即非贫血)的实体。

By Rich Domain Model I'm specifically referring to domain entities that contain logic (i.e. non-anaemic).

推荐答案

通常,域模型是您应与之隔离的部分其他一切。域模型可以使用接口,以便与外部系统等隔离。

Usually, the Domain Model is the part that you should keep isolated from everything else. The Domain Model may use interfaces so that it's isolated from external systems, etc.

但是,在最常见的情况下,域模型是您要保护自己免受外部系统,UI逻辑等不断恶化的影响的方法-并非相反。

However, in the most common scenarios, the Domain Model is what you're trying to protect from the deteriorating influences of external systems, UI logic, etc. - not the other way around.

因此,没有理由放置接口在域模型上。

Thus, there's little reason to put interfaces on the Domain Model.

这篇关于富域模型的接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆