iOSãªã¼ã«ã¹ã¿ã¼ãº2 https://eventdots.jp/event/602872
以ä¸ã®æç« ã¯ãMartin Fowler ã®ãInversion of Control Containers and the Dependency Injection patternããããããã«ã翻訳ãããã®ã§ããåèè ã®è¨±å¯ãå¾ã¦ç¿»è¨³ã»å ¬éãã¦ãã¾ãã 翻訳ã«ããã£ã¦ã¯ãkdmsnr ããã«ãååãããã ãã¾ããããããã¨ããããã¾ããå ¬éå¾ã®æ¹è¨å±¥æ´ãè¨äºã®æå¾ã«è¨è¿°ãã¦ãã¾ãã Java ã³ãã¥ããã£ã§ã¯è»½éã³ã³ãããè±çãã§ããã 軽éã³ã³ããã¯ãç°ãªãããã¸ã§ã¯ãã®ã³ã³ãã¼ãã³ããã²ã¨ã¾ã¨ã¾ãã®ã¢ããªã±ã¼ã·ã§ã³ã¨ãã¦çµã¿ç«ã¦ããã¨ãæ¯æ´ããã ãã®ãããªã³ã³ããã®æ ¹åºã«ã¯ãã³ã³ãã¼ãã³ãã®çµã³ä»ãæ¹ã«ã¤ãã¦ã®å ±éãããã¿ã¼ã³ãããã ãã®ãã¿ã¼ã³ã®ã³ã³ã»ããã¯ãInversion of Control(å¶å¾¡ã®å転)ãã¨ãã¾ãã¨ã«å æ¬çãªååã§å¼ã°ãã¦ããã æ¬è¨äºã§ã¯ããã®ãã¿
å人ããããããºããã DI ã«ã¤ãã¦æ¸ãã¦ã»ãããã¿ãããªè©±ãã ãã¶åããããã¦ããã ãã©æ¸ãæ°åãã£ã¨ãªãã£ããã§ãä»äºã®æ°å転æã«ã¡ãã£ã¨ãã¤æ¸ãããã¤ãããéã¾ã¨ã¾ã£ãã®ã§å ¬éããã§ãããããããã¨ã¯æ¸ãã¦ãªãã£ã¦ãããç¥ã£ã¦ãã²ã¨ã«ã¯ãããã¾ãã®ãã¨ããæ¸ãã¦ãªãããµã³ãã«ã³ã¼ãã¯ãããã®è¶£å³ã§ Scala ã§æ¸ãã¦ããããJava ãèªããã°ãªãã¨ãªãèªããã¨æãã¾ãã DI ã£ã¦ãªã« Dependency Injectionãæ¥æ¬èªã§è¨ãã°ä¾åæ§ã®æ³¨å ¥ã§ããããã¾ãã ã§è¨äºãçµãã¦ããããã ãã©ãããããä¾åæ§ã¨ã¯ãªããªã®ãããããæ³¨å ¥ããã¨ã¯ã©ããããã¨ãªã®ãããªã DI ãå¿ è¦ã¨ãªãã®ãã¿ãããªè©±ããããããã¾ãã ããããä¾åæ§ã£ã¦ãªãã« ä¾ãåºãã¾ããå ¥åãããæååããã¨ã«ãã¿ãããã²ãã¦ããã®çµæã twitter ã«æ稿ããããã°ã©ã ã«ãã¾ãããã ã¾ãã¯æ®é
Springã¢ããã¼ã·ã§ã³ãJavaã¨ä¸¦ã¹ã¦ã¾ã¨ã ã¯ã©ã¹å¯¾è±¡ã®ã¢ããã¼ã·ã§ã³ Springã¢ããã¼ã·ã§ã³ @Component SpringDIã³ã³ããã«beanã¨ãã¦ç»é²ãããã¯ã©ã¹ã¸ä»ä¸ãã beanå®ç¾©ãã¡ã¤ã«ï¼.xmlï¼ã®ã¿ã°ã¨åãåã beanåãã¤ãããã¨ãã¯ä¸è¨ã®ããã«ãã @Component("name") ãã®ã¢ããã¼ã·ã§ã³ã使ãã¨ãã¯beanå®ç¾©ãã¡ã¤ã«ã«ãããè¨è¿°ãã¦ããã㨠@Service @Componentã¨åºæ¬çã«ã¯åãåããããããService層ï¼ãã¸ãã¹ãã¸ãã¯çï¼ã対象ã¨ãã¦ãã Service層ã¨ãã®ä»ã®beanã®éããæ確ã«ããããã«ä½¿ç¨ãã ãã®ã¢ããã¼ã·ã§ã³ã使ãã¨ãã¯beanå®ç¾©ãã¡ã¤ã«ã«ãããè¨è¿°ãã¦ããã㨠@Repository @Componentã¨åºæ¬çã«ã¯åãåããããããPersistence層ï¼DAOçã®DBã¢ã¯ã»ã¹ãè¡
DIã³ã³ããã¯ï¼ãDIï¼Dependency Injectionï¼ä¾åæ§ã®æ³¨å ¥ï¼ãã¨å¼ã¶ãã¶ã¤ã³ãã¿ã¼ã³ã«åºã¥ãã¦ä½ãããã³ã³ãã¼ãã³ã群ãéä¸ç®¡çããããã®ã½ããã¦ã¨ã¢ã§ãã DIã¯ï¼ã³ã³ãã¼ãã³ãï¼ã¯ã©ã¹ï¼éã®ä¾åé¢ä¿ãã½ã¼ã¹ã³ã¼ãããåãé¤ããã¨ã§ï¼ããã°ã©ã ã®å®è¡æã¾ã§ã³ã³ãã¼ãã³ãå士ãä¾åé¢ä¿ãæããªãããã«ãããã¶ã¤ã³ãã¿ã¼ã³ã§ãã ä¾ãã°ï¼ããã¯ã©ã¹Aã®ä¸ã§å¥ã®ã¯ã©ã¹Bã®ã¤ã³ã¹ã¿ã³ã¹ãçæãã¦å©ç¨ãã¦ããã¨ãï¼Aã¯Bã«å¼·ãä¾åãã¦ãã¾ã£ã¦ãã¾ããã¤ã¾ãï¼Bãå¥ã®ã¯ã©ã¹ã«å·®ãæ¿ããã¨ããªã©ã«ã¯Aãå¤æ´ããªããã°ãªãã¾ããããã®ãããªä¾åé¢ä¿ã¯ï¼Aã¨Bãå¥ã®äººãä½ã£ã¦ããå ´åãªã©ã«ç¹ã«å°ãã¾ãã ããããä¾åæ§ãã¯ã©ã¹ããåãé¤ãã®ãDIãã¿ã¼ã³ã§ããBã¸ã®ä¾åæ§ãAããæé¤ããã«ã¯ï¼ã¾ãBã®æ©è½ãæ½è±¡åããã¤ã³ã¿ãã§ã¼ã¹Iãå®ç¾©ãï¼Iãå®è£ ããã¯ã©ã¹ã¨ãã¦Bãä½ãã¾ãã Bã®
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}