Tuesday, June 9, 2009

Zen of OSGi

Even though my favorite languages are Scala and Java (yes, Scala comes first ;-) ), I used to use the Python programming language quite a lot. Python has some very well thought out design elements and programming patterns. The Python community actively communicates these patterns and continues to promote their use. As a result of this, the Zen of Python (http://www.python.org/dev/peps/pep-0020/) was created to capture them in a jokey, but still useful way. There is even an easter egg in the Python interpreter (hint: "import this").

While beeing a platform technology in its core, the OSGi technology seems to use and promote certain patterns as well. The Whiteboard and Extender pattern are well-known examples for this. So why shouldn't we put these patterns in a more jokey and useful way?

Zen of OSGi
  1. Graphs are better than trees.
  2. Prefer services over objects.
  3. Import is better than required.
  4. Although required is better than classpath.
  5. Only export stuff you want to provide support for.
  6. Once you support something, support it forever.
  7. Import your exports.
  8. Minimise your dependencies.
  9. But do not omit imports you really use.
  10. Do not rely on start ordering.
  11. Listen to your customer, do not make them listen to you.
  12. Communicate your version policy.
  13. Be as permissive as possible but no more.
  14. Use the obvious OSGi way.
  15. Although that way may not be obvious at first unless you're Dutch.
  16. Expect the unexpected (especially when you are dealing with services).
You can even discover some interesting similarities between these two Zens.

Any important rules missing?