Hacker News new | ask | show | jobs
by cammil 5506 days ago
Much of the problem of naming things is that the name you give them now, is unlikely to be the most appropriate name in the future. For example, your code may change, you may make other similar classes that would be more appropriate with that name, etc.

The strategy I use is to iterate naming, just as I would any other aspect of code. You are unlikely to want to do this as often, but if you find your current names are no longer working for you, it might be time for a change.

1 comments

For me names evolve over time, when I come up with a better name, I just do a global replace (sed is your friend). Other than that, I follow the nouns for things (objects) and verbs for actions (methods). If the name starts looking like a sentence, then I stop and rethink the design. Like to keep things as simple as possible.