4 ms·
Interesting. I'd love to know a bit more about why these harm testability for you. I'm not sure I've felt the same way. Especially the global scope bit. Even s
by kjeetgill 4y ago
Interesting. I'd love to know a bit more about why these harm testability for you. I'm not sure I've felt the same way.
Especially the global scope bit. Even statics fields are too much global scope in my opinion, not too little.
- chopin 4y agoStatic fields can get in the way of testability very quickly, in my experience. Even static methods can if they draw in dependencies.
- Supermancho 4y ago> why these harm testability for you They harm testability for me, because I have to use java to test them. There's a larger discussion about "what is testing" and "how to properly test" which I'm not going to get in to here, but would be happy to talk about in another forum. JUnit (and all the inferior alternatives) can't properly mock them or verify how/when they are called (despite running in a closed test container, which is how JUnit executes them). If you have ever tried to deal with native methods (or FAANG libs that like to use static final methods), there's a practical barrier to how much state you can avoid in testing. That barrier is java's ecosystem itself (JVM + syntax + tooling + ethos).