Sharing Top Content from the Angular-sphere.

The Importance Of Abstraction in JS

  • If you’re like me, and I believe you are, you always want your application to be ahead of its time.
  • The bigger your application, the more difficult it is to migrate to newer stuff.

JavaScript is no longer what it used to be. The Web has evolved in an extraordinary way. Yes, you know what I’m talking about. You sense it too. The bigger your application, the more difficult it is…

JavaScript is no longer what it used to be. The Web has evolved in an extraordinary way. Yes, you know what I’m talking about. You sense it too.

Every day new libraries are published, new ideas are introduced, and new API’s come into the world.

If you’re like me, and I believe you are, you always want your application to be ahead of its time.

The bigger your application, the more difficult it is to migrate to newer stuff. How can we always stay one step ahead? How can we minimize the difficulty of this transition?

Let me equip you with one important tip — abstraction.

Put simply, the developer will have the information on what the object does, not how it does it.

For this example, we will take the library that most of us use — Lodash.

The problem with the above code is that when we use it, we tie our application to Lodash. But what if, at some point, we want to change Lodash with something like Ramda, or even better, with the native JS API’s? This won’t be an easy task.

To overcome the problem, we can create an abstraction.

Again, our application is tied to a specific implementation. What if we want to use a different library or swap and use the native fetch API? What if, even worse, a new version of axios is released with breaking changes in the API? we…

The Importance Of Abstraction in JS

Comments are closed, but trackbacks and pingbacks are open.