10 ms·
I just wish the variable was called "has_been_viewed_much".
by rho4 2mo ago
I just wish the variable was called "has_been_viewed_much".
- zem 2mo agowhy, though? the current version is the interesting property
- ramon156 2mo agoThey meant that a more ergonomic name would be "has_been_viewed_much", so you can filter by the inverse and still get the same result, but with a better name
- zem 2mo agoI know what they meant, I was saying that imo the ergonomic name is has_not_been_viewed_much. it's directly expressing the property you are interested in, as opposed to expressing the negative property and comparing it to false.
- Paul_Clayton 2mo agoHow about rarely_viewed? Such expresses the property of interest, avoids the double negative issue, and is shorter? Of course rarely might imply a frequency much lower than the cutoff and infrequently has a bit of the double negative issue. Tradeoffs.
- Cthulhu_ 2mo agoThere's a rule of thumb somewhere that booleans should always be named / represent something positive, so "enabled" instead of "disabled", "visible" instead of "hidden", and "has_been_viewed_much" instead of "has_not_been_viewed_much". see e.g. https://codehealth.dev/prefer-positive-booleans/ https://codehealth.dev/prefer-positive-booleans/
- jon_adler 2mo agoWouldn’t a view count with range filtering provide the best flexibility?
- rho4 2mo agoAbsolutely, I was purely reacting to the "not". Every variable named not-something will lead to difficult-to-read code with double-negation like "if (!isNotSomething()) {...}".