Meaningful concise method naming guidelines

Posted by Sam on Programmers See other posts from Programmers or by Sam
Published on 2011-11-12T02:22:33Z Indexed on 2011/11/12 10:14 UTC
Read the original article Hit count: 359

Filed under:
|
|

Recently I started releasing an open source project, while I was the only user of the library I did not care about the names, but know I want to assign clever names to each methods to make it easier to learn, but I also need to use concise names so they are easy to write as well.

I was thinking about some guidelines about the naming, I am aware of lots of guidelines that only care about letters casing or some simple notes. Here, I am looking after guidelines for meaningful concise naming.

For example, this could be part of the guidelines I am looking after:

  • Use Add when an existing item is going to be added to a target, Use Create when a new item is being created and added to a target.
  • Use Remove when an existing item is going to be removed from a target, Use delete when an item is going to be removed permanently.
  • Pair AddXXX methods with RemoveXXX and Pair CreateXXX methods with DeleteXXX methods, but do not mix them.

The above guidance may be intuitive for native English speakers, but for me that English is my second language I need to be told about things like this.

© Programmers or respective owner

Related posts about best-practices

Related posts about naming