Adding by class and by instance

We can add a plugin to a plugin manager either by specific instance or by class.

Adding by class means we just say what kind of plugin we're adding. If it's never needed it may never get instantiated. This is the truly modular approach because the plugin cannot be pre-configured. If it needs to wire itself up to other plugins when it starts then it almost certainly has to go via the plugin manager. It also requires one less line of code.

Adding by instance means we construct a new specific instance of the plugin and add that. This is perhaps more intuitive but may lead to bad habits.

Nik Silver 2002-03-09