Perl-Sensitive Sunglasses | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Howdy!
camelCase is tolerable when there are only two words. threeWordCamelcase is pushing it. havingReallyLongAndDescriptiveSubNamesThatRunHalfwayAcrossThePage is absolutely hideous, and the basis for my deep hatred for that part of the Sun Java Coding Standards *spit*. This was driven home recently with great force when I had cause to pore over some Java source that had method names that were three inches long with many words mashed together. It was painful to try to parse the words apart to make sense of it. It is, generally, far better to apply the "separate dictionary words with _" constraint to all symbol names. Most human written languages (and all that use the roman alphabet, I think) rely on white space to mark the spaces between words. Mashing the words together into a long word may be very German in its application, but it destroys the normal visual markers we rely on to parse the phrase, making it much harder to read. Using underscores connects the words with a non-whitespace character, but has a visual impact of nearly zero. The contour of the tops of the characters still has zero-height area, just as it would with spaces (or close enough as to add no appreciable load to the cognitive process). I also take exception to rules 5 and 6. Prefixing like that will tend to obscure the substantial part of the variable name. The sigils, being single, non-alphabetic characters, are easy to cope with. However, consider the mental processing in reading "$this_aref_foo" to discern the name of the variable. You see "this" and have to remember that this simply marks it as local to some narrower scope (but which scope? hmmm...). OK. Ignore the "this". Next you come to "aref". OK, we have an array ref, but we still don't know what it is about. Finally, we come to "foo". At last! A name conveying some sort of meaning! Recall "Hungarian notation", by which means one prefixes the "real" name with a series of characters that encode the data type. Nasty nasty nasty. Rules 5 and 6 go down that path, whence lies much danger and peril and nasty sticky bits that go ecky ecky ptoing niiiiiwha.
yours, Michael In reply to Re^3: coding rules
by herveus
|
|