4 ms·
I might be in the minority, but I think using variables of equal lengths with opposite meanings is an anti-pattern. I like using clearly different words (diff l
by zffr 6y ago
I might be in the minority, but I think using variables of equal lengths with opposite meanings is an anti-pattern. I like using clearly different words (diff lengths, diff starting characters) that still pair well together. IMO this makes it much easier to scan through code, and much less likely to accidentally use the wrong function/variable somewhere.
- pansa2 6y ago> I think using variables of equal lengths with opposite meanings is an anti-pattern. Perhaps the worst example of this is Kotlin’s var/val. I much prefer var/const.
- jez 6y agoI get the sentiment, and I'd go further to say that I prefer Rust's `let` vs `let mut`, i.e., the longer & visually noisier option discourages mutability by default, and draws attention to when it is used.
- ricc 6y agoI use a CLI app that is used like this: `command get/set [long directory]` Because of that long directory part, I use the command history instead of retyping the whole thing. I probably already lost a cumulative total of hours executing `set` instead of `get` by mistake.
- layer8 6y agoEqual-length variable names help to see differences in the remainder of the line. You are more likely to spot mistakes in code where stuff that should be the same is aligned the same.