DISQUS

DISQUS Hello! Thoughts for PHP gurus is using DISQUS, a powerful comment system, to manage its comments. Learn more.

Community Page

Jump to original thread »
Author

Helpers are unhelpful

Started by counterpoint · 6 months ago

It isn’t new to have doubts about helpers.  One provocative blog by Nick Malik grabbed attention with the title “Are Helper Classes Evil?“.  That talked about helper classes, defined as classes consisting entirely of static methods.  I wanted to ... Continue reading »

8 comments

  • 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?
  • 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!
  • Sure helpers can be unhelpful... but surely non-static is the way to go...
  • Hello! Interesting article. I am learning php, thanks for the explanation on why non static is the best way to go!
  • 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.
  • 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.
  • As per my two cents, helpers help in making designs more lucrative. IMplication is a bit complex though, I agree on that.
  • 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! :)

Add New Comment

Returning? Login