element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Code Exchange
  • Technologies
  • More
Code Exchange
Forum find a good name for a C++ class
  • Blog
  • Forum
  • Documents
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Code Exchange requires membership for participation - click to join
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 22 replies
  • Subscribers 47 subscribers
  • Views 878 views
  • Users 0 members are here
Related

find a good name for a C++ class

Jan Cumps
Jan Cumps 1 month ago

I'm designing two classes, for a stepper motor project:

  • one can send commands to a stepper motor.
    Each command has the number of steps and direction
    Running the motor happens async. Once the first command is sent, the motor heads off, until all commands are done.
    I named it stepper

  • the other class does the same, but it can notify the caller when it has completed a command.
    I named it stepper_interrupt

I'm not happy with that second name. It doesn't show what the class does. It's named after how it does it. I don't like that.

Do you have a better name?

please don't call it Stepper McStepperFace

  • Sign in to reply
  • Cancel

Top Replies

  • robogary
    robogary 1 month ago +2
    Stepper_wReply altho McStepperFace is high on my list or Stepper_TalksTooMuch
  • kmikemoo
    kmikemoo 1 month ago +1
    Jan Cumps Oh my word! I just about fell out of my chair laughing at the Stepper McStepperFace!! Recommend stepper_wEOL. EOL = End Of Line. Could be End Of Run, Class, Script, Routine.... just a thought…
  • rsc
    rsc 1 month ago +1
    How about "Stepper_with_benefits"
  • beacon_dave
    beacon_dave 1 month ago in reply to Jan Cumps

    Perhaps just use constructor overloading ?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps 1 month ago in reply to beacon_dave

    That's already there - but it's not a riddle that needs solving. There is no source code needed to decide if you need a stepper engine with notification or not. Should be a designer's decision.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps 1 month ago in reply to javagoza

    I learned it that way too. We called it CamelCase. I adapted to what the C++ standard libraries use.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps 1 month ago

    image

    White check mark Recommended

    If you want clarity and flexibility:

    StepperMotionController

    If you want to emphasize the event/notification aspect:

    StepperMotionNotifier
    or
    NotifyingStepperController

    Want it to feel more concise or a bit more “modern C++”?

    StepperController (with internal event/callback support)

    ChatGPT asked this interesting question: 

    "Let me know if the notification is via callbacks, events, observer pattern, or something else—that could help refine the name even more."

    ... and to name the callback onComplete . Not bad advice.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps 1 month ago

    If I listen to ChatGPT, this would be a possible naming schema:

    image

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • robogary
    robogary 1 month ago

    Stepper_wReply    altho McStepperFace is high on my list or Stepper_TalksTooMuch 

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • dang74
    dang74 1 month ago in reply to rsc

    Laughing 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • anniel747
    anniel747 1 month ago in reply to Jan Cumps

    Jan Cumps Not exactly the same.

    camelCase

    PascalCase

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps 1 month ago in reply to anniel747

    cLOSEeNOUGH:)

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • beacon_dave
    beacon_dave 1 month ago in reply to anniel747

    Perhaps it depends upon whether you ride a dromedary or a bactrian camel to work ? One hump or two ?

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
<>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube