Is a plugin design required?

The project that my group is launching will focus on using plugins that are extremely user specific. We are essentially trying to create an application that, without the plugins, is nothing more than a runtime, and therefore would involve adding custom plugins.

I am not too experienced in this area of ​​application development around plugins. How do I go through this process of creating a basic, essentially abstract application, and then creating these "dynamic" custom plugins that the application will use?

+2


source to share


1 answer


As "hobbs" pointed out, knowing the language would be helpful for getting a better answer!

Regardless, I'll tell you about the command design pattern that is often used in Java or any other object-oriented language.

See Command Design Pattern - Wikipedia and Command Design Pattern - Java 68 Hint (for implementation details)

I use this pattern a lot when I know I want to run "plugins" in general (sometimes when I don't have all the details at this point in time). With additional specifications and / or security restrictions, you will want to modify this template to accommodate those restrictions and include sandbox restrictions, etc. It all depends on you!

Your client will start by writing plugins using the interface you provide them (see links above). With a compiled class, your clients will then be able to dump their plugins into a folder for example.

When your application is ready to run plugins, you have to load a list of plugin candidates (either an xml file or browse class files in a specific directory), and load each class to execute them one by one.



You can decide if you want to run these plugins in sequence or in parallel (threaded project).

Note that if your plugins need to access a specific state or API, you can provide it as a parameter to your plugin.

This all works great and I'm sure it can be easily adapted to any language.

Good luck,

Jeach!

+2


source







All Articles