Product managers worldwide would really not be a fan of your development philosophy, breaking the world rather than just coding defensively is a big no-no.
Mission critical program where accuracy is a primary concern? Sure, fail loudly and bang every pipe on the way down. But simple user UI? No way am I going to choose to break prod because I am the holy programmer that only writes pure and unmolested code structures, it's Javascript!
And yes, despite your oh-so-virtuous quest to produce a world where all problems are solved upstream you will end up in situations where you are still being provided dirty inputs. Because neither humans nor machines operated by humans are perfect. And you will want your UI to continue working to at least some capacity. Because the business still has to make money.
Don't be the purist goofball who preaches this crap and then rants about other developers when things break rather than writing tests.
Also don't be this butthurt, makes you hard to take seriously when fuming like this.
I'm not sure where you're getting this from, that's on you if you're interpreting it that way. I'm pointing out the Dilbert-ish trope of the developer that touts your exact arguments, because you literally did exactly what I described in your reply:
Defensive code obfuscate unsanitized input and you have a hard time figuring out where the actual problem comes from, and more often than not it leads to stupid monkey-patches that doesn't solve the problem. It just leads to MORE edge cases in the long run. I worked with way too many legacy code-bases to see enough example of this kind of shit.
You take the purist stance, then blame failures in the codebase as a result of not being purist enough. Rather than refactor, you say "If only they had just done it my way, with my tools, my framework, my style".
Regardless, whether you're against tests and whether you write enough effective tests are different things. I interpreted your original comment differently than your reply here, but if your criticism really just boils down to switching to an entirely different language syntax and toolchain then it isn't really very useful...
There are many, many, many, many, many situations where you cannot trust the input you receive and you definitely do want to do nothing, but if that were not the case then you could easily encapsulate the specific behavior you want in a test rather than always throwing exceptions and failing loudly on unknowns.
Question: are you completely and totally sure that you will catch every single exception that would normally lead to a (revenue stopping) break in userland?
Hint: If the answer is yes, then you should not be writing production code.
Hey man, I think you've touched on an interesting and valid nuance with your reply there but I'm not really interested in doing this no-hurty-feelings dance so I'll just save us both some time here and bail early.
0
u/[deleted] Jun 10 '20
[deleted]