designing plugin architecture

hi everybody

I guess this is not a java-specific question, but this is the best forum I know ;-)

recently I posted a topic asking for nice plugin frameworks to include into my projects, and I decided to go with JPF... also because I haven't found any other option =P

shortly I'll begin a medium-sized personal project (my first attempt) in which I'll use this framework, allowing my application to be extended with plugins, and I want to create it with a "perfect" design... it's like training all that good programming techniques and all... for someone like me, a programmer with some coding time, but little/no contact to nicely designed applications, it's a nice challenge! =P

then I was wondering about how a basic plugin architecture design should look like and how it should behave, and I couldn't find some docs or guides on that.

I was thinking of something like this:

- interface-based extension points for the plugins that will be used to extend my application (pretty obvious)

- plugins being invoked by these interfaces, working only over internal and parameter data (i.e.: no access to main application classes)

- all the communications from the plugins to the main application should be done using observable-observer pattern

- the plugins should have "no chance" of holding "important" objects of the main application (like controls, GUI components, data descriptors...) - if something like this is "unavoidable" (like a plugin used to reformat a text document), use a copy of the object or part of it (sounds like a step towards performance problems)

this is a sketch of what's coming to my mind... can you guys help me to polish/correct it?

many thanks!

[1750 byte] By [dev@javaa] at [2007-10-2 23:09:25]
# 1

Learn the following Patterns:

- Command Pattern to provided a unified interface for each of your plugins.

- Bridge Pattern to seperate the interface of your plugins from their implementation.

- Subject Observer Pattern to provide callbacks to your applictions for plugins.

- Memento Pattern for passing parameters into your plugins and back to your appliction.

MartinS.a at 2007-7-14 6:23:20 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
thanks, martin!but... "Subject Observer"... is it observer/observable pattern, or another one?
dev@javaa at 2007-7-14 6:23:20 > top of Java-index,Other Topics,Patterns & OO Design...
# 3
> but... "Subject Observer"... is it> observer/observable pattern, or another one?Yes, sometimes called publish-subscribe.
MartinS.a at 2007-7-14 6:23:20 > top of Java-index,Other Topics,Patterns & OO Design...
# 4
I would also suggest looking closely at the Builder pattern.
dubwaia at 2007-7-14 6:23:20 > top of Java-index,Other Topics,Patterns & OO Design...