11 points · by albertoG · 17y ago · 22 comments
void swap(int* x, int* y)
{ int t = *x; *x = *y; *y = t; }
Small blocks with very obvious code are perfectly Ok to have short variable names in. All other rules in this post can be criticized as easily.Hence, rule #8: forget about the previous rules, just be a smart coder.
for uo in unfilledOrdersIterator():
oid = uo.id
status = uo.status
email = uo.customer.email
sendEmail(email, "Your order %s is in status %s" % (oid, status))
But if there's a 200-line method that does all sorts of other things with a single unfilled order, then calling the order "uo" is probably a bad idea.(I mean, I remember doing this thing in TI-83+ BASIC, where valid variable names were limited to the letters of the alphabet ...)
you are absolutely right with your observation, that variable name its just a bad example, I have just edited the post and I have changed its name to daysDateRange.
Thanks for your feedback
Doesn't this violate his rule #5?
Thanks for the comment
Obviously written by a software weenie who lives far, far away from the actual hardware. ;-) (Digital logic often uses active-low signals for good electrical reasons. And some purely historic reasons: do memory chips actually need to power up in the activated state?)