New answers tagged dependency-injection
I think the danger here is using only the @ImplementedBy annotation. Used appropriately, in conjunction with bind() statements in your module and so forth, it is okay. Having a default implementation is great for testing; you don't necessarily want to have to explicitly define a mock injection every time you are testing a class that has lots of ...
It's unclear from the question if remote repo doesn't support add/update operations at all or only for specific types. In case of the first option, I would go with 2 interfaces: IReadonlyRepo, IWritableRepo. In case of the second option, I would go with the exception approach.
Pros and Cons As with any situation where there's a judgement call to be made, it's worth weighing up the main pros and cons. I'll summarize them as I see them, then go into some aspects a little deeper to try to show why- although there are some situational aspects- in the large majority of cases the factors pretty heavily favor a particular answer. Pros ...
Top 50 recent answers are included