W
W
Worddoc2016-11-13 20:56:40
JavaScript
Worddoc, 2016-11-13 20:56:40

CommonJS / RequireJS - why?

Hello. Who can explain to a dumb person what is the difference between common.js and require.js and why are they needed at all? Plus, in what situations should such tools be needed and why do we need all these dependency injection? There is a lot of different information on the Internet, I can not come to a consensus. I'm frustrated... Thank you

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2016-11-18
@Worddoc

Plus, in what situations should such tools be needed and why do we need all these dependency injection?

Control inversion . Dependency management, decoupling between system components. That what should depend on something and vice versa.
There is no need to think that there are universal approaches. There are different approaches, each with its pros and cons.

N
Natalia Bazenova, 2016-11-13
@logiciel

I don’t undertake to give an answer, since this is also not entirely clear to me, but after getting acquainted with nodejs, where require is used to load modules, I begin to suspect that it was adopted into the client part for the sake of a uniform approach. And in fact require on the client is not so necessary.

P
Pavel Kokovin, 2016-11-14
@Per_Ardua

These tools are needed for several things:
1. Creating a modular structure
2. Lazy loading
3. Organizing and increasing control over project dependencies
All this is not needed on small projects. But without this it is difficult to manage on large ones.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question