3 ms·
My use of "concrete types" was merely a proxy for any code upon which client code should not have an explicit dependency. I don't see interfaces and plugins as
by jedbrown 17y ago
My use of "concrete types" was merely a proxy for any code upon which client code should not have an explicit dependency.
I don't see interfaces and plugins as being orthogonal at all, you can't very well have plugins without interfaces (it wouldn't be much of a plugin if the client depended on the "plugin" itself). Besides, orthogonal vectors don't get you to the same place. ;-)
In my opinion, the defining feature of a plugin is that it can be loaded and used with no modification of the code that uses it. On architectures with dynamic loading, this means you can drop a DSO somewhere and use it without code modification or relinking. "Factories", as usually described, would require some modification of the factory to support this new implementation (perhaps just a single line). A "factory" with a runtime-extensible list of implementations that it knows about, is a plugin architecture, but a plugin architecture need not look anything like a factory.
- raganwald 17y agoI think that some of our discussion around terms is an artefact of discussing a manifestly typed language like C. But if we handwave and say that "interface" is any dependency with at least one level of indirection and "concrete type" is any dependency with no levels of indirection, I agree that you can't implement plugins without some indirection somewhere. That being said, you clearly can implement indirection without plugins. I think of a plugin architecture as being composition at a coarse level. In the case of a factory with a runtime list of implementations, I think of that as a factory and a plugin architecture, possibly that the plugin architecture is implemented with a factory.