mvvm - Is there a point to dependency injection container in Javascript? -


i'm long time back-end developer have managed develop medium sized one-page web-app.

on server side have worked many modern frameworks spring, grails, symfony, silex, slim , other , liked concept of micro-framework of silex or slim (in case mvc frameworks).

on client side, due different application nature think mvvm best approach.

quickly evaluating micro js framework (riot, backbone) , comparing server side background have noted in js frameworks dependency injection container (dic) not considered fundamental part of framework (micro frameworks @ least).

on every server side mordern mvc (micro)framework dic foundation of framework don't see happen on javascript frameworks (micro frameworks @ least, know heavy fat angular have it).

from searches standalone dic container js followers bottlejs has 672 stars on github. comparing php there many standalone dic projects, example pimple (1570 stars) or php-di (1040 stars) can see great disparity

do think critical mistake or subvalutation many js micro-framework do? or modularity, testability , mantainability of dic achievable in other way in js.

singletons can naturally produced js modules, isn't concern di. , testability achievable js module mocking, (proxyquire, etc). frameworks (durandal, react-like) rely on.

in testing rig es6 modules use require under hood way, method still applicable. proxyquire , other cache-mangling libraries may have limitations (deep dependencies), in well-written test mock units 1 level higher, works. how done in jest internally, conventionally used test react , react-like.

so depends on these 'micro-frameworks' are. current-gen macro-frameworks, react supposed not need dic (also, isn't opinionated, it's developer's responsibility extend it's functionality). while angular, aurelia, ember, polymer , vue 2 feature dic - because benefits application design.


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -