Regarding Hungarian notation: This is Perl; variables aren't integers nor floats, they are scalars. Reading the original code, I see "o" being used as a prefix for "object" and see "i" being used as a prefix. In Perl, I wouldn't think "integer" when I see "i". In this code I would think "index", which is how it is being used. I can't say for sure what the original author meant "i" to mean, however. (Nor can I fathom how you would end up changing that to a float.)

I find prefixing variable names with type information can be very useful but I don't mean type as in "int" vs. "short" vs. "double". I mean "type" as in "count of items", "index into list", "input-only", "output-only", "input and output", etc.

Some people I work with actually suggested that, if you have a comment describing a variable, consider just changing the name of the variable to that entire comment. I think they forget that even English has pronouns and putting avoiding all shorthand just makes things long and probably harder to understand rather than easier. Of course, using too vague of variable names is much more common problem than using too long of ones. (:

Taking the particular case of "o", which I feel confident in guessing the meaning of, if we change our implementation such that the variable is no longer an object, then we have to change a lot more than the variable's name. There might be a few places that we could avoid changing if the name didn't require changing....

...then again, what I find a much worse maintenance problem is variable names that are a textual match to other things. I hate going through a program looking for all uses of the variable "column" and finding lots of comments about columns. At least for Perl scalars, $column is less of a problem (for aggregate types, I prefer to be able to search for just the variable name rather than /[@\$]column/).

OK, that wandered all over the place. I'll just stop and leave that as-is in hopes that someone will find something useful in it. Sorry for the mess. /:

        - tye (but my friends call me "Tye")

In reply to (tye)Re: Writing Spreadsheet parse to Database by tye
in thread Writing Spreadsheet parse to Database by JSchmitz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.