4 ms·
Been pitching in with the Java backends as a frontender at work and the impl/interface distinction on a per singleton basis in just... why? It's a fucking singl
by imbnwa 6y ago
Been pitching in with the Java backends as a frontender at work and the impl/interface distinction on a per singleton basis in just... why? It's a fucking singleton.
- jfengel 6y agoPresumably, so they can stub out the singleton for testing. It makes sense, sometimes, like the way your global database is a singleton that you really don't want on every test. But in a lot of cases it's overkill and makes everything harder. Following a rule to always do it is simple but using your judgement is better. The best code minimizes side effects and reduces stubs and fakes.