Utility Method

A (usually) static method. Used when you need to do stuff that does not need an instance of a class.

Example: A math class has an add function. That function needs no state to operate on, only two numbers to add. It doesn't need to touch any of the member / instance variables of the math class, so it's preferable to make it static, rather than member. - Mikle

I don't see the reason for such things to exist. In this example, surely "add" is something that numbers do, not "math"? That would make it a method of whatever number implementation is being used (eg. the "+" method in Smalltalk). If there could ever be an entity for representing such a vague and imprecise thing as "math", I would surely say it's a module. In general, "static" methods are an artefact of languages where classes and methods are not objects (Java, C++, etc.) - Warbo


EditText of this page (last edited January 23, 2013) or FindPage with title or text search