开发者

how do we create plugin / extensions in object oriented programming?

How does software allow developers to make a plugin / exte开发者_如何学JAVAnsions on top of its core? How is that related to object oriented programming? maybe with inheritance or interfaces? What kind of design pattern should one use?

For example, firefox extensions that enhance firefox, wordpress extensions, etc. Those systems sort of "recognize" plugins after being installed and work well and in some cases they perform safety checking, dependencies, and the like.

Anyone care to shed light on this?


Plugin models in real applications like firefox may be more complex than they are in general. In general you define some interface that a plugin should implement, and implement it in your plugins, that's it. Modern frameworks contain plugin development facilities like MEF in .NET, mojo in Java, etc.


Java supports a basic plug-in mechanism through its SPI (Service Provider Interface). The main mechanism revolves around discovery and binding of the new provider. Below two articles will get you started

  1. Replaceable Components and the Service Provider Interface
  2. Creating Extensible Java Applications

There are open source frameworks that are more powerful than provided by JDK

  1. JPF
  2. JSPF

But OSGi is the standard and mother of all plugin frameworks in my opinion.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜