What is the difference between a framework and a library?
Novice programmers confuse frameworks with libraries. They are similar to each other, but at the same time, they have differences. Before you understand the differences and similarities, you need to know what these meanings are.
What’s a "library"?
"Library" is a set of functions and ways of solving the functionality of the project for which the code is being written. A programmer does not always have to write code from scratch. He can use libraries of functions that were written by others before him.
These are programs that are controlled by the programmer. For instance, examples of such libraries can be used:
- Curl (PHP);
Code from the set of another "coder" is taken and used in any form. For example, there is the Util Java library and the "reverse" method in this set. It helps you to refer to any line in the code. The programmer does not need to declare variables or run a loop to access the string. It is enough to prescribe "sb.reverse()".
- Libraries are 100 percent under the programmer's control.
- For small applications, you don't need to use multiple sets of solutions, just one library is enough.
- Expands the horizons of technical tools, improves the programmer’s level of knowledge if you use a large number of solutions sets.
- Architectures that are embedded in the solution sets may not always beautify the application, but, on the contrary, can spoil it. Therefore, it is necessary to treat other people's sets of code carefully.
- It takes a lot of time to compare different solution methods for a single application.
So an experienced programmer chooses to use a framework.
What are the frameworks?
The framework is a platform for the program. They make it easier to develop and combine different code elements of one large project. Now the programmer does not have to sit and write code, compare whether it is suitable or not.
Most popular frames:
In fact, it is a skeleton for a set of codes, which the programmer builds "meat" on. The framework solves problems on its own. This is the problem: it tells the programmer what is needed, and creative freedom is excluded.
- It is easier to train your teammates if you are working on a project as a team. Since you only have to study one component, not several;
- There is no need to compare different objects. The frame will prompt the programmer which one is needed for this particular skeleton;
- You do not need to focus on code compilation, the path for project development is released.
- Loss of productivity. Frames consist of a large amount of code, so the time to load them into the project is greatly increased;
- You cannot create simple applications. A scalable architecture solves many problems, but an overly complex infrastructure only complicates the task of a small project;
- A specific programming style: components are more connected than in libraries. There is no freedom to develop the project in a slightly different way.
As with libraries, you don't need to stop using the same frame all the time. Because now they are getting obsolete very fast.