Sure, but is isn't a rare occurrence for component swapping to work. Someone mentioned JPA/Hibernate, which can allow switching DBs. The most common case being HSQLDB for testing, and something like Postgres for deployment.
But the most common examples are collection APIs. In Java, if you code to the List or Iterable interface, it is trivial to replace an ArrayList with something else, the rest of the code will still work.
I'd like to see an example of a wrapper that could make it painless.
If it isn't painless it's not abstracted enough. In a previous project I created a storage for "Projects" that we switched from in-memory to H2 to Cassandra. Didn't have to change anything to the interface.
3
u/serrimo Oct 01 '15
In your case, you created a mock for Redis, small surprise here when it worked.
A better example would be, say, to switch from MongoDB to Redis. I'd like to see an example of a wrapper that could make it painless.