My team uses utility methods and singletons 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 singletons and static 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 months (all at this job) so I’m having trouble really articulating why our design is so bad. 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 explain 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.