My team uses utility methods and for practically everything. I’ve tried writing code in ways that don’t use them, but I usually get told by my team lead to rewrite the code in ways that use mostly and methods.

Needless to say, we don’t unit test. And even writing integration tests is difficult. Plus the code is just messy and hard to follow. We have a lot of strings of static calls calling static calls calling a static call that does something unexpected.

Now my team lead has asked me to “figure out the best way to test and mock singletons”. I want to tell him that you do that by not using singletons in the first place.

The thing is I’m a new developer, I’ve only been in the industry for about 6 (all at this job) so I’m having trouble really articulating why our design is so . All I know is that every blog and Stackoverflow answer I’ve ever read on the topic says not to do this. But they don’t seem to really why, I feel like I’m going to need to give him an answer that doesn’t involve abstract talk about testability and apis being pathological liars. As I said it’s impossible to unit test right now, but we don’t seem to value unit testing.

We work in Android/Java.



Source link
thanks you RSS link
( https://www.reddit.com/r//comments/a0ly7w/can_someone_explain_simply_and_clearly_why_static/)

LEAVE A REPLY

Please enter your comment!
Please enter your name here