“Function” objects are not a thing
Eric Anderson
31

Fancy names aside, what you are describing is a command pattern (See https://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612/). As with any other design pattern, it shouldn’t be applied everywhere, but there are certain cases where reifying a method into an object is really useful (see the pattern’s intent and applicability).

Some references that may be worth reading:

http://c2.com/cgi/wiki?CommandPattern

http://gameprogrammingpatterns.com/command.html

HTH

Like what you read? Give Andres Fortier a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.