I'm building an application that interacts with forum boards .. getting various bits of information like posts and users online. I'd like to be able to be able to add definitions for particular forums .. eg IPB, phpBB, custom boards. I've read the code and docs for Swift, and I really like the plugins idea. I'd rather like to implement a similar sort of thing .. but I'm not 100% on exactly how it works. What should I plan prior to attempting to write a plugin system?
Or.. is this a daft way of doing this?
Plugins (like Swift)
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Re: Plugins (like Swift)
If you're going with the way it's done in Swift you might want to have a read of a discussion here: http://www.sitepoint.com/forums/showthread.php?t=379440onion2k wrote:I'm building an application that interacts with forum boards .. getting various bits of information like posts and users online. I'd like to be able to be able to add definitions for particular forums .. eg IPB, phpBB, custom boards. I've read the code and docs for Swift, and I really like the plugins idea. I'd rather like to implement a similar sort of thing .. but I'm not 100% on exactly how it works. What should I plan prior to attempting to write a plugin system?
For something like Swift's plugin system to work you really need to be willing to put key items into public properties so that they can be modified in the plugins. Another approach would be to have public accessors to grab these items but it doesn't really make a difference. I think it was arborint who said that perhaps passing items as parameters wuld be a good idea, but my only reservation was how do you know for sure that the plugin author wants access to that particular item even though that might seem like the obvious thing to do.
It's dead simple how it works.... all it's doing really is checking to see if a method exists in a loaded object and running it if it's there.
I've been looking at how other people are implementing plugins but they seem to presumtious about what the plugin should be doing so I haven't grown on some of the ideas. ~dreamscape on sitepoint's play on what I've done is pretty cool with a really amusing example too
Bare in mind that this plugin system was written with the focus being on allowing several plugins to be loaded at once and having plugins respond only when asked to (some systems constantly check if the plugin is doing anything, this *asks* the plugin to do something).
Possibly
Or.. is this a daft way of doing this?