Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8049993
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:56:27+00:00 2026-06-05T06:56:27+00:00

There is a more generic question asked here. Consider this as an extension to

  • 0

There is a more generic question asked here. Consider this as an extension to that.

I understand that classes represent type of objects and we should use nouns as their names. But there are function objects supported in many language that acts more like functions than objects. Should I name those classes also as nouns, or verbs are ok in that case. doSomething(), semantically, makes more sense than Something().

Update / Conclusion

The two top voted answers I got on this shares a mixed opinion:

Attila

In the case of functors, however, they represent "action", so naming them with a verb (or some sort of noun-verb combination) is more appropriate — just like you would name a function based on what it is doing.

Rook

The instance of a functor on the other hand is effectively a function, and would perhaps be better named accordingly. Following Jim’s suggestion above, SomethingDoer doSomething; doSomething();

Both of them, after going through some code, seems to be the common practice. In GNU implementation of stl I found classes like negate, plus, minus (bits/stl_function.h) etc. And variate_generator, mersenne_twister (tr1/random.h). Similarly in boost I found classes like base_visitor, predecessor_recorder (graph/visitors.hpp) as well as inverse, inplace_erase (icl/functors.hpp)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:56:28+00:00Added an answer on June 5, 2026 at 6:56 am

    Objects (and thus classes) usually represent “things”, therefore you want to name them with nouns. In the case of functors, however, they represent “action”, so naming them with a verb (or some sort of noun-verb combination) is more appropriate — just like you would name a function based on what it is doing.

    In general, you would want to name things (objects, functions, etc.) after their purpose, that is, what they represent in the program/the world.

    You can think of functors as functions (thus “action”) with state. Since the clean way of achieving this (having a state associated with your “action”) is to create an object that stores the state, you get an object, which is really an “action” (a fancy function).

    Note that the above applies to languages where you can make a pure functor, that is, an object where the invocation is the same as for a regular function (e.g. C++). In languages where this is not supported (that is, you have to have a method other than operator() called, like command.do()), you would want to name the command-like class/object a noun and name the method called a verb.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is more a theoretical question i asked myself. I remembered that BinarySearch of
I recently asked this question about how to simulate type classes in D and
Is there anything more compact (or otherwise better) than this? <x:Array x:Key=titles Type=System:String> <System:String>Mr.</System:String>
This is more a generic question than a specific one. I'm trying to have
This is a generic C++ design question. I'm writing an application that uses a
I am asking this here because I think my last question was more than
I asked similar questions here And here This is a sample Type: public class
This could be a much more generic question abut how to best cancel blocking
Is there a more sensible way of doing this? I want to make a
is there a more effecient way to write this to only take up one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.