In a lot of languages with simple OO capability (PHP 4), or misunderstood OO capabilities (Javascript, C using function pointers, etc.), you'll end up with a function naming convention that uses leading underscores to to indicate privilege level.
//ex. function _myPrivateFunction(){ }
While individual teams are always going to come up with their own naming conventions like this, the underscore convention seems so prevalent that it made me curious about
Beyond pure curiosity, I'm seeing this in a few codebases I'm dealing with right now, and I'd like to understand the possible headspaces of the developers who originally came up with it.
The Python interpreter modifies the variable name with ___. So Multiple times It uses as a Private member because another class can not access that variable directly. The main purpose for __ is to use variable /method in class only If you want to use it outside of the class you can make it public.
Naming Convention for Functions So, similar to variables, the camel case approach is the recommended way to declare function names. In addition to that, you should use descriptive nouns and verbs as prefixes. For example, if we declare a function to retrieve a name, the function name should be getName.
Since short function names are hard to get right, it's OK to add “AND” in the function name.
In C++ world, member names that start with underscore are reserved for use by compiler (or low level STL like API) developers. It's not prohibited by compilers in any way, but that's the tradition.
This wiki link is quite informative on underscore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With