3 ms·
If var x = "..." makes it difficult to tell what type x is, the problem is first and foremost in whatever "..." is. If it's your code, FIX IT. Rewrite it in suc
by deanCommie 11y ago
If var x = "..." makes it difficult to tell what type x is, the problem is first and foremost in whatever "..." is. If it's your code, FIX IT. Rewrite it in such a way that it IS obvious what type x will be. Intermediary variables, helper functions, and good names for both. (just don't make it a comment. Comments are future code liars and you should feel bad if you contribute more code liars to the world of code)
If "..." ISN'T in your control, then...don't use "var".
If you work with other developers that don't understand the above 2, review their code, influence them, convince them. If you work with so many of such people that you cannot convince them of the value of this, go work somewhere else.
- gravypod 11y agoIf it's your code it should be obvious, but I can't tell you how many times I've looked at code an it hasn't been. You can't just say "fix it" and it will be true.