ïŒ2012幎7æ27æ¥ïŒãã€ãã£ãWebã¢ããªã±ãŒã·ã§ã³ãäœæãããšããDOMã©ã€ãã©ãªïŒ
jQueryãªã©ïŒãšå°æ°ã®ãµãŒãã¹ãã©ã°ã€ã³ã ãã§äœæ¥ã§ãã
ç¥ã®ãããªæ°åã«ãªããããã§ãã ãã¹ãããã
jQueryæ»ãé¢æ°ã®å±±ãšãã¢ããªã±ãŒã·ã§ã³ã§ã¯ãªãæ§é ã®ãªãåæ£DOMèŠçŽ ãšãã圢ã§ãããã«åé¡ãçºçããŸãã
èŠããã«ãç§ãã¡ã¯
ã¹ãã²ããã£ã³ãŒãã§ç«ã¡åŸçããŠã
ãŸã ã 幞ããææ°ã®JSãã¬ãŒã ã¯ãŒã¯
ïŒæ©èœã«å ããŠãã³ãŒããæŽçããããã®ã«ãŒã«ãæå®ããã©ã€ãã©ãª-ãããTranslïŒããããŸããããã¯ããããžã§ã¯ãã®æ§é ãšçµç¹ãç¶æããå°æ¥ã®ä¿å®æ§ãä¿é²ããŸãã
â MVCãšã¯äœã§ããïŒ
ãããã®ææ°ã®ã©ã€ãã©ãªã«ãããéçºè
ã¯
MVC ïŒModel-View-ControllerïŒãšããŠç¥ããããã¶ã€ã³ãã¿ãŒã³ã®ããªãšãŒã·ã§ã³ã䜿çšããŠã³ãŒããæŽçããç°¡åãªæ¹æ³ãåŸãããšãã§ããŸãã MVCã¯ãã¢ããªã±ãŒã·ã§ã³å
ã®ã¿ã¹ã¯ã3ã€ã®éšåã«åå²ããŸãã
ã¢ãã« ïŒããžãã¯ïŒã¯ãã¢ããªã±ãŒã·ã§ã³ã®åé¡æåã®ç¥èãšããŒã¿ãè¡šããŸãã ãããã¯ããŠãŒã¶ãŒãåçãã¡ã¢ãªã©ãã¢ãã«åã§ããããŒã¿ã®ã¿ã€ããšèããŠãã ããã ã¢ãã«ã¯ãçŸåšã®ç¶æ
ã芳å¯ããªããäœãã«ã€ããŠéç¥ããå¿
èŠããããŸãã
ãã¥ãŒã¯éåžžãã¬ã€ã¢ãŠãããã³ãã¬ãŒããªã©ã®ãŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ãšããŠèšèšãããŠããŸãããã€ã³ã¿ã©ã¯ãã£ãã§ã¯ãããŸããã ã¢ãã«ã®ååšãèªèããŠããå¿
èŠããããŸãããã¢ãã«ãšçŽæ¥éä¿¡ããããšã¯ã§ããŸããã
ã³ã³ãããŒã©ãŒ ïŒãã£ã¹ãããã£ãŒïŒã¯ã¢ããªã±ãŒã·ã§ã³ã®å
¥åããŒã¿ïŒã¯ãªãã¯ããŠãŒã¶ãŒã¢ã¯ã·ã§ã³ïŒãåŠçãããã¥ãŒã¯åŠçã®åºå補åãšèŠãªãããšãã§ããŸãã ã³ã³ãããŒã©ãŒãã¢ãã«ã®ç¶æ
ãå€æŽããå ŽåïŒããšãã°ãåçã®ãã£ãã·ã§ã³ãç·šéããå ŽåïŒããã¥ãŒã¯çŽæ¥å€æŽãããŸããã ããã¯ãã¢ãã«ãšãã¥ãŒã®é¢ä¿ãæ©èœããå Žåã§ãã
ã³ãŒãã®æ§é åã«åœ¹ç«ã€Javascript MVCãã¬ãŒã ã¯ãŒã¯ã¯ãå¿
ããã説æãããŠãããã¿ãŒã³ã«å³å¯ã«åŸããšã¯éããŸããã äžéšã®äººã«ãšã£ãŠã¯ãã³ã³ãããŒã©ãŒã¯ãã¬ãŒã³ããŒã·ã§ã³ïŒ
backbone.js ïŒãæ
åœããèªä¿¡ãæã£ãŠã³ã³ããŒãã³ããæ··åããããããããŸã§ãããè¯ããšä¿¡ããŠããŸãã
ãããã£ãŠããã®ãããªãã¬ãŒã ã¯ãŒã¯ãMV *ãã¿ãŒã³ãšåŒã³ãŸããã€ãŸãããã¥ãŒãšã¢ãã«ã¯ããã§ããå¯èœæ§ããããŸããã
ïŒã³ã³ãããŒã©ãŒ-ãããTranslãã ãã§ã¯ãªãïŒå¥ã®ãã®ãè¿œå ãããŸãã
åè MVPïŒã¢ãã«-ãã¥ãŒ-ãã¬ãŒã³ã¿ãŒïŒããã³MVVMïŒã¢ãã«-ãã¥ãŒ-ViewModelïŒãšåŒã°ããMVCã®ããªã¢ã³ãããããŸãã ããªãããããã®æŠå¿µã«äžæ
£ãã§ãããããããä¿¡ä»°ã«ä¹ããããšã«å察ããŠãããªããå¿é
ããªãã§ãã ããã ãã¿ãŒã³ã«æ
£ããã«ã¯æéãããããŸãã ãã«ããå¿
èŠãªå Žåã«åããŠããªã³ã©ã€ã³ãã¥ãŒããªã¢ã«ã Learning JavaScript Design Patternsãã§ãããã«ã€ããŠè©³ãã説æããŸããã |
â JS MV *ãã¬ãŒã ã¯ãŒã¯ãå¿
èŠã«ãªãã®ã¯ãã€ã§ããïŒ
1ããŒãžã®ã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããå ŽåããŸãã¯è€éãªãŠãŒã¶ãŒã€ã³ã¿ãŒãã§ã€ã¹ãäœæããå ŽåããŸãã¯åã«HTTPãªã¯ãšã¹ãã®æ°ãæžããå Žåããããã
Backboneã
Emberã®ãããªMV *ãã¬ãŒã ã¯ãŒã¯ã®æ§é ã®å€ãã®éšåãçºæããã§ãããã
äœæ¥ã®æåã«ãã¹ãã²ããã£ã³ãŒããåé¿ããããã®äœããã®
èªè»¢è»ã¡ã«ããºã ãæäŸããã¢ããªã±ãŒã·ã§ã³ãã¬ãŒã ã¯ãŒã¯ãèšè¿°ããããšã¯ããã»ã©é£ãããããŸããã ããããããã¯ãããçš®ã®ã
ããã¯ããŒã³ãæžãããšã»ã©é£ããããšã§ã¯ãªããšèšãããšã¯ãããŸãã«ãééã£ãŠããã§ãããã
æ§é åã¢ããªã±ãŒã·ã§ã³ã«ã¯ãDOMæäœã®ãã€ã³ãããã³ãã¬ãŒãåãããã³é¢ä¿ã®è¡šç€ºãããã¯ããã«å€ãã®ããšããããŸãã æçããMV *ãã¬ãŒã ã¯ãŒã¯ã«ã¯ãéåžžãäœæããå€ãã®éšåãå«ãŸããã ãã§ãªããå°æ¥ã®åé¡ã«å¯Ÿãã解決çãå«ãŸããŸãã ããã«ããæéãç¯çŽã§ããŸãããéå°è©äŸ¡ããããšã¯ã§ããŸããã
â MV *ã¯ã©ãã§å¿
èŠã§ããïŒ
APIãšéä¿¡ããããããŸãã¯ããŒã¿ã衚瀺ãŸãã¯ç®¡çããäž»ãªè² æ
ããã©ãŠã¶ãŒã«ããããã¯ãšã³ãããŒã¿ãåŠçããããã®ã¢ããªã±ãŒã·ã§ã³ãäœæããŠããå ŽåãJavaScript MV *ãã¬ãŒã ã¯ãŒã¯ã圹ç«ã¡ãŸãã
ãã®çš®ã®ã¢ããªã±ãŒã·ã§ã³ã®è¯ãäŸã¯ã
Google Docsãš
GMailã§ãã éåžžããã®ãããªã¢ããªã±ãŒã·ã§ã³ã¯ãäžè¬çãªã¿ã¹ã¯ã®ãã¹ãŠã®ã¹ã¯ãªãããã¹ã¿ã€ã«ãããã³ããŒã¯ã¢ããããã€ããŒãã«äžåºŠããŒãããŠãããããŒãžã®ããã¯ã°ã©ãŠã³ãã§å€ãã®å°ããªã¢ã¯ã·ã§ã³ãå®è¡ããŸãã ãããã¯ãã¡ãŒã«ãææžãèªãããšããæçŽãæžãããšãžã®ç§»è¡ã§ãããæ°ããããŒãžãããŠã³ããŒãããå¿
èŠã¯ãŸã£ãããããŸããã
ãããã倧éã®ãã¥ãŒïŒããŒãžïŒçšã®ãµãŒããŒãå¿
èŠãšããã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããå
±æã«å°ããªJavaScriptãŸãã¯
jQueryã䜿çšããå ŽåãMVãã¿ãŒã³ã¯èŽåœçã§ãã ãã¡ããããã¥ãŒã®éšå衚瀺ãåäžããŒãžã®ã¢ããªã±ãŒã·ã§ã³ã§ããŸãåäœããå¯èœæ§ã®ããè€éãªã¢ããªã±ãŒã·ã§ã³ããŠã§ãäžã«ãããŸããããã以å€ã®å Žåã¯ãããåçŽãªããŒãã¡ã«ããºã ãéžæããæ¹ãé©åã§ãã
â éžæã®åé¡ïŒãªãã·ã§ã³ãå€ãããŸããïŒ
éå»æ°å¹Žã«ããããJavaScriptã³ãã¥ããã£ã¯ã«ãããµã³ã¹ã®ãããªãã®ãçµéšããããã«è€éã§èšå€§ãªã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããŠããŸããã ãããã®ã¹ã¿ã€ã«ã¯ãC ++ãJavaã§æ§ç¯ãããå€å
žçãª
ãœãããŠã§ã¢ã¢ãŒããã¯ãã£ãšã¯éåžžã«ç°ãªããWebéçºçšã®èšèªïŒPHPãPythonã.Netãªã©ïŒãšãšãã«Webã§ã䜿çšãããŸãã ãã®çµæãä»ã®èšèªã§èŠããã®ããã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ãããšããã¢ã€ãã¢ãåããããšããããããŸãã
ç§ã®ãããã¯ã
JavaScript MVCåé¡ïŒèåŸ
ãŸãã¯éçºïŒ ïŒEngãïŒ ãJSã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããããã®ããŒã«ã®éžæè¢ãå€ããããšããçåãæèµ·ããŸããã åé¡ã®äžéšã¯ãããŸããŸãªJavaScriptéçºè
ãã¹ã±ãŒã©ãã«ãªã¢ããªã±ãŒã·ã§ã³ïŒMVCãMVPãMVVMïŒãç·šæããæ¹æ³ã«èµ·å ããŠããŸããïŒ ãããšãäœãïŒ æ¯é±ãèšå€§ãªéã®æ°ããMV *ãã¬ãŒã ã¯ãŒã¯ãçãŸããŠããŸãããªããªãããæ£ããæ¹æ³ããååšããå Žåããããç§ãã¡å
šå¡ãæ¢ããŠããããã§ãã å€ãã®éçºè
ã¯ããã§ã¯ãªããšèããŠããŸãã
ãYet Another Framework SyndromeãïŒãŸãã¯YAFSïŒãšããŠããç»å Žããæ°ãããã¬ãŒã ã¯ãŒã¯ãéžæããŸãã é©æ°ãšããŠãäœãã確ãã«æè¿ãããŸãããYAFSã¯éçºè
ãã¢ããªã±ãŒã·ã§ã³ã®äœæãéå§ãããšãã«å€§ããªæ··ä¹±ãšãã©ã¹ãã¬ãŒã·ã§ã³ã«ã€ãªããå¯èœæ§ãããã30ã®ããŒã«ãæåã§è©äŸ¡ããŠããŸãäžé©åã§ãªããã®ãéžæããå¿
èŠããããŸãã äžéšã®ãã¬ãŒã ã¯ãŒã¯ã®éãã¯ãåºå¥ããã®ãé£ãããªãã«ããŠããéåžžã«åŸ®åŠã§ãã
â TodoMVCïŒåŠç¿ãšæ¯èŒã®ããã®äžè¬çãªã¢ããª
ïŒ4æã«ãã·ã¢èªã§ã¡ã¢ããããŸããïŒ habrahabr.ru/post/142301 ïŒéå»æ°å¹Žéã§ããã®ãããªMV *ãã¬ãŒã ã¯ãŒã¯ã®æ°ã«å€§ããªããŒã ãèŠãããŸãã
Backbone.js ã Ember.js ã AngularJS ã Spine ã CanJS ...æ°ããæå¹ãªãœãªã¥ãŒã·ã§ã³ã®ãªã¹ãã¯æ¯é±å¢ãç¶ããŠããŸãã éçºè
ã¯ãªãã·ã§ã³ã®æµ·ã§ããã«è¿·åã«ãªããŸãã 圌ãã¯ããããã®éžæè¢ããããŸãã ã©ã€ãã©ãªã«åœ±é¿ãäžããè€éãªã¢ããªã±ãŒã·ã§ã³ïŒ
Yehuda Katzã
Jeremy Ashkenasãªã© ïŒã«åãçµãã§ããå¿ããå€ãã®åŒ·åãªç«¶åãœãªã¥ãŒã·ã§ã³ããããŸãã 質åïŒäœ¿çšãããã®ãšéžææ¹æ³
ãã®ç¶æ³ãèªèããéçºè
ãéžæããã»ã¹ãã§ããéãç°¡çŽ åã§ããããã«ããããšèããŸããã
TodoMVCã¯ãçŸåšäººæ°ã®ããããŸããŸãªMV *ãã¬ãŒã ã¯ãŒã¯ã«åãTodoã¢ããªã±ãŒã·ã§ã³ãå®è£
ãããããžã§ã¯ãã§ãã ãã¬ãŒã ã¯ãŒã¯ã®ããŒã¿ãæäœããããã®é床èšãšèããŠãã ããã å®è£
ã¯åãããã«æ©èœããæ©èœããç°ãªããã¬ãŒã ã¯ãŒã¯ã®æ§æãšæ§é ãæ¯èŒããã®ã«åœ¹ç«ã¡ãŸãã ãã®ããã«ããŠãæãå¿«é©ã«æãããã®ãéžæããããšãã§ããŸããå°ãªããšããæ¯èŒããããšã§éžæç¯å²ãçããããšãã§ããŸãã
ä»é±
ïŒ2012幎7æ14æ¥ïŒ TodoMVCã®å®å
šã«æ°ããããŒãžã§ã³ããªãªãŒã¹ããŸãã詳现ã«ã€ããŠã¯ãã¢ããªã±ãŒã·ã§ã³ã»ã¯ã·ã§ã³ã§èª¬æããŸãã
è¿ãå°æ¥ããã®ãã¬ãŒã ã¯ãŒã¯ã®äœ¿çšãæ€èšããå¿
èŠãããã¢ããªã±ãŒã·ã§ã³ã®çš®é¡ã«é¢ããçžéç¹ãšæšå¥šäºé
ã«ã€ããŠã®ã¡ã¢ãæäŸããããšã«ãããäœæ¥ãããã«çºå±ãããããšèããŠããŸãã
â ãã¬ãŒã ã¯ãŒã¯ãéžæããããã®ææ¡ãããåºæº
ãã¬ãŒã ã¯ãŒã¯ãéžæããããšã¯ãToDoã¢ããªã±ãŒã·ã§ã³ã®åäœãåçŽã«æ¯èŒããã ãã§ã¯ãããŸããã ãããã£ãŠãéžæããåè£ãè€æ°ããå Žåã¯ãä»äºããå°ãé¢ããŠèŠåãããšããå§ãããŸãã ããããããã¬ãŒã ã¯ãŒã¯ã¯éèŠãªæ©èœããµããŒãããå¿
èŠããããé·å¹ŽãµããŒãããå¿
èŠãããããšãå€æããå¯èœæ§ããããŸãã 質åã«çããŠã¿ãŠãã ããã
ãã¬ãŒã ã¯ãŒã¯ã¯æ¬åœã«äœãã§ããã®ã§ããïŒãã¬ãŒã ã¯ãŒã¯ã®ãœãŒã¹ã³ãŒããšæ©èœã®å
¬åŒãªã¹ããèªãã§ãèŠä»¶ãã©ã®ããã«æºãããŠãããã確èªããŠãã ããã ãœãŒã¹ã³ãŒãã®å€æŽãè¿œå ãå¿
èŠãªãããžã§ã¯ãããããŸããèªåã§å®è¡ã§ãããšèããå Žåãã³ãŒãã¯ãã¹ãã«åæ ŒããŠããŸãã
ãã¬ãŒã ã¯ãŒã¯ã¯åäœç¢ºèªæžã¿ã§ããïŒãã®ã©ã€ãã©ãªã䜿çšããŠã倧èŠæš¡ãªå
¬éã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããã³å®è£
ããéçºè
ã¯ããŸããïŒ
Backboneã«ã¯ãã®ãããªæ·±å»ãªãªã¹ãïŒSoundCloudãLinkedInïŒããããŸããããã¹ãŠãæã£ãŠããããã§ã¯ãããŸããã
Emberã¯ãSquareã®ãŠãŒã¶ãŒããŒã«ãå«ãå€ãã®å€§èŠæš¡ãªã¢ããªã±ãŒã·ã§ã³ã§åäœããŸãã
JavaScriptMVC㯠IBMã®å€§èŠæš¡ãªã¢ããªã±ãŒã·ã§ã³ã§äœ¿çšãããä»ã®å Žæã¯èæ
®ããŠããŸããã ãã¬ãŒã ã¯ãŒã¯ãæ©èœããããšãç¥ãã ãã§ãªããå®éã®ã³ãŒããèŠãŠãã©ã®ããã«æ§ç¯ã§ããããç解ããããšãéèŠã§ãã
ãã¬ãŒã ã¯ãŒã¯ã¯å®å
šã§ããïŒéçºè
ã¯ããéžãã§ä»äºãããã以äžã®ããšãè¡ãããšããå§ãããŸãã å€ãã®å Žåãæ°ãããããžã§ã¯ãã«ã¯ãªãªãŒã¹ã«é¢ããå€ãã®è°è«ã䌎ããŸãããããã«ã€ããŠã¯å¿ããã«ãæ¬çªã¬ãã«ã®ã¢ããªã±ãŒã·ã§ã³ã®ãªãªãŒã¹ãéžæããŠãã ããã ç·æ¥ã®ãªãã¡ã¯ã¿ãªã³ã°ãŸãã¯ãã®ä»ã®æ
éã«ãããããžã§ã¯ãã§åæ¢ãããªã¹ã¯ã¯ãããŸããããã¬ãŒã ã¯ãŒã¯ãããŸãæ©èœããããã°ãããŠããå Žåã¯ãããäºæž¬ãããããªããŸãã æçãããããžã§ã¯ãã¯éåžžãæ£åŒã«ããŸãã¯ã³ãã¥ããã£ãéããŠææžåãããŸãã
ãã¬ãŒã ã¯ãŒã¯ã¯æè»ã§ãããã管çãå°é£ã§ããïŒããŸããŸãªããã£ã©ã¯ã¿ãŒãã®ã©ã€ãã©ãªãããããšãç¥ã£ãŠãã ããã å³å¯ã«ç®¡çããããã¬ãŒã ã¯ãŒã¯ã§ã¯ãç¹å®ã®ãã¬ãŒã ã¯ãŒã¯å
ã§ããã°ã©ãã³ã°ããå¿
èŠããããŸãã ãããã¯ã¢ããªã±ãŒã·ã§ã³ã®èšèšãå¶éãããããã©ã®ããã«æ©èœããããç¬èªã«ææ¡ããéçºè
ã«ããŸã泚æãæããŸããã
ãã¬ãŒã ã¯ãŒã¯ã§å®éã«ãéãã ãããšããããŸããïŒãã¬ãŒã ã¯ãŒã¯ã䜿çšããã«å°ããªã¢ããªã±ãŒã·ã§ã³ãäœæãããã¬ãŒã ã¯ãŒã¯ã§åäœããããã«ã³ãŒããäœãçŽããŠãç°¡åã«åäœãããã©ãããè©äŸ¡ããŠãã ããã ã³ãŒããæ±ãããšã¯ããªãã®æ±ºå®ã«åœ±é¿ãäžããã®ã§ããã¶ã€ã³ã䜿ã£ãŠå¿«é©ã«äœæ¥ã§ããããã«ãåãã³ãŒããæžãããšãéèŠã§ãã
å®å
šãªããã¥ã¡ã³ãã¯ãããŸããïŒãã¢ã¢ããªã±ãŒã·ã§ã³ã¯ãªã³ã¯ãšè¡šç€ºã«åœ¹ç«ã¡ãŸãããã»ãšãã©ã®å Žåããã¬ãŒã ã¯ãŒã¯ã®å
¬åŒéçºè
ãšããåãããAPIãµããŒããäžè¬çãªåé¡ã®è§£æ±ºæ¹æ³ãã³ã³ããŒãã³ãã®äœææ¹æ³ã泚ç®ããããã°ã«ã€ããŠåŠç¿ããŸãã 䟡å€ã®ãããã¬ãŒã ã¯ãŒã¯ã«ã¯ãéçºè
ãç解ããã®ã«åœ¹ç«ã€è©³çŽ°ãªããã¥ã¡ã³ããå¿
èŠã§ãã ããããªããã°ãéçºããŒã ãšã®IRCãã£ã³ãã«ãèŠã€ããããç¬ç«ããç 究ãè¡ãããšãã§ããŸããããèªäœã¯çŽ æŽãããã§ãããå€ãã®å Žåãäºåã«æäŸãããããã¥ã¡ã³ãã®ã»ããã«æ¯ã¹ãŠæéãããããŸãã
ãã¬ãŒã ã¯ãŒã¯ã®ç¯å²ãçž®å°ãå§çž®ãã¢ãžã¥ãŒã«åã®æ©èœã¯äœã§ããïŒãã¬ãŒã ã¯ãŒã¯ã«ã¯ã©ã®ãããªäŸåé¢ä¿ããããŸããïŒãã¬ãŒã ã¯ãŒã¯ã®å Žåããã¡ã€ã«ã®ãµã€ãºã瀺ãåŸåããããŸãããäŸåã©ã€ãã©ãªã®ãµã€ãºã¯èšããŸã§ããããŸããã ããšãã°ã
jQueryãŸãã¯ä»ã®ã©ã€ãã©ãªã«äŸåããŠããå Žåãå°ããªã©ã€ãã©ãªã¯äºæ³å€ã«å€§ãããªããŸãã
ãã¬ãŒã ã¯ãŒã¯ã®éçºè
ã®ã³ââãã¥ããã£ã«ç²ŸéããŠããŸããïŒåé¡ãçºçããå Žåã«æ¯æŽã§ãããããžã§ã¯ãåå è
ãšãŠãŒã¶ãŒã®æŽ»çºãªã³ãã¥ããã£ã¯ãããŸããïŒ ååãªéçºè
ããã¬ãŒã ã¯ãŒã¯ã䜿çšããŸããããã¢ããªã±ãŒã·ã§ã³ããã¥ãŒããªã¢ã«ãããã³å Žåã«ãã£ãŠã¯ã¹ã¯ãªãŒã³ãã£ã¹ããå®è¡ããããã®ãªã³ã¯ããããŸããïŒ
â DojoãšJavaScriptãã¬ãŒã ã¯ãŒã¯ã®è€éã
å€ãã®äººãç¥ã£ãŠããããã«ã
Dojo Toolkitã¯ãéçºè
ã«è€éãªã¢ããªã±ãŒã·ã§ã³ãéçºããããã®ããŒã«ãæäŸããæåã®è©Šã¿ã®1ã€ã§ããã çããã¢ããªã±ãŒã·ã§ã³ã®ã¿ã¹ã¯ã«ã€ããŠãã£ãšèããããã«ãªã£ããšèšã人ããããããããŸããã
Dojoã®éçºè
ã§ãã
Dylan Schiemannæ° ãKitson Kellyæ°ãããã³James Thomasæ°ã«[æçŽã§]質åããŸãããMV*ãã¬ãŒã ã¯ãŒã¯ã®åºçŸã«ã€ããŠåœŒãã¯ã©ãæããŸããã
Q ïŒ
Dojoã©ã€ãã©ãªã§ããããã¹ãŠè§£æ±ºã§ããŸããïŒ ããæ§é åãããéèŠãªã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããã人ã«ãšã£ãŠããªãããã奜ãŸãããœãªã¥ãŒã·ã§ã³ã«ãªããªãã£ãã®ã§ããïŒ
OãïŒæ°å¹ŽåãJavaScriptç°å¢ãåçŽãªAjaxãšå¹æãããŒãžã«è¿œå ããããšããé²åãããšãã
Dojoã¯Webäžã§è€éãªã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããããã®ãããŒã«ãã¢ãããŒããæå±ããŸããã
ãããã®æ©èœã®å€ãã¯ãã»ãšãã©ã®éçºè
ã®ããŒãºãã¯ããã«äžåã£ãŠããŸããã äž»èŠãªã¢ããªã±ãŒã·ã§ã³ãã©ãããã©ãŒã ãšããŠã®ãã©ãŠã¶ãŒã®åºçŸã«ãããå€ãã®é©æ°ã
Dojo Toolkitã«å°å
¥ãããçŸåšã§ã¯æ°ããããŒã«ã«ç»å ŽããŠããŸãã MVCã¯ã
Dojoãä»ã®ã³ãŒãã¢ãžã¥ãŒã«ãšå
±ã«ããªãé·ãéæäŸããŠããå¥ã®ããã±ãŒãžã§ããïŒJSã®OOPãUIãŠã£ãžã§ãããã¯ãã¹ãã©ãŠã¶ã°ã©ãã£ãã¯ã¹ããã³ãã¬ãŒããåœéåãããŒã¿ã¢ã¯ã»ã¹ãããŒã¿ãŠã§ã¢ããŠã¹ããã¹ããã¬ãŒã ã¯ãŒã¯ãã·ã¹ãã ãã«ããªã©ã
Javascriptã©ã€ãã©ãªãŒã¯ã
Dojoãåæ段éãããšã³ã¿ãŒãã©ã€ãºã¬ãã«ã®ã¢ããªã±ãŒã·ã§ã³éçºã®å
šãµã€ã¯ã«ã«åªåãéäžããçç±ãã䞻匵ããã¹ãã§ã¯ãããŸããã MVCã®çŠç¹ã¯åãã«ãªããŸããã1ã€ã®ãã»ããããã®ããŒã«ãã«ãããŸããã
Dojoãæ¯é
çãªããŒã«ããã¯ã¹ã§ã¯ãªãã®ã¯ãªãã§ããïŒ åœŒå¥³ã®ç®æšã¯æ±ºããŠå¯äžã®éžæè¢ã§ã¯ãªãã£ãã ç®æšã¯ããããžã§ã¯ãå
ã®ä»ã®äœããšé£æºããä»ã®ãããžã§ã¯ããžã®ç§»æ€æ§ãåããããŒã«ã®ãªãŒãã³ã»ãããæäŸããããšã§ããã
éå Žã¯é
ããšæ¹å€ããããããæçšããåŸã§ãã圌女ã¯é
ããšæ¹å€ãããŸããã ã·ã§ãŒãã«ãããåãé€ãããšã¯å°é£ãªäœæ¥ã§ãã è±å¯ãªããŒã«ã»ããã®æ©èœãææžåããããšã¯å°é£ã§ãã Dojo 1.8ã«ã¯175åã®ãµãããã±ãŒãžãš1,400ãè¶
ããã¢ãžã¥ãŒã«ããããŸãã
ããã¯ãææžåã®ç®æšãéæãããšããåé¡ã ãã§ãªãã
Dojoãè€æ°ã®ã¿ã¹ã¯ãå®è¡ããããšãæå³ããŸãã ããã°ã©ã ãäœæããã®ã¯è¯ãããšã§ãããæåã«ã©ãããå§ããã°ããããå€æããã®ã¯éåžžã«å°é£ã§ãã æ¹åãããããã¥ã¡ã³ããšãã¥ãŒããªã¢ã«ã¯ã
Dojo 1.8ãæ¯æŽããããšããŸãã
Q ïŒéçºè
ã
Dojoãéžæããçç±ãšãå°æ¥ã®ãããžã§ã¯ãã®ããã«ã©ã®ãããªã¢ã€ãã¢ã®ãªã¹ããæã£ãŠããã®ã§ããïŒ 1.8ã®åŸãå¥ã®ç®æšããããšèšãããŠããŸãã
OãïŒDojo 1.8ã§ã¯ã
dojox / mvcããã±ãŒãžãæçã«åããŠããã«äžæ©èžã¿åºããŸããã ããã±ãŒãžã«ã¯å€ãã®æéãåŽåããã¹ããã³ãã¥ããã£ã®æ³šæãæãããŸããã 圌ã¯ã
Dojoã®æ®ãã®éšåã掻çšããMVCã¢ãã«ã®æäŸãå°éãšããŠããŸãã ããã¯ããã¹ã¯ãããããã³ã¢ãã€ã«ããã€ã¹çšã®ãªããã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããããã®
dojox / appã¢ããªã±ãŒã·ã§ã³ããã±ãŒãžãšäžç·ã«ãã¯ã©ã€ã¢ã³ãåŽã®çµ±åã·ã¹ãã ãäœæããŸãã
ãããŠããã¯ãå
žåçãª
Dojoã¢ãããŒãã§ã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããå®è¡å¯èœãªæ¹æ³ã®1ã€ã«ãããŸããã
1.8ã§ã¯ãMVCãµãã¢ãžã¥ãŒã«ãããæçããã ãã§ãªããå
ç¢ãªãã¬ãŒã ã¯ãŒã¯ã«åºã¥ããŠããŸãã Viewã³ã³ããŒãã³ãã®äœæãã¢ãã«ã®è¡šçŸããŸãã¯ã³ã³ãããŒã©ãŒã®èšèšã«ããŒã¯ã¢ããèšèªãæäŸããã ãã§ã¯ãããŸããã ããã¯ãå¥ã®ã¢ãžã¥ãŒã«ãããŒã¿ãœãŒã¹ã«æ¥ç¶ããã ãã§ã¯ãããŸããã ããã¯
Dojoã®æ®ãã®éšåã«æ¥ç¶ãããŠãããããå¿
èŠãªãã®ã¯ãã¹ãŠæ¥ç¶ã§ããŸãã
Dojo 2.0ã§ã¯ãã¢ãžã¥ãŒã«åãæ°ããªã¬ãã«ã«åŒãäžããäžæ¹ãšä»æ¹ãåããŸãšããŠãã¹ãŠãããç°¡åã«ããããšãè©Šã¿ãŸãã ãŸããã¯ã©ã€ã¢ã³ããŸãã¯ãµãŒããŒã§ã³ãŒããå®è¡ãããå ŽæããŠãŒã¶ãŒã«ãšã£ãŠåé¡ã«ãªããªãããã«ãååã®æŠå¿µã調æ»ããŸããæçµçã«ãããã¯éçºè
ã«ééçã§ãªããã°ãªããŸããã
â TodoMVCã³ã¬ã¯ã·ã§ã³
åŒç€Ÿã®ææ°ãªãªãŒã¹ã«ã¯ãæã人æ°ã®ãããã¬ãŒã ã¯ãŒã¯ã®Todoå®è£
ãå«ãŸããŠãããä»ã®å€ãã®é©åºŠã«äœ¿çšãããŠãããã¬ãŒã ã¯ãŒã¯ãLabsã§å®è¡ãããŠããŸãã ãããã®å®è£
ã«ã¯å€ãã®æ¹èšãè¡ãããå€ãã®å Žåããã¬ãŒã ã¯ãŒã¯ã®äœæè
ãéçºãžã®åå è
ãã³ãã¥ããã£ã®ãŠãŒã¶ãŒããã®ãã¹ããã©ã¯ãã£ã¹ãææ¡ãããã³ããåãå
¥ããŸããã
Backbone.js Jeremey AshkenasãšYehuda Katzã®èè
ã«ããã³ã¡ã³ãã«ç¶ããŠã
TodoMVCã¯çŸåšãããã²ãŒã·ã§ã³ïŒãŸãã¯ç¶æ
管çïŒãªã©ãã¢ããªã±ãŒã·ã§ã³ã®å
¬åŒä»æ§ã§è¡ãããé¢é£å®è£
ãæäŸããŠããŸãã ïŒïŒïŒ
æ¯èŒã®ããã®ããè€éãªã¢ããªã±ãŒã·ã§ã³ãäžå¯èœïŒãã¡ããå¯èœïŒã§ãããµãã¯ããŸããããTodoã¢ããªã±ãŒã·ã§ã³ã®ã·ã³ãã«ãã«ãããéçºè
ã¯ã³ãŒãæ§é ãã³ã³ããŒãã³ãã®æ§æãããã³ãã¬ãŒã ã¯ãŒã¯ã®æ¯èŒããã®ãœãªã¥ãŒã·ã§ã³ã®è©³çŽ°ã確èªããã®ã«ååãªããããŒã»ã³ã¹ããèªèã§ããŸã決å®ã
åœç€Ÿã®ã¢ããªã±ãŒã·ã§ã³ã¯æ¬¡ã®ãšããã§ãã
AMDããŒãžã§ã³ã«èå³ã®ããæ¹ãžïŒ
ç§ãã¡ã®ã©ãã«ã¯ä»¥äžãå«ãŸããŸãïŒ
åè Todoã¢ããªã±ãŒã·ã§ã³ã®1ã€ã®ããŒãžã§ã³ãçŽç²ãªJavaScriptã§äœæããå¥ã®ããŒãžã§ã³ã§ã¯ããŸãjQueryã¢ãããŒãã䜿çšããŸãã ã ã芧ã®ãšããããããã®ã¢ããªã±ãŒã·ã§ã³ã¯MVCãã¬ãŒã ã¯ãŒã¯ã§èšè¿°ããããã®ãšæ©èœçã«åçã§ãããã¿ã¹ã¯ã®åé¢ã¯ãªããããªã¥ãŒã ã倧ãããªãã«ã€ããŠã³ãŒãã®èªã¿åããšä¿å®ãé£ãããªããŸãã |
æšå¹Žããã¬ãŒã ã¯ãŒã¯ã®äœæè
ã®äžéšãããœãªã¥ãŒã·ã§ã³ãæ¹åããæ¹æ³ã«ã€ããŠã®è°è«ã«åå ããŠãããããšãå
æ ã«æããŸãã ããã«ãTodoMVCã«ãã£ãããšç§»è¡ããŸãããããã¯ã»ãšãã©äºå®äžã®ã¢ããªã±ãŒã·ã§ã³ã§ããã æ°ãããã¬ãŒã ã¯ãŒã¯ãè¿œå ããããããåææ¯èŒãç°¡åã«ãªããŸããã
ïŒããã§æãé¢çœãå Žæã§åæ¢ããå¿
èŠããããŸã-ããã¹ãã®ãµã€ãºã倧ãããªããŸã-蚱容ãããã¹ããŒããåæ¢ããŸããäŒæ©ã®çŽåŸã«ãç§ãã¡ã®æéã®æãäºæ³ããã質åãå°ããããŸãããšãã£ãŒã»ãªã¹ããèªèº«ã®ã¬ã·ãã«ããã䜿çš...ïŒããšããé©ç°çãªãœãŒã¹ïŒïŒ ããã«ãæåŸã®éšåã§ã¯ïŒâ ã©ã®ãã¬ãŒã ã¯ãŒã¯ããã€äœ¿çšããå¿
èŠããããŸããïŒ
â éçºè
ã¯ãæã人æ°ã®ãããã¬ãŒã ã¯ãŒã¯ã«ã€ããŠã©ãæããŸããïŒ ïŒé·æãšçæïŒ
â å®éšããããšãæããªãã§ãã ãã
â MVãè¶
ãã*
â çµè«ã
åæ§ã®ã¬ãã¥ãŒïŒ
Rich JavaScript Applications-the Seven FrameworksïŒThrone of JSã2012ïŒ ãSteven Sandersonã2012幎8æ1æ¥ãBackboneãMeteorãEmberãAngularJSãKnockoutãSpineãBatmanãCanJSã¢ãããŒãã®éããšäžèŽ-ThroneäŒè°ã®çµæã«åºã¥ãJSã2012幎ãã
ïŒç¶ãïŒ 2çªç®ã®æåŸã®éšå ïŒ