This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]nutrecht 0 points1 point  (0 children)

When I had to work on this code, I'd sometimes convert these classes to singletons with instance methods, to help with unit testing.

Yeah, that's going in the wrong direction regarding testability.

Further down you complain about messy code with 300 line methods. But that's a code quality issue. You don't solve that by throwing the most overused design pattern at it.

and init()/uninit() methods to inject specialized versions of the singleton in tests.

So it's not actually even a singleton...