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 835 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"
  • anniel747
    anniel747 1 month ago

     Jan Cumps stepper_notifycation

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

    Jan Cumps Joy  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.

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

    Stepper_cmnd and Stepper_cmnd_IRQ

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

    How about "Stepper_with_benefits"

    Sunglasses

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

    I would call it a notifyingStepper because, well, it's a stepper that notifies.

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

    I would call the second one Callback_Stepper and the first one I would rename to Background_Stepper.  I’m curious: is it the case that developers for whom English is a second language programs are written wholly in English?  I know the language syntax is English but variables, class names, etc?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • obones
    obones 1 month ago in reply to Andrew J

    It really depends on teams, but here we have a policy where the entire code (including comments) should be in English and I must admit that it makes much more sense to have only one language to deal with when coding.

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

    I try, reasonably hard, never to duplicate code. A good indication that you are at risk is when two functions want the same name - then, maybe, they should be the same function with an additional parameter.

    So rather than Stepper_blocking and Stepper_asynch how about Stepper and let the initialisation set the behaviour on demand ?

    (As I've mentioned - I don't use C++ so this may be  a silly suggestion !)

    MK

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

    I prefer PascalCase for classes, so, StepperWithCallback or stepper_with_callback following your convention

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps 1 month ago in reply to michaelkellett
    michaelkellett said:
    rather than Stepper_blocking and Stepper_asynch how about Stepper and let the initialisation set the behaviour on demand ?

    There is a design pattern for that: Factory Method. Unfortunately I still have to name that other class Slight smile

    • Cancel
    • Vote Up 0 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