Lazycoder

17Aug/040

Amen Mikhail

Naming conventions: I don’t like camel and I do like Hungarian

Mikhail says he’s not really in love with camelCasing. I use it all the time and I did before I started coding against the .NET Framework. His example makes sense, although anyone who’s naming their vars “a”,”b” and “c” should be shot. ;)

My favorite example when I’m arguing for the use of pseudo Hungarian (or full Hungarian) is DateTime vars. I work in the web world so I’m always using the ToShortDate or ToLongDate methods on DateTime variables. If I’m passing around a DateTime string what should the var be called? shortDateTimeString? or just shortDateTime? That’s not really descriptive, lets use startDate. Does startDate return a DateTime or a String? Should I name the var startDateShortDateString? Wouldn’t strStartDate be better than startDateShortDateString? The “hover over the variable in the IDE” trick only works if you are in the IDE and if the IDE is working (I’ve had to restart Visual Studio more than once to get intellisense working again).