views:

46

answers:

2

Say you have a class Block...

class Block {

and it has a function that allows you to show the block on screen. Would you call it...

ShowBlock( ... )

or just

Show( ... )

This has been irking me, and I'd like to hear others thoughts. On one hand, ShowBlock is completely obvious whenever its used. However, since it will be called from a Block, it may be unnecessary like...

m_SomeBlock.ShowBlock( ... );
+2  A: 

It is. The method is a member of the class so it becomes:

Block::Show()

The function becomes Show is a member of Block. If the method name was ShowBlock the it would be read as ShowBlock is a member of Block.

monksy
+2  A: 

I think it is more than redundant, it can be confusing unless you have a strict naming convention, for instance:

Block_Show();
Block_Draw();
Block_Whatever();

And your instantiation in the example already has "Block" in the name, so that should help another programmer when he/she needs more information on the method or class.

rnsanchez