2009年7月10日星期五

Re: [fw-mvc] Static view helpers

In general static classes should not be used. It makes testing harder, and in some cases, they're just glorified global functions


On Fri, Jul 10, 2009 at 2:06 PM, Exception e <exceptione@hotmail.com> wrote:


Matthew Weier O'Phinney-3 wrote:
>
> Just because a class is stateless doesn't mean you should necessarily
> make it static. If you need later to make it stateful, the static
> members will get in your way; if you later need to extend it, static
> members can often make extension difficult.
>
Since you've programmed quite a few miles now, I want to ask you (input of
others is also welcome of course) in what case one should consider creating
a static class in your opinion.


Since Zend_View allows you to simply access the helper directly, just
> create a regular helper. You can always instantiate it without Zend_View
> and utilize it.

Ok, so then I will use class NameSpace_View_Helper_Format extends
Zend_View_Helper_Abstract {} Thanks.
--
View this message in context: http://www.nabble.com/Static-view-helpers-tp24428415p24432190.html
Sent from the Zend MVC mailing list archive at Nabble.com.


没有评论: