The lists have been buzzing the past few days over the use of XML, framework configuration storage, and more. And the conversation has more recently shifted to a ferocious debate about naming conventions. And to be brutally honest, I am both dismayed and appalled.
As far as I am concerned there are no absolutes when it comes to naming conventions. I personally insist on two things:
- Consistency (whatever you do, do all the time)
- Descriptiveness (“foo” is unacceptable, as is “x” and “i1”, although I may allow the latter as the index variable within a loop, perhaps, and perhaps not).
That aside, have a party. If you want all caps, go for it. Camel case? Sure (although, I can just see it now, a debate over should it be ArrayAppend() or arrayAppend() or …). All lower case? Fine. Starting with $ or _ or any other character, that’s fine too. The objective is that you, and whomever has to work on your code next, can easily ascertain what the code is doing and why – that is it. Variable naming choices say absolutely nothing about the quality of the code, the caliber of the developer, and whether or not the application is architected soundly and built properly.
Or put differently, if your app design is so perfect that all you have left to worry about is whether or not to name your variable firstName or FirstName or first_name or $FirstName – well, it’s probably time to find something else to be working on.