Reputation: 1
I'm developing a java application that has 20 plugins, each plugin's have some similar GUI menu item's and menu event's but they store data in different table's in a database. Currently I'm creating separate GUI, event and model classes for each plugin by copying and pasting in diffrent class files.
Is it wise to develop separate GUI, event and model classes for each plugin's and duplicate similar methods to other plugin's?
I need your advice on how to create a generic GUI, event and model interface for all the plugin's without making my application uneasy to maintain.
Thank you.
Upvotes: 0
Views: 839
Reputation: 214
We have a plug-in system in our product, and ran into the same issue. Many of the plug-ins share a lot of code. We ultimately decided on the following:
Example:
public interface MyProductInterface { public void doIt(); } public class MyPlugin implements MyProductInterface extends AbtractPlugin { public doIt() { // ... usefulMethodForMostPlugins(); /// ... } } public abstract class AbstractPlugin { public usefulMethodForMostPlugins() ... }
Upvotes: 1