3 ms·
I’m missing Curly’s Law: https://blog.codinghorror.com/curlys-law-do-one-thing/ https://blog.codinghorror.com/curlys-law-do-one-thing/ “A variable should mean
by Aaargh20318 6mo ago
I’m missing Curly’s Law: https://blog.codinghorror.com/curlys-law-do-one-thing/ https://blog.codinghorror.com/curlys-law-do-one-thing/
“A variable should mean one thing, and one thing only. It should not mean one thing in one circumstance, and carry a different value from a different domain some other time. It should not mean two things at once. It must not be both a floor polish and a dessert topping. It should mean One Thing, and should mean it all of the time.”
- ipnon 6mo agoI usually invoke this by naming with POSIWID.
- huflungdung 6mo ago[dead]
- inetknght 6mo ago> It must not be both a floor polish and a dessert topping. I worked as a janitor for four years near a restaurant, so I know a little bit about floor polishing and dessert toppings. This law might be a little less universal than you think. There are plenty of people who would happily try out floor polish as a dessert topping if they're told it'll get them high.
- rapnie 6mo agoBorax is an example of a substance that is simultaneously used for skin care, household cleaning, as soldiering flux, and ant killer. But I guess it is a constant with variable effects. Hard to be found in local shops anymore.
- m463 6mo agoreminds me of WD-40 (water displacer formula 40). not used that often to displace water.
- otterley 6mo agoReally? It's at practically every hardware store I've been to (US, things may be different elsewhere).
- rapnie 6mo agoYes, Netherlands, think it is quite different in retail in comparison.
- aworks 6mo agoI worked for awhile as a janitor in a college dorm. Not an easy job but it definitely revealed a side of humanity I might not have otherwise seen. Especially the clean out after students left for the year.
- otterley 6mo agoIt’s a reference to a very old SNL sketch called “shimmer”. https://www.youtube.com/shorts/03lLPUYkpYM https://www.youtube.com/shorts/03lLPUYkpYM It probably won’t be up very long but it’s a classic.
- inetknght 6mo agoHah, nice!
- dhosek 6mo agoOf course for maximum confusion, there’s Gen X me, making this reference to my Gen Alpha kids who have absolutely no idea what I’m talking about. I’m still waiting for the moment in the ice cream shop when I can ask them, “sugar or plain?” https://mediaburn.org/videos/sugar-or-plain/ https://mediaburn.org/videos/sugar-or-plain/
- gpderetta 6mo agoah, I thought it was an Ubik reference!
- js8 6mo agoI thought that you were about to write: "as a janitor in a restaurant, the dessert topping is sometimes used as a floor polish".
- inetknght 6mo agoSomething as expensive as dessert toppings would only be used as floor polish by the people who truly were high... and only if they could do it without the boss knowing what they were doing.
- CyberDildonics 6mo agofloor polish as a dessert topping if they're told it'll get them high. I think that would be called a drug, not a desert topping.
- normie3000 6mo agoWhite vinegar is a fierce cleaning product and a salad dressing. Although to me it has the disadvantage of tasting like a cleaning product.
- shermantanktop 6mo agoOh! I didn’t have a name for this one, but it’s a lesson I’ve learned. E.g. if variable x is non-zero, then variable y will be set to zero. Don’t check variable y to find out whether x is zero. And definitely don’t repurpose y for some other function in cases where it’s otherwise unused.
- pc86 6mo agoFor modern day web developers there are very, very, very few things that fall into the "if you do this you should probably be escorted out of the building on the first offense" category, but "reusing a variable because it's 'not being used'" might be on that list. I can maybe see the argument in very low memory embedded systems or similar systems where I'm not even qualified to come up with examples but not in anything that regularly shows up on HN for example.
- estimator7292 6mo agoShellac is both a floor polish and a food additive, particularly in candy. Used to be, anyway. Modern alternatives are much better. It's still used as glue in wind instruments though.
- deleted 6mo ago[deleted]
- sdeiley 6mo agoEh. I love absl::StatusOr<T> at Google
- m463 6mo agoAs a computer person, I hated math/physics/science because of the one-letter (greek) variable names. Of course some of that osmosizes back via lisp and APL.
- tsoukase 6mo agoThat was the exact reason I liked math. Maybe because I am Greek.