L
Lza
Hey,
I have a system that I am trying to design, it contains news articles,
events, etc... There is class representing articles, one representing
events, etc...
Articles or events can be active or inactive, so I can do a query to
return all active articles, all articles or all inactive articles.
The question that I have is what would be the best way to design this.
Right now I have each method (such as recentArticles,
featuredArticles, etc...) taking an 'active' parameter. This requires
littering
the code with method calls taking this parameter.
I have also thought about setting a class variable on the models to set
whether active/inactive/all articles are returned, so that anytime you
want to set the type returned you set this class variable and then call
your functions (recentArticles, etc...).
What I would like to know is if there are any suggestions as to a good
practice to follow in how to implement this functionality, one of the
ways I have stated or some other way that I haven't considered.
I hope I have been clear. Thanks for the help in advance.
I have a system that I am trying to design, it contains news articles,
events, etc... There is class representing articles, one representing
events, etc...
Articles or events can be active or inactive, so I can do a query to
return all active articles, all articles or all inactive articles.
The question that I have is what would be the best way to design this.
Right now I have each method (such as recentArticles,
featuredArticles, etc...) taking an 'active' parameter. This requires
littering
the code with method calls taking this parameter.
I have also thought about setting a class variable on the models to set
whether active/inactive/all articles are returned, so that anytime you
want to set the type returned you set this class variable and then call
your functions (recentArticles, etc...).
What I would like to know is if there are any suggestions as to a good
practice to follow in how to implement this functionality, one of the
ways I have stated or some other way that I haven't considered.
I hope I have been clear. Thanks for the help in advance.