A
A
Alex_872018-11-06 21:46:31
JavaScript
Alex_87, 2018-11-06 21:46:31

What is the essence of frameworks and libraries?

Hello guys. Please help me to understand the following question. The thing is that I can’t clearly define what frameworks and libraries are. And my questions are something like this...
1) A framework is a tool for good code splitting. What else is its essence? ... How else do they differ from each other? Is there a difference between them in terms of capabilities/tasks? For example, one framework better helps developers who write sites where there is a need to add functions for a map (for example, google map), etc.
2) Is it possible to use two frameworks on one site? For example, there is a js framework (vue), and there is a php framework (YII) If not, then how to understand what to choose?
3) Is it correct to compare frameworks and libraries, or does each framework have its own library?
4) What advise to use if I need to write my own functions for the map? And what map, besides google map (since it is already paid and quite expensive), can you advise to take for further writing your functions?
PS I understand perfectly well that you first need to master js well. Of course, there is no understanding of which topics (of course, the more the better), but still) ... What to study after pure js? I hope for your help!

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Stalker_RED, 2018-11-06
@Stalker_RED

A library is a tool or a set of some tools.
A library for downloading videos from YouTube A
library for cropping and resizing images A
library for determining a city by IP
A framework can use dozens or hundreds of different libraries. This is a set of not only tools, but also ready-made components, and also a recommendation for their use.
"birdhouse building kit"
Includes a hammer, nails, carpentry glue, 20 wooden planks of different shapes and colors and instructions with three birdhouse options to choose from.
Or here are two frameworks:
Can they be used together? (Of course, no one forbids)
Is it possible to build something completely different from these parts, not like in the instructions? (Of course yes)
Is it possible with these frameworks to use details from this as well?
(of course you can, but you have to come up with something to make the parts compatible. You may have to use glue, electrical tape, plasticine or chewing gum. Or a screwdriver, or a welding machine. But these additional tools are not included in any kit, as well as skills for them. )
You can also look here, this answer partially covers your question:
What are frameworks for, a la Laravel?

S
stratosmi, 2018-11-06
@stratosmi

1) The framework, as a rule, recommends (and some impose) a certain organization of the code structure, yes. For this, he also gives you something - he takes on typical work, which is repeated from project to project, why do it all over again.
Yes, their functionality is different. From minimalist to comprehensive.
It is quite possible to use a CSS framework for layout, a JS framework for dynamics, a backend framework on one site. If the CSS framework and the JS framework can still possibly interfere with each other (but usually do not interfere), then the backend framework functions on the server as a thing independent of CSS / JS at all (CSS / JS function in the browser, not on server).
2) Yes. If they are specialized on different issues (Zurb Foundation for CSS and Vue.js for JS and Yii for PHP, for example).
But if they are doing similar things (for example, React and Vue), then the expediency of such an application is not clear. Moreover, they can easily interfere with each other. You have to look at the situation.
3) Libraries are a very specific local tool. Therefore, they are more independent of the project.
Frameworks, on the other hand, are aimed at more automating the solution of your problems in a particular situation, and you are more dependent on them (which is not bad, given the benefits that frameworks bring, it just needs to be taken into account).
The fact that frameworks use libraries does not allow us to draw any additional conclusions.
Everyone uses libraries, this is the norm.
4) Established APIs of the selected map service (Yandex Maps, 2GIS Maps, OpenStreet Maps, etc.). These APIs are implemented as libraries. Frameworks don't work here at all.
PS:
2GIS specialized service:
Enterprises/companies/organizations are very well represented in 2GIS (in cities where 2GIS is present), better than others. There is no 2GIS between cities in principle.

A
Anton, 2018-11-06
@sHinE

I saw this phrase about the difference between a framework and a library and I liked it:
You call the library from your code, and the framework, on the contrary, calls your code.

W
werevolff, 2018-11-07
@werevolff

1. A framework is a framework for an application. The library is the finished code. The framework provides the developer with the architecture on which the application is built. The library does not provide an architecture. You call it to get the result in a separate part of your application.
2. You can use multiple frameworks. Each framework is responsible for its own application or part of the project. For example, you can make the site admin panel on Angular.js and the client side on React. You can make one page on React.js, the second - on vue.js. The same part of the project on different frameworks will not work. Which one to choose is a matter of experience. You won't understand until you start writing.
3. Some libraries can replace frameworks by having a complete set of abstractions to solve the problem. Is it possible to compare libraries and frameworks? It depends on the comparison parameters. If you can justify what you are comparing, then I see no problem. But, to justify it, you need to have experience in working and solving applied problems.
4. I can not advise anything: the choice of a library or a framework is the responsibility of the developer. If a developer with this question goes to the toaster, it is cheaper to advise another developer.
PS Don't get hung up on vanilla JS. It is worth choosing a framework and working with it. Understanding will come with experience.

A
Artem Spiridonov, 2018-11-15
@customtema

There is a good approach in programming like Dont Repeat Yourself. It makes no sense to reinvent the wheel every time - existing modules are put into libraries and reused.
Collections of libraries are called frameworks. Frameworks, as a rule, are specialized - each for its own task. From QT and GTK to YII2 and ThreeJS.
A set of libraries, frameworks, try to design in the same style. Often the framework carries a certain Style Guide, recommendations for the environment, architecture and other decisions. Just something ready-made that does not need to be invented, but can be taken and used at some point.
Developer communities gather around frameworks. Therefore, in each component of the framework, as a rule, a lot of work has already been invested. One developer will not be able to devote so much time and attention to the development of any one feature. A thousand, maybe.
Colleagues who disdain frameworks are not adequate. The invention of bicycles is only useful for education. In real work, it brings problems:
Therefore, when colleagues disdain frameworks, this is more likely due to the fact that this individual colleague does not want to learn anything new because of the inability to learn, or suffers from some form of mental illness. This is a very common occurrence.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question