Hacker News new | ask | show | jobs
by deepsun 178 days ago
No, some other library classes accept only their own, not my adapter.

Not mentioning of course needless copy-pasting dosens of members in the adapter. And it must be in prod code, not tests, even though it's documentation would say "Adapter for X, exists only for tests, to be able to mock X".

1 comments

You wrap whole 3rd party dependency in an adapter.
That's a lot of upfront work and maintenance, not to mention the friction of needing to mentally translate every occurrence of OurFooAdapter to Foo in order to find documentation.
Yeah, well, good code takes some thought to produce. More news at 11.
The second argument still holds -- all those wrappers will exist in prod only for tests.

Moreover, that wrapper library is now a pretty large piece of code, and we'd want to maintain and test as well. But cannot without hacks.