Function naming: sendCharacter or receiveCharacter?
Posted
by bobobobo
on Stack Overflow
See other posts from Stack Overflow
or by bobobobo
Published on 2010-05-07T16:19:41Z
Indexed on
2010/05/07
16:28 UTC
Read the original article
Hit count: 186
I'm trying to name a function that runs when a character is received by the object.
For the caller, it should be named sendCharacter
, so that it can call:
object->sendCharacter( character ) ;
That looks nice for the caller.. but for the receiver, it implements a method
/// Called when this object is do something
/// with a character
/// from the caller
void sendCharacter( char c ) ;
So for the recipient class, it looks like this method will actually send a character out, not receive one.
So then, I could call the function receiveCharacter
/// Called when this object is do something
/// with a character
/// from the caller
void receiveCharacter( char c ) ;
But now the caller does this:
object->receiveCharacter( character ) ;
Which just looks odd.
How can I better name this function?
© Stack Overflow or respective owner