The plug-in pattern is a design pattern. I believe it is widely used, but I have not seen it described anywhere, and plug-in pattern is the name I have given it.
The pattern have three actors:
- The plug-in (sometimes called the client), which is plugged into the host.
- The host of the plug-in.
- The plug-in expose data and functionality to the host, but the plug-in may also need to draw upon data and services from the host. The site represent the plug-in's host access.
There are two contracts in the pattern:
- The plug-in interface, which defines the hosts view of the plug-in
- The site interface, which defines the plug-in's view of the host
A SAPI (i.e. Speech API) speech recognizer engine is a plug-in hosted by the Windows SAPI system.
The engine is the plug-in and Windows SAPI is the host. The plug-in must implement the interface ISpSREngine, which is the host's view of the engine.
In the recognition process the host will feed audio buffers; notify grammar loads and unloads; etc through the ISpSREngine interface. On the other hand, the plug-in will return recognition results; interrogate about grammar details; etc. through the site (ISpSREngineSite) object.