Over abstractor: “We should wrap React in case we move to Vue or Svelte.” What


Over abstractor: “We should wrap React in case we move to Vue or Svelte.” What? No. That won’t work.

Under abstractor: “We can call fetch in each component.” What about caching? Retries? Error handling? Wrap fetch to centralize your app’s unique fetch-related opinions.
Summary:
Avoid abstracting foundational libraries “just-in-case” you switch tech at some point.

But, consider abstracting to centralize config and streamline code.
I worked with an over abstractor. He wanted to abstract every tech we used.

"We need to abstract SQL Server in case we change to Oracle or MongoDB."

The problem: The wrapper's API is unlikely to be compatible with the new thing. Abstractions leak and constrain.

View original on X