OSGI 中的可靠原则

Solid Principles in OSGI

我正在阅读这篇文章:

http://java.dzone.com/articles/solid-principles-modularity

并且作者指出,使用 SOLID 原则最重要的地方是模块接头,"It is these joints within the system that require the greatest flexibility and resiliency. The reason for this is driven by change. Change that is encapsulated within a single module poses less threat than change that ripples across many modules."。

因为可以使用 OSGI 来定义这些关节,所以我决定研究 OSGI 以了解它如何使用 SOLID 原则。

单一职责很简单,module/bundle/jar 应该只做一件事。依赖倒置原则对我来说似乎很清楚,module/bundle/jar 中的实现不应该依赖于另一个实现,而是依赖于一个抽象。并且模块不应公开任何实现细节。 OSGI 通过创建一个发布或引用服​​务的组件模型来做到这一点。

但是其他原则呢?比如里氏代换原则或者接口隔离原则,在OSGI中哪里可以找到这些的例子?

模块需要符合其发布的接口(Liskov 替换),这是它唯一的入口点(接口隔离)。