to pass, or not to pass, that is the question
Posted: Mon Apr 17, 2006 7:54 pm
Well I've been working on some small app's to familiarize myself with the Zend Framework, and when using their filter system I seem to have come to a design question which I could use some input on.
Well, when designing some modules there is a possibility for them to default to a value, or set a value.
For instance, I'll have a view which may or may not have an id to be passed to it. In the Zend Framework, their filters will return false if the value is not valid.
What I want to know is, should I
- Set the default value when I know its an invalid paramter (indicated by the comment)
- Keep the false value, and pass the variable
- Pass nothing to the view and let it check the simple logic
Not really a big deal, but I am wondering if anyone has any thought on this?
Well, when designing some modules there is a possibility for them to default to a value, or set a value.
For instance, I'll have a view which may or may not have an id to be passed to it. In the Zend Framework, their filters will return false if the value is not valid.
Code: Select all
if (($newsId = $filtered->testDigits('newsid')) == false)
{
//invalid paramater
}
$this->view->paintNewsArticle($newsId);
$this->view->paintNewsComments($newsId);- Set the default value when I know its an invalid paramter (indicated by the comment)
- Keep the false value, and pass the variable
- Pass nothing to the view and let it check the simple logic
Not really a big deal, but I am wondering if anyone has any thought on this?