I remember that in especially C and maybe C++ it's common to underscore private methods, so their name would be (pseudo code)
class Foo {
private _bar() {
// Do Nothing
}
}
Do you follow this practice and what do you think about the practice in especially PHP?
I used to do it in PHP and in javascript too. It's very common in javascript as you do not have the "private" keyword
modern IDEs usually make the _ as a prefix useless. unless you develope with emacs or VIM, but I would expect the old tabs vs spaces question then.
In the end define the coding style you want and stick to it, that's the only thing that matters ... the "look and structure" of code is nothing more than an opinion and opinions are like assholes ... everyone got one :) .....
i come from the c world we used to separate functions with "_", everything is singular and lower case the java people like their camel case ... the interpreter does not care and should not care at all as long as the instructions come in, in the right order .....
the longer you code the more conventions you had and the less you care :) define it, lint it ... fuck it ;)
AS @cyrus say it, in my company still using this practice but is not really an option, because as PSR2 say a private or protected method don't need to have any prefix.
For more maintainability i think it's better to put separated in the code, up and down for example.
Cyrus Boadway
What do I do?
PSR-2 explicitly says not to prefix/suffix private properties or methods with underscore.