What generic name is given to classes that encapsulate a collection of esoteric functions which together perform some larger cohesive but entirely self-contained task useful to the wider application, by producing a computed result given a number of input parameters?

An example might be a class that calculates the shortest path/most efficient route when visiting nodes on a Euclidean plane, given a set of obstacle polygons. Inside this class there might be various generic functions for calculating the distance between two points, whether or not two lines intersect, and whether the intersection is concave or convex relative to a given co-ordinate.

Describe exactly the context that the name or terminology is used: This term will be used when naming classes. In the example class I mentioned above, the term would replace "Foo" in the class name MyCompany_Foo_ShortestPath.

Describe the criteria for acceptance: The term must suitably differentiate it from other common class types, such as caches (e.g. MyCompany_Cache_Prices), adapters (e.g. MyCompany_SQLDatabase_Adapter_MariaDB), data providers (e.g. MyCompany_DataProvider_Products), controllers (e.g. MyCompany_Controller_Users) and models (e.g. MyCompany_Model_Employee), while also going some way to explaining the nature of the class (encapsulated, complex functionality).

Which names/terms have you thought of and discarded as inappropriate? Some ideas I've had have been "functional" classes (in that they act like functions, but have been broken down into smaller functions), and "computational" (in that they compute things). I would guess though that there is already an accepted term for this type of class.

  • Do you mean black box?
    – Pieter B
    Oct 6, 2014 at 13:02
  • Thanks @gnat, I will edit according to the criteria of the most upvoted answer on the question you posted.
    – Alex
    Oct 6, 2014 at 13:05
  • 2
    I use the term "utilities" to mean strictly stateless classes that provide some calculation or reoccurring pattern in my code. They are usually grouped by scope (one for dao, another for statistics calculations, etc.). Hope that helps.
    – Neil
    Oct 6, 2014 at 13:11
  • @Neil it is interesting that you use that term. We also use "Utility" in our class names, but our definition/use for them is different. I guess that's because "utility" is a bit too generic a word - it's bound to be used in different ways by different teams, as it doesn't do much to infer it's intended use. Looking at our "Utility" classes, they could be broadly divided up into more descriptive (but still suitably generic) names.
    – Alex
    Oct 6, 2014 at 13:37

1 Answer 1


The most proper term I've seen for that type of structure is Method Object.

That being said, I typically use the word "Calculator" in the naming of Method Object classes in my code. "Calculator" indicates that the class would perform a calculation or run an algorithm based on inputs and could potentially live on to be used repeatedly. The term also differentiates it from other classes which contain/transport data or interface with other components. You've even used the same term in your own example: "...a class that calculates the shortest path..."

  • 1
    consider editing the answer to explain how this recommendation fits to context and criteria for acceptance laid out in the question asked
    – gnat
    Oct 6, 2014 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.