Helper is a commonly used name appendage.
However, it communicates very little about what it does. Every time I have seen it used I have found it to be a suboptimal name.
In fact I consider it to be a code smell that indicates more problems underneath.
Example
Suppose we see the name "WidgetHelper" (here "widget" is a stand-in name for any sort of programmable functionality, and not necessarily a UI widget):
class WidgetHelper:
...
What do we learn from the name? We know the object or function does some kind of work secondary to the widget. It is my experience that this might not even actually be true, and one might delete "helper" from the name and improve the communication.
For another possibility, "WidgetHelper" could be wrapping the widget, such that the widget code itself may know nothing about the helper. The implication is that WidgetHelper in this pseudocode example is part of the public API:
class WidgetHelper:
def __init__(self):
self.widget = Widget()
...
In this case, something like "WidgetAPI" would be a better name, because that, at least, informs the user its relationship to the Widget class. Or perhaps we delete "Helper" from the name and additionally rename Widget to something like WidgetImplementation.
Alternatively, it could be wrapped and called by the widget, implying it is not part of the public API, but rather part of the implementation details.
class Widget:
def __init__(self):
self.widget_helper = WidgetHelper()
...
Even in this case, with this small amount of information we have an improvement on "helper." It would be more descriptive to call it some generic name like "WidgetImplementation."
"Implementation" may be correct as the implementation may do too much to give it a more precise name. Or it may itself be too vague - this is at the discretion of the namer.
But as we have seen, the name, "helper," doesn't aid in understanding what is going on in the code, other than it is ancillary to the main object of interest. "Helper," could mean many kinds of relationships. Thus, it is overly vague and nebulous, and not well-suited for the purpose of informing the user what the object does.
Conclusion
Naming things is one of the hard problems in computer science.
What is desirable in a name is that it inform the user what the named thing is supposed to do.
But in any case imaginable, it would be more descriptive to use a name other than "helper" or simply remove it altogether.
As a corollary to my experience and this discussion, the choice of "helper" in a name also signals low effort or sophistication on the part of the namer (correctly or not). It is, indeed, a code smell.
Please don't call anything a "helper."
SomethingSomethingHelperis not the actual name of the class. Whether it's a code smell or not would depend on how specific the helper class is, as helper classes likeMathare not a code smell at all. – Robert Harvey Jul 08 '14 at 16:58SomethingSomethingHelper. Hell, I'm looking at a class right now namedHelperMethodsin the<company>.Helpersnamespace. To me, aHelperclass is in the same bucket as*Manager. – Telastyn Jul 08 '14 at 18:05Helper, and I think that's to disambiguate it from a class in the .NET Framework having the same name. I'd consider*Helperacceptable if*was something meaningful.HelperMethodsis just a failure of imagination; there ought to at least be specific conceptual buckets. – Robert Harvey Jul 08 '14 at 18:55do..whileloop in Python, which the language doesn't support (see the second example here). Another would be an if/elif/.../else structure, but need to repeat a case at the top and bottom. If possible they should be made local to that function, though, and generally not actually called "helper". – Izkata Jul 08 '14 at 21:22java.lang.Math, and the more recent, but absolutely vital classes for Streams likejava.util.Collections(for things likeCollections.unmodifiableCollection(),java.lang.Arrays(for things likeArrays.stream()orCollectors(for things likeCollectors.toList()). All these classes are helper classes, are tremendously helpful and are just a bunch of related methods, grouped together. They don't need to act on any instance data. They just don't haveHelperin the name - but they are helpers and useful and imho very clean. – Polygnome Aug 06 '20 at 16:39