I like to think of one aspect of this as the invisible path of implementation. It's when you get those if (!myvar) {...} statements - languages may vary, but there's usually several possible values that result in this being falsy. One of those cases is probably important and should have been explicit, but hey, it looks neater if we don't clog the code up with explicit checks!
But, I don't hold with the idea that the original implementer did not know what they were doing and that this code should be refactored. Often, other unobvious constraints like performance, accessibility, the language itself, and the complexity inherent in the problem domain itself can dictate a certain approach that isn't immediately obvious, and creates the illegible code (maybe to the inexperienced eye) and there's no way around it without a serious technology change and/or complete rewrite. And that tends to be the way it's done, creating the cyclical lifetime of software.
And hence, I would suggest the issue is that we lack a programming language that can convey the assertions that make intention, and is still clean enough to ensure they are implemented properly. We haven't reached that evolution yet.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I like to think of one aspect of this as the invisible path of implementation. It's when you get those
if (!myvar) {...}
statements - languages may vary, but there's usually several possible values that result in this being falsy. One of those cases is probably important and should have been explicit, but hey, it looks neater if we don't clog the code up with explicit checks!But, I don't hold with the idea that the original implementer did not know what they were doing and that this code should be refactored. Often, other unobvious constraints like performance, accessibility, the language itself, and the complexity inherent in the problem domain itself can dictate a certain approach that isn't immediately obvious, and creates the illegible code (maybe to the inexperienced eye) and there's no way around it without a serious technology change and/or complete rewrite. And that tends to be the way it's done, creating the cyclical lifetime of software.
And hence, I would suggest the issue is that we lack a programming language that can convey the assertions that make intention, and is still clean enough to ensure they are implemented properly. We haven't reached that evolution yet.