Re: [fw-general] ZFW OO coding guideline

2009-06-22 Thread Karol Grecki
Yes that's exactly what I was doing as the original post had no details or actual requirements. I read his question as follows: "I need to call this global function somewhere inside ZF code, how to do it in a ZF way?" That functionality most likely belongs somewhere, maybe in a view helper or acti

Re: [fw-general] ZFW OO coding guideline

2009-06-21 Thread Matthew Ratzloff
My point was that Karol was making a broad statement without knowing the actual details of the original poster's actual requirements. There are, of course, ways to keep static methods in Zend_Registry et al and make them testable at the same time. You just have to build the functionality into the

Re: [fw-general] ZFW OO coding guideline

2009-06-21 Thread Matthew Weier O'Phinney
-- Matthew Ratzloff wrote (on Sunday, 21 June 2009, 05:22 PM -0700): > How silly.  What is Zend_Registry, then?  Zend_Controller_Front?  They're all > singletons. Singletons, yes. Should ZF have them? I'm leaning towards, "no," as they are hard to test, and harder still for users to test their c

Re: [fw-general] ZFW OO coding guideline

2009-06-21 Thread Matthew Ratzloff
How silly. What is Zend_Registry, then? Zend_Controller_Front? They're all singletons. Should all factories be implemented as instance methods, too? Let's say this class he's talking about returns an ad for a given set of dimensions and providers. What is so wrong with My_Ad::factory(), with a

Re: [fw-general] ZFW OO coding guideline

2009-06-21 Thread Karol Grecki
"global functional object" sounds like a very fancy name for procedural code with global functions. Code like this will never be consistent with ZF and is generally considered bad. Deciding how to call a method should probably be the least of your concerns. You should also write PHP5 code if you w

Re: [fw-general] ZFW OO coding guideline

2009-06-21 Thread Matthew Ratzloff
If it's just a namespaced function, MyClass::foo() is probably fine. BTW, unless you're using PHP 4, the pass-by-reference stuff is unnecessary. PHP 5 always passes objects by reference. -Matt On Sun, Jun 21, 2009 at 9:50 AM, howard chen wrote: > Hello, > > It is not a 100% zfw question, but a

[fw-general] ZFW OO coding guideline

2009-06-21 Thread howard chen
Hello, It is not a 100% zfw question, but as I am coding under zfw, so I want if my OO coding is consistent with the zfw. Example: I have a Class - MyClass, it is a global functional object, has the function foo() I need to call in several php files for a single HTTP request. clas