Today I’ll be taking you on a short journey to understanding what Frameworks and Libraries are, and the differences that exist between them.
That said, let’s hit the road.
One thing that you should get clearly before we proceed is the fact that Libraries and Frameworks are very different terms that shouldn’t be used interchangeably as they both operate with different concepts.
A number of Frameworks and Libraries exist for various core programming languages. They are developed by certain individuals or groups to make problem solving in these core languages easier and faster. A list of popular programming languages and an example of their Libraries and Frameworks are shown below:
Language | Framework | Library |
JavaScript | Vue | jQuery |
Ruby | Rails | Carrierwave |
PHP | Laravel | PHP Rector |
Libraries
Libraries are reusable functions created to solve specific problems. These functions are condensed lines of codes called by the developer only when he needs to solve a particular problem or perform a specific task.
A quick example to drive this home is the process of making rice. In the part of the world where I come from, people make rice with various ingredients (some of which are dispensable), some of which are added at various intervals based on the needs and choice of the cook. The same process of adding ingredients at different intervals, applies to libraries as they are only used when appropriate, leaving the developer in charge of when and where they should be called and used.
Libraries help you perform tasks without changing anything at the structural and architectural level of the codes and this makes it possible and easy for it to be added seamlessly into existing projects.
Frameworks
In computer programming, a software framework is an abstraction in which software providing generic functionality can be selectively changed by additional user-written code, thus providing application-specific software.
– Wikipedia, May 15th, 2020
In a more simpler term: Frameworks provide a skeletal system for your projects and then allows you to add flesh to it.
Since it can’t be integrated into existing projects seamlessly, Frameworks form the base of a project. That is, if you must use a Framework, you must start the project with it. Once the project is started, the Framework which is highly opinionated determines the flow. Like where and where exactly a developer should add different parts of his codes or files. Frameworks leave the developer with no control (Inversion Control) as the developer is fully immersed in the workflow of the Framework and not his.
Here’s a quick illustration to drive my point: There are different recipe books describing the procedures involved in making zucchini bread. Any recipe book you decide to use has a Framework you need to follow to arrive at a desired taste, which might be different from what other recipe books may provide. Each step you need to execute is well defined in the recipe book and must be followed from the beginning to the end in the defined order if you must arrive at your result. The recipe book allows you to carry out certain steps while withholding the privilege to edit the steps it provides. This above, explains the way Frameworks work.
Conclusion
In conclusion, you should remember that any function belonging to a Framework can only be called within that Framework, while a Library can be called at any point out of context.
With these said, where do you think ReactJS fits in?