Re: Aesthetically pleasing identifier names
- Posted by Ed Davis <ed_davis2 at yahoo.com> Mar 07, 2005
- 518 views
Brent W. Hughes wrote: >When I was a young and tender programmer, if I wanted to declare >a function to, say, set a menu bar to a certain value, I would >probably name the function something like "smb" which of course, >stood for "set menu bar". >... >identifier names, and I decided to give that a try. My function >would hence be called "set_menu_bar". >... >I tried it. My >function would now be called "SetMenuBar". I found my code to be >more readable and much more aesthetically pleasing. In fact, I >have become a convert to this way of naming identifiers. >... >What do you think? I've followed a similar path. In the late 70's I used the smb. In the 80's I used the set_menu_bar. In the 90's I went with SetMenuBar. Now, since 2000, I've decided that SetMenuBar is ugly, and even hard to read sometimes, and have gone back to set_menu_bar, which is much easier for me to read. For example, look at this function, taken straight from the win32 API: AddSectionKeyFileToCopyList(szSect, szKey, szSrc, szDest); vs. add_section_key_file_to_copy_list(sect, key, src, dst); It takes me a second to read the first one, but I can immediately read the 2nd one, as the '_' clearly separates the words. YMMV, VWP, NW