Naming member functions/methods with a single underscore, good style or bad?
Posted
by Extrakun
on Stack Overflow
See other posts from Stack Overflow
or by Extrakun
Published on 2010-04-21T07:01:13Z
Indexed on
2010/04/21
7:03 UTC
Read the original article
Hit count: 278
function
|coding-style
In some languages where you cannot override the () operator, I have seen methods with a single underscore, usually for 'helper' classes. Something likes this:
class D10
{
public function _()
{
return rand(1,10);
}
}
Is it better to have the function called Roll()? Is a underscore fine? After all, there is only one function, and it removes the need to look up the name of the class.
Any thoughts?
© Stack Overflow or respective owner