4 ms·
The problem was not that the variable was abbreviated. The problem was that the abbreviated variable was so similar to another abbreviated variable that was use
by twblalock 10y ago
The problem was not that the variable was abbreviated. The problem was that the abbreviated variable was so similar to another abbreviated variable that was used for a similar purpose.
- reactor 10y agothen there are two problems.
- bryanrasmussen 10y agosure but if the variable was not abbreviated the chance of collision would have been less.
- brandonbloom 10y agoEven with a 200 character variable name, the chance of collision is 100% if it was auto-completed or copy-pasted.
- philosoft 10y agoAt a minimum, readable variables would have simplified identifying the issue after it was introduced.
- twblalock 10y agoMy point was that the abbreviation is not a problem per se. If there was not another variable with a similar name, it would not have mattered at all. This is an issue of names being similar. No matter how long a variable name is, if another variable name in the same namespace is superficially similar, this kind of thing can happen. On the other hand, if there are no other variables with similar names, then you can abbreviate all you want and your chance of collisions will not increase.
- dgcoffman 10y agoYeah, the problem isn't that the airplane is on fire, the problem is that it crashed into another burning airplane as both tumbled uncontrolled through the sky, hurdling toward the earth.
- DSMan195276 10y agoI would add - there's a bit of a difference between an abbreviation that just keeps something from being ungodly verbose (20 letters instead of 50), and an abbreviation that shortens something so much that the original meaning is completely lost ("Ttpfe"). This is especially true for things in context - "time of ten percent height on the falling edge" is needlessly verbose, but in context "ten_percent_falling_edge" would probably be perfectly fine. And indeed, that's really just an expanded version of "Ttpfe", which is what was used anyway. If you shorten everything to five-letter names, it's not really that surprising that it becomes an issue - And I mean, what's the real point of abbreviations when they are so short that it makes it harder to read the code? Edit: It's worth pointing out though - if this is really old C code it may be justifiable. Back in the olden days of C (Older then C89 at least), only the first 8 characters of a symbol actually mattered. "blahblahone" and "blahblahtwo" would resolve to the same symbol. So shortening in this way could be necessary.
- bhollan 10y agoThe line was adding about 5 or 6 terms, and I think it was actually an 8-character acronym that he had. It might have been like "time from ninety percent to ten percent falling edge" or "falling edge fall time ten percent" or something. Either way, it was awesome to find it.