DISQUS

Thoughts for PHP gurus: Helpers are unhelpful

  • William · 9 months ago
    I can see why helpers in some cases are unhelpful, but is it beneficial to make them into non-static, or is it just a question about what's more logical to do?
  • counterpoint · 9 months ago
    Well, certainly it is always better for methods in PHP to be non-static, but this becomes unnatural if an object is created for no other reason than to run a method (running it as if it were a function, not having any particular relationship to the object). This points to one of the key problems - misuse of helper methods often results in what is really a bunch of functions. Nothing wrong with functions, but they aren't OO!
  • seo · 8 months ago
    Sure helpers can be unhelpful... but surely non-static is the way to go...
  • Emprestimo Pessoal · 6 months ago
    Hello! Interesting article. I am learning php, thanks for the explanation on why non static is the best way to go!
  • eddiew21 · 5 months ago
    Our experience with helpers is that although they are poorly understood they are simply not used enough. The name itself suggests its an almost inconsequential piece of development while for our purposes, they keep the rest of the code clean.

    I say the more the merrier.
  • Abby · 4 months ago
    It would probably be more appropriate if terms used in software development would be more unique in some way so that it would be misinterpreted by people who are not familiar with its meaning.
  • Forex Robot · 4 months ago
    As per my two cents, helpers help in making designs more lucrative. IMplication is a bit complex though, I agree on that.
  • Queda de Cabelo · 4 months ago
    I am looking for info on the non static vs static php option. Interesting article, I have more questions now than before I read it! :)