LemonInflux Posted May 9, 2008 Share Posted May 9, 2008 Hello, I'm just wondering how to make an efficient plug-in system. So far, I've thought of including the class, and putting all the plug-in functions into the constructors and destructors, however I was wondering if there is a better way of doing it. Has anyone got any experience in creating plug-ins? Thanks in advance, Tom. Quote Link to comment Share on other sites More sharing options...
trq Posted May 10, 2008 Share Posted May 10, 2008 You might want to take a look at the filter chain pattern. Can be usefull in this type of situation depending on how your application is designed. Quote Link to comment Share on other sites More sharing options...
448191 Posted May 10, 2008 Share Posted May 10, 2008 AFAIK there is no 'official' pattern called 'Filter Chain'. There's Java's Filter.Chain, but that's an implementation of Intercepting Filter. There's Chain of Responsibilty, which can be used for chaining filters. The Composite pattern can be used to assemble highly specialized filters. Decorator can be used to create filter chains as well. Last, but not least, the Plugin pattern could be used for this purpose. The latter probably being what the TS is after: linking (any purpose) classes during configuration time, rather than compilation time. Check out this thread for an example of Plugin: http://www.phpfreaks.com/forums/index.php/topic,189363.msg851770.html#msg851770 Quote Link to comment Share on other sites More sharing options...
trq Posted May 11, 2008 Share Posted May 11, 2008 Its the intercepting filter pattern I was likely talking about, I'm really not up on the names of patterns much, Ive always refered to it as a filter chain, not sure where that might have come from. Quote Link to comment Share on other sites More sharing options...
448191 Posted May 11, 2008 Share Posted May 11, 2008 Intercepting Filter is mostly useful for manipulating your request and response objects. For example, you might have a filter which checks some ACL rules and changes the dispatch target to an 'unauthorized' page when appropriate. Combinations with the Plugin pattern are common, if not implied by definition. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.