Possible Duplicate:
Anyone else find naming classes and methods one of the most difficult part in programming?
Sometimes it seems i cant really find any name for a function i am writing, can this be because the function is not cohesive enough?
What do you do when no good name for a function comes to mind?
For naming functions, just avoid having simply nouns and rather name them after verbs. Some pointers:
validateInput()andvalidateUserInput()since it’s hard to say what one does over another. Also, avoid having characters that look very similar, e.g. the number 1 and lowercase ‘l’. Sometimes it makes a difference.constructCarAndRunCar()but rather have one function that constructs and another that runs it. If your functions are between, say 20 and 40 lines, you’re good.sim_pauseSimulation()andsim_restartSimulation(). If your class is OOP-based, this isn’t an issue as much.addToVector()oraddToArray(), have them beaddToList()instead. This is especially true if these are prototypes or the data structures might change later.Happy coding! 🙂