3 ms·
I agree that the examples aren't great. I struggled to come up with terse examples to illustrate the point, but I stand by the general premise of the post. I'm
by davethedevguy 6y ago
I agree that the examples aren't great. I struggled to come up with terse examples to illustrate the point, but I stand by the general premise of the post.
I'm afraid I can't agree with making variable names as short as possible as a general rule, though.
I think that the length of the variable name should be linked to a) how long it lives for and b) the distance between the declaration and the usage.
For example, I'm personally OK with using 'i' for the index in a 'for' loop, but stand by longer names such as 'allOutstandingOrders' for variables that are used throughout a function, where the declaration isn't within a few lines of the usage.