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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |