News for hackers. Stuff that matters.
Re:Track down the JavaScript code responsible for polluting ... by jasonkester on Thursday February 17, 2022 @02:51AM (#30370538)
One thing I missed above is "But what about Testing???", since that's a common reason for building things this way.

For me, the most important aspects of a codebase are "is it Readable" and "is it Debuggable". In my mind, the problem with building in a functional style for Testability sake is that you have to trade off a lot of Debugability to get there. It's the "know what's going on" bit I wrote above. For me, it's not an acceptable tradeoff. Bug reports come in from users as "debugging requests" rather than unit tests, so I want to optimize for that sort of future work.

I actually wrote an article about this a dozen years ago [1] listing my priorities in a codebase, and I don't even think Testable made the list. I'm all for testing where it makes sense, but I'm not going to rearchitect my thing just so that testing is easier.

[1] https://www.expatsoftware.com/articles/2007/06/getting-your-...

Re:Track down the JavaScript code responsible for polluting ... by mmazzarolo on Thursday February 17, 2022 @03:26AM (#30370751)
At this point I’m not even sure if the post is talking about the same thing you’re mentioning. It’s not about “global state” in a sense of state available across the app, it’s specifically about not using the JS engine’s global object (https://developer.mozilla.org/en-US/docs/Glossary/Global_obj...) to avoid common pitfalls.