This isn't really ZF but it's through implementing a view helper that the
question has come up.

I want to extend the URL helper, easy enough. But then I use the attributes
method a lot in my classes (as does ZF in it's view helpers). (i.e. loop
through options and display them as the html attributes class="" title=""
etc. etc.).

This led me to thinking in procedural coding I'd have a functions.php with
getAttribs() as a function and use it throughout my code. Now if I was
developing the class I'd of extended my base class which would contain
getAttribs. But I can't do this with a ZF component so the URL helper needs
to be the parent as I can't obviously change the lib code.

I see the ZF simply reuses the function again and again in various classes.
This has the advantage of not requiring any extra elements to run a
component. But does mean you have code duplication...

So do I have a functions.php with the function in and just call it or do I
have a function repository class (I would assume this goes against OOP
prinicpals). Do I create a static class containing methods? Again not really
what OOP is for?! Or do I just repeate the method in my classes where I need
it?... Extending a base class if I can?

Your thoguhts would be greatly appreciated.

Simon

-----
Simon

http://www.ajb007.co.uk/
-- 
View this message in context: 
http://www.nabble.com/Using-a-Function-Repository-with-Classes-tp17709850p17709850.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to