In the days of 20mb hard drives, when memory was at a premium, and we had contests to see who could write the most compact code, I'd agree with that, but in today's world, with multi-terabyte hard drives, I just lean towards code that is more opaque! Especially since the person who has to modify the code is apt to be someone other than the original developer! But as with such things as haggis and sushi and okra, it's a matter of personal taste!
I'd agree with that, but in today's world, with multi-terabyte hard drives, I just lean towards code that is more opaque! Especially since the person who has to modify the code is apt to be someone other than the original developer!
having a control/field called TEXT250 - and then testing numeric values raises concerns - as if the control is really a text value, and holds something like "Smith", or even a null - what would you expect the result of your test to be?
I guess that years of maintaining ever changing programs due to company needs makes me prefer simple to change code, especially as its usually wanted yesterday, the next requirement may be between -15 and + 20 so I guess I go with linq
Sure, any piece of code or a function can be obscure to someone who has not seen it before. However if that was a valid criteria for avoidance then we couldn't write any code because someone might not have seen it before.
Abs() is a standard VBA function so I don't see why it should be singled out.
I guess that years of maintaining ever changing programs due to company needs makes me prefer simple to change code, especially as its usually wanted yesterday, the next requirement may be between -15 and + 20 so I guess I go with linq
Me.Label253.Visible = (Me.Text250 > 20 Or Me.Text250 < -15)
However the actual objection I usually encounter to the coding style is to the use of an expression that returns a Boolean value directly letting the value of a Boolean property rather than explicitly letting it to True or False.
I was not objecting to abs but to obvious, yes it can easily be understood even if abs has to be looked up by one who has not come across it, but it is not necessarily obvious.
And yes letting the Boolean value can also be puzzling to a newbie, I've had to explain about that in the standard age calculation before today.