>>>>> "BM" == Brandon McCaig <bamcc...@gmail.com> writes:
BM> On Mon, Sep 5, 2011 at 11:51 AM, Uri Guttman <u...@stemsystems.com> wrote: >> single letter variable names are bad in general. they tell you nothing >> about the use and content of the variable. about the only exception are >> $i and $j for array/matrix indexing and the aforementioned $a and $b for >> scoping. BM> I'm used to writing C# and in my experience descriptive variable names BM> become both tiresome and difficult to read. Instead, I usually try to BM> keep functions/subroutines short and give variable names a mnemonic BM> meaning. If it is not obvious what the variable's purpose is then I'll BM> leave a comment next to its declaration (often in C# the type alone BM> describes the variable sufficiently though). I do use descriptive BM> names when the code requires it, but I don't make it a rule to always BM> use them. I find that code is often more difficult to read when the BM> names exceed a few characters. It's important to see what a variable BM> represents, but it's also important to see how that variable interacts BM> with the code around it. it doesn't matter the language or the comments. single letter var names are just bad coding. names are a communication to the reader of the code, not a placeholder or whatever to the coder. much more work needs to be put into choosing good names than most coders realize. it is one of the major characteristics i look for when i review code (and i review a ton of code for my business of place perl hackers). BM> This habit is somewhat holstered due to Perl's use of global variables BM> with short names, like $a and $b. I don't remember if there are any BM> other /\$[A-za-z]/ variables, but to be safe I generally avoid using BM> single character names in Perl (well, OK, also to avoid getting "told" BM> on this list when I post my code). I guess variable name length is BM> less of an issue in Perl though because the language is so much more BM> terse all by itself :P as i said, name quality is independent of language choice. $a and $b are special cases only for sort and nowhere else are any special named variables are found in perl (other than the punctuation vars like $!). uri -- Uri Guttman -- uri AT perlhunter DOT com --- http://www.perlhunter.com -- ------------ Perl Developer Recruiting and Placement Services ------------- ----- Perl Code Review, Architecture, Development, Training, Support ------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/