3 ms·
For example, completely contrary to most common belief, the == operator is actually more powerful and more useful in our programs than ===, and in fact, usage o
by andrewvc 7y ago
For example, completely contrary to most common belief, the == operator is actually more powerful and more useful in our programs than ===, and in fact, usage of == should be preferred and === should only be a last option. But to understand why I make that claim, you have to actually learn types, and the way they’re converted: coercion. I really wish developers wouldn’t just keep parroting back “JS types are evil” like they’ve heard for years. They’re great...
This line of poor reasoning is responsible for so much lost productivity and buggy code. Even in the best case where a team is comprised of people who understand these intricacies well it still forces people to spend more time thinking about simple equality checks than necessary. The greater verbosity of === and type conversion is less mental effort.
In the real world very few people understand == and there's a good chance that even if you do whoever maintains the program you wrote won't. It's just not worth it.
This is very similar to the argument that you should use the minimum number of semicolons necessary in JS. You just need to memorize the exact syntax. It's an aesthetic argument only. It does nothing for the metrics that matter, like defect rate, maintainability, comprehension, etc.
- andrewvc 7y agoTo add to this, a problem with becoming an expert on anything is that you can start to love your understanding of the complexity of the thing and lose the objectivity necessary to evaluate the thing. This can lead to endorsing advanced features instead of simple easily composable ones. The advanced features will be poorly adopted in the field due to not everyone being an expert. This is probably the best single thing about golang. The language has many flaws, but this is not one of them.
- couchand 7y agoI wholeheartedly disagree about your characterization of Go. There are indeed some advanced and misguided features, to wit: goroutines and channels. On the one hand, these primitives make writing some types of programs easy, but it enforces one specific model to a fault.
- fourthark 7y agoI appreciate the YDKJS books a lot more when he is in descriptive mode rather than prescriptive mode. From this interview, it sounds like he agrees, but can't help giving advice sometimes.
- tchaffee 7y agoIt's to be expected from someone who deeply knows a language. And entirely ignornable. Go to Kyle for how JS works. Look at actual code from senior devs for best practice.