Recently starting my first job as a software developer, I was a little thrown to be told that I did not have to follow any naming conventions in my code. Code written by groups working on other, larger projects followed naming conventions, but since I was brought in to write a new, stand-alone, application, the feeling was that it did not especially matter. It was the last of my worries, so I just took that existing convention and ran with it.
int nTickCount Â
bool bConnected Â
object m_aItems Â
fSum += fWeight * fValue Â
class cManager Â
enum etSystemStates Â
etSystemStates eState Â
But is it actually worthwhile? I find it hard to judge the net effect that following this kind of naming convention has on comprehension and detection of errors, but, visually, it just looks kind of ugly. Plus, having every class and file in the project called cSomething seems pretty asinine.
I’m not under the illusion that it’s a remotely big deal when compared to things that make an obvious difference, like the algorithms and architectures that you employ. But any convention that affects every line of code that I write seems worth getting right.
What do you find the most elegant and effective naming convention, if one need be used at all? Does it denote type and/or scope?