Mechanisms to override behavior

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

What about the filter knowing which modules it overrides? While that does add work for you if you want more overrides, it is in a centralized location that is fairly simple to find.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

You mean instead of disableFilter($filtername) you say disableFiltersOfModule($modulename)?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Potentially. There are many ways one could go. It could be a query point for the manager to interrogate the filter for example.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Not sure what you mean. What would one example be, showing a use-case with the least overhead for a simple "add filter, don't care about overriding others"?
wei
Forum Contributor
Posts: 140
Joined: Wed Jul 12, 2006 12:18 am

Post by wei »

May be an observer on the add/remove method of the manager can be used to disable/enable particular filters, this leaves the Filter itself simple, and delegate the task of complex filter list manager to another class thus providing reuse as well.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

I've rethought my situation and I've decided that a filter manager, for now, is complete and utter overkill but can be added in later with very little pain (the old "API" would still be available, just without any cool features). I don't plan on fostering a bustling "mod community", so any conflicts from user-space extensions will have to be dealt with by those individuals.

I'll keep in mind these ideas for other situations, though.
Post Reply