Solid Principles in OSGI

I was reading this article:

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

and the author states that the most important place to use the SOLID principles is at the module joints, “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.”.

Because OSGI can be used to define these joints, I decided to look at OSGI to see how it uses the SOLID principles.

Single Responsibility is an easy one, a module/bundle/jar should do one thing only. Dependency Inversion Principle seems clear to me, a implementation in a module/bundle/jar should not depend on another implementation but on an abstraction. And the modules should not expose any implementation details. OSGI does this by creating a component model that publish or reference services.

But what about the other principles? For example Liskov substitution principle or the interface segregation principle, where can I find examples of these in OSGI?

Answer

A module needs to conform to its published interface (Liskov Substitution) which is its only entry point (interface segregation).

Leave a Reply

Your email address will not be published. Required fields are marked *