What to name a method

Posted by coffeeaddict on Stack Overflow See other posts from Stack Overflow or by coffeeaddict
Published on 2010-03-31T21:07:34Z Indexed on 2010/03/31 21:13 UTC
Read the original article Hit count: 365

Filed under:

I'm debating what to name this method.

CloseCashTransaction(Cash.Id, -1, true);

or

CompleteCyberCashTransaction(Cash.Id, -1, true);

or neither are good?

In business terms/process by sending in these 3 values I'm essentially "closing the transaction" or "completing the transaction" in our workflow.

However on the developer side, I cant' infer wtf "Complete" or "Close" means. It forces me to look into the internals of the method. My struggle is that I try to name methods to infer what they are doing. Complete is just way too general and forces the consumer of the method to dive into the code every time I use words like this.

When I see stuff like this all over code, I have to take so much time to figure out what they are actually doing. And if the comments suck, I end up having to look at all logic in that method because the comments nor the method name really infer what's going on.

© Stack Overflow or respective owner

Related posts about c#