Which design pattern fits - strategy makes sense ?
Posted
by
user554833
on Stack Overflow
See other posts from Stack Overflow
or by user554833
Published on 2010-12-27T09:40:43Z
Indexed on
2011/01/01
17:54 UTC
Read the original article
Hit count: 239
design-patterns
--Bump *One desperate try to get someone's attention
I have a simple database table that stores list of users who have subscribed to folders either by email OR to show up on the site (only on the web UI). In the storage table this is controlled by a number(1 - show on site 2- by email). When I am showing in UI I need to show a checkbox next to each of folders for which the user has subscribed (both email & on site).
There is a separate table which stores a set of default subscriptions which would apply to each user if user has not expressed his subscription. This is basically a folder ID and a virtual group name.
But, Email subscriptions do not count for applying these default groups. So if no "on site" subscription apply default group. Thats the rule.
How about a strategy pattern here (Pseudo code)
Interface ISubscription
public ArrayList GetSubscriptionData(Pass query object)
Public class SubscriptionWithDefaultGroup
Implement ArrayList GetSubscriptionData(Pass query object)
Public class SubscriptionWithoutDefaultGroup
Implement ArrayList GetSubscriptionData(Pass query object)
Public class SubscriptionOnlyDefaultGroup
Implement ArrayList GetSubscriptionData(Pass query object)
does this even make sense? I would be more than glad for receive any criticism / help / notes. I am learning.
Cheers
© Stack Overflow or respective owner