4 ms·
I personally am not a fan of too many abstractions. If the only reason for abstraction is testing, then mocking an interface seems like a more valid choice to
by emilsedgh 6y ago
I personally am not a fan of too many abstractions.
If the only reason for abstraction is testing, then mocking an interface seems like a more valid choice to me.
- xadoc 6y agoThe abstraction is there because in many static languages you will immediately have two implementations, the infrastructure one (database, API call, 3rd party) and the tests.
- jjpe 6y ago> I personally am not a fan of too many abstractions. Then you're likely in the wrong business, since most of what programming is is dealing with the various facets of one abstraction or another.
- TomMarius 6y agoThis is definitely a valid approach to software development, e.g. in embedded development (where you still might need to call APIs).
- emilsedgh 6y agoAbsolutely. I'm not saying I don't want to abstract anything or deal with any abstractions which can lead to ridiculous code [0]. I just prefer to abstract when I have more reasons that just testing. That can be done using mocking techniques. https://docs.spring.io/spring/docs/2.5.x/javadoc-api/org/springframework/aop/config/SimpleBeanFactoryAwareAspectInstanceFactory.html https://docs.spring.io/spring/docs/2.5.x/javadoc-api/org/spr...