Reputation: 1006
I am new to web development. I am a C++ developer. I worked on a project where we were using different graphics libraries. Based on the systems environment variable we decide which library to use. I want this kind of design where we can change Javascript framework based on some settings. As technology is changing very fast Can we design such a way that we can change frameworks used in our web application will easily changeable? Is there any tool which can handle this or a design/architecture we can follow to achieve this.
Upvotes: 0
Views: 290
Reputation: 9446
This generally isn't the way JavaScript applications are written. The whole point of the framework is to have a skeleton that you build your code around. This is the fundamental difference between a library and a framework. Libraries (if they are designed well) are interchangeable, and the applications that use them can abstract away that dependency.
Theoretically you could write a new framework that abstracted several other underlying frameworks, but many of them have very different philosophies about how applications should be written. Some are more DOM centric, some are more event-driven, and some are very model-driven. Making something that would encapsulate both something like JQuery and Angular and React would be almost impossible (and certainly larger than any of those frameworks individually).
Finally, part of the value of using a framework is that you can ignore all the bits that they handle for you. When you try and fight those frameworks, and build something independent, they will generally fight you, and make your life miserable. You will spend more time writing wrappers and hacking your way through layers than you ever would just writing your application.
Do yourself a favor, pick a framework, build your app, and throw it away when you decide to switch. It will be far cheaper than trying to abstract over these various systems (plus you can't predict the future, so you will ultimately choose the wrong abstraction anyway).
Upvotes: 1