|
antoine.contal@xxxxxxx wrote: > > I'm having an argument with the team that choose our shop's coding style > conventions. I'd like to have your opinion on the subject. > > The heart of the matter lies in this kind of constant declaration: > > DwwAppStateUpdFailMsg... > D C '...' > > (ww is a prefix we have to add in front of variables and constants, to > differentiate them from file fields) > > The convention team says this name is too long. They want everybody to keep > their names within the 15-character limit -- indeed, 13 meaningful characters > after you add the two-character prefix. > ... Is the convention team trying to prevent the use of ... in names, or just to keep name-lengths 15 or less? If the rule is against the ..., then what about name indentation? If you use indentation to show the organization of a data structure, you have even fewer characters for the names. I think the rule should be that names should be as terse as possible while retaining enough information to make them easily remembered. A good set of abbreviations (like Msg, Upd etc) should be established, so you don't get names like wwApplicationStateUpdateFailMessage, or two too-similar names like wwHaveRec and wwHaveRcd. Aside: A few times I've been unable to come up with a good name for a variable; it's usually turned out that it was better to do my coding a completely different way. My Rule of Thumb: If you can't name the variable, try rethinking the algorithm.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.