松耦合设计中的常用定义

I'm trying to put together a very granulary loose coupled design.

But I can't decide how to handle common definitions.

Right now I seperate concerns by adding it as an external dll. Through injection and interfaces my domain can use my business logic without knowing the implementation.

The problem I'm having is that for all my components to be loosely coupled, they need to implement the same interfaces. My solution was a seperate project (dll) with just all the definitions. This started out well, but seems to become bloathed and chains all code together on this one dll-dependency.

What's the most pragmatic way to go about ?

Thanks!

#0

I would say, that the layer should only know about the next layer and its interfaces, so it is fine to place interfaces along with their implementations and then add references between layers (assemblies) in the chain.

You can configure DI using bootstrapper pattern and resolve through the locator. Regarding cross cutting concerns like logging, caching ect there should be separate assembly referenced to each layer. Here you can also employ contracts and in the future perhaps replace these cross cutting functionalities with another assembly implementing the same contracts.

Hope this helps at least a bit :)

#1

EDIT

Sorry I think I initially misunderstood your question. So you have one assembly which contains your interfaces and you have your implementations in other assemblies using DI to create your dependant objects. I tend to create a core assembly in my application which holds the main behaviours of the app (smart entities, enums and interfaces). This assembly depends on little but is heavy depended on by the rest of the application. Check out this project as an example - whocanhelpme.codeplex.com. You could call this core bloated but it, by definition, needs to be very rich.


You might find that many of your abstract units follow common design patterns. Here is a site that gives a good description of each one - you may be able to derive names from these (Observer, Factory, Adapter etc.):

http://www.dofactory.com/Patterns/Patterns.aspx

推荐文章

Elasticsearch 全字段搜索_all,query_string查询,不进行分词

Elasticsearch 全字段搜索_all,query_string查询,不进行分词

推荐文章

课时2微信小程序开发准备

课时2微信小程序开发准备

推荐文章

ELK平台性能优化(不断完善中)

ELK平台性能优化(不断完善中)

推荐文章

Elasticsearch的field类型。

Elasticsearch的field类型。

推荐文章

百度2016研发工程师在线编程题

百度2016研发工程师在线编程题

推荐文章

你的知识死角不能否定你的技术能力

你的知识死角不能否定你的技术能力

推荐文章

从logstash -> output -> elasticsearch动态模板说起

从logstash -> output -> elasticsearch动态模板说起

推荐文章

百度翻译 接口使用实例

百度翻译 接口使用实例

推荐文章

前端直接调试微信获取jsdk签名以及微信登录授权(node)

前端直接调试微信获取jsdk签名以及微信登录授权(node)

推荐文章

移动端、手机调用百度地图 Demo

移动端、手机调用百度地图 Demo

推荐文章

微信小程序 WXS 不了解一下?骚骚的实现各大前端框架中的 filter

微信小程序 WXS 不了解一下?骚骚的实现各大前端框架中的 filter

推荐文章

致贾卫敏

致贾卫敏

推荐文章

ElasticSearch关联查找

ElasticSearch关联查找

推荐文章

【Python】:如何安装及编译python程序

【Python】:如何安装及编译python程序

推荐文章

把Elasticsearch作为时间序列数据库使用

把Elasticsearch作为时间序列数据库使用

推荐文章

Android仿百度加载动画

Android仿百度加载动画