3 ms·
Said so many times. Do not ever use nulls as flags. It’s incredibly like Python exception handling: it works well until you try to work with a somewhat complex
by heavenlyblue 8y ago
Said so many times. Do not ever use nulls as flags.
It’s incredibly like Python exception handling: it works well until you try to work with a somewhat complex codebase: eg paramiko. The IOErrors can be raised by any layer of the stack. So how do I handle this in the code?
Well, turns out I can’t definitely tell one from another.
Same is with the null values: never use nulls as a flag unless you’re absolutely sure that null value will not be boxed in another “Optional”.
- tbronchain 8y agoSo your understanding of the pattern #3 is that, null was being used instead of an empty list, and in this case it's better to use an empty container. In that case, it makes sense, that's not how I understood it at first. Oh and, I agree about the not using null thing at multiple levels.