知识卡片
服务访问方式服从职责设计
先确定服务承担的领域责任,再决定如何让调用方访问它。普通执行对象或简单单例都可承载服务接口;只有确有分布式部署或框架能力需求时,才需要更复杂的发布机制。访问机制是交付接口的手段,不会把没有业务意义的技术对象变成领域概念。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 原书第05章|Services · 查看原书依据
The means of providing access to a SERVICE is not as important as the design decision to carve off specific responsibilities. A "doer" object may be satisfactory as an implementation of a SERVICE's interface. A simple SINGLETON (Gamma et al. 1995) can be written easily to provide access.
参考来源
- 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第40章《原书第05章|Services》(源文件:_epub-src/0321125215_ch05lev1sec4.html)
- 结论依据:原文对比 J2EE、CORBA 发布机制与普通执行对象、单例,明确职责划分比服务访问方式更重要,复杂架构须有实际需要。
- 原始内容:The means of providing access to a SERVICE is not as important as the design decision to carve off specific responsibilities. A "doer" object may be satisfactory as an implementation of a SERVICE 's interface. A simple SINGLETON ( Gamma et al. 1995 ) can be written easily to provide access. ... Elaborate architectures should be used only when there is a real need to distribute the system or otherwise draw on the framework's capabilities.