Fluxã使ãå§ããã¨ããã£ãMVï¼ã«æ¯ã¹ã¦é ãæªãã¦ãç¶æ ãå£ããªããï¼ãã¨ããææ³ã«ãªã人ãå¤ãã¨æããã ãã©ããã®çç±ããµãã¤ãããããªæ°ããã¦ããã
ModelãViewModelã«ã¤ãã¦ã¯ã³ã³ããã¹ããéã人ãããããéããªãï¼ãã¨è¨ãããããªæ¸ãæ¹ã«ãªãããã ãã©ãæãã¤ããæ¸ããªãã£ã¦ãã ããªã®ã§åå¼ãã¦ãã ããã
1. åæ¹åãã¼ã¿ããã¼ãåããããããã³ã¼ãã®è¤éãã®ä½ä¸ã«å¯ä¸ãã¦ãã
ããã¯å ¨ããã¸ãã£ããªè¦å ã
2. Fluxã¯MVï¼ã®Modelç¸å½ã®è¦ç´ ãå³ã«å«ã¾ãã¦ããªãã®ã§èãããã¨ãæ¸ã£ã
MVï¼ã¯ãModelã£ã¦æ¸ãã¦ããããã«ã¯ä½ããModelã¨å¼ãã§ãã¼ã¿ãçªã£è¾¼ã¾ãªãããããªããã¨ããæèãçã¾ããããã£ãï¼ãã®è²¬ååå²ãé©åã ã£ããã¯å¥ã¨ãã¦ï¼ã¨æãã
ã§ããFluxã«ã¯Storeã¨ãããViewModel*1ã¿ãããªãã®ãããªã*2ã¨ç§ã¯æã£ã¦ãã¦ãMVï¼ã§Modelã¨å¼ã°ãã¦ãããã®ãå®ç¾©ããããã¨ããæå³ã¯æãããã¾ããã
çµæçã«ãModelã«ã¤ãã¦æ¸ãã¦ãªãã®ã§èãããã£ããããªããªã£ã¦ãå¿ è¦ãªè³å ã¡ã¢ãªã®éãæ¸ã£ãçµæããé ãæªãã¦ãããã¨ããææ³ã«ãªãã®ã§ã¯ã¨æãã¾ããã
æè
æèã¨ãã¦ã¯ãã®è¾ºã®è©±ããæ¥ã¦ãã¾ãã
ReduxãFluxã®ä¸ã«ã¢ã¼ããã¯ãã£ãæ§ç¯ããããããªããèªåãä¿¡ããã¢ã¼ããã¯ãã£ã®ä¸ã«ReduxãFluxãé ç½®ãããã ã
— ãªããã (@Nkzn) May 15, 2018
Fluxã¯æè©®MVWã¨åãã¬ãã«ã§ç¶æ 管çã®è²¬åã®ä¾åé¢ä¿ãå¦çã®é çªãå®ç¾©ãã¦ããã ãã ãããFluxãã¼ã¹ã ã¨ãã£ã±ãModelç¸å½ã®å ´æã®è¨è¨ã¯ãµãã¼ãããã¦ãªããã ãã¨æã£ã¦ããMiddlewareã¯MWéã®éä¿¡æ¹æ³ã工夫ãã¦ãã ããªã®ã§ãã£ã±ãéããMVWã®åé¡ã«ã¤ãã¦ã¯ããâhttps://t.co/NVpXyEYPhY
— ãªããã (@Nkzn) 2018å¹´5æ15æ¥
ç´°ãããã¨ãè¨ãã¨åã¯Fluxã¯MVVMã ã¨æã£ã¦ãã¦ãFluxã®Storeã¯VMã®ç¶æ ã§ãReduxã®Middlewareã¯MâVMéã®éä¿¡ããã«ãã£ã¨ããããã®ãã®ã¨ããèªèã§ãããã ãããªããããMã«ã¤ãã¦ä½ããã¦ããªãã¨ããæèãå¼·ãã
— ãªããã (@Nkzn) 2018å¹´5æ15æ¥
åæ¹åãã¼ã¿ããã¼æ¹é¢ã«è¡ããã¬ã³ãã¯ããå´©ããªãããã ãããããã©
— ãªããã (@Nkzn) 2018å¹´5æ15æ¥
ãã¬ã¼ã³ãã¼ã·ã§ã³å±¤ã®ã¢ã¼ããã¯ãã£ã§ããããFluxã
— Keita Kagurazaka (@kkagurazaka) 2018å¹´5æ15æ¥
ã¢ãã«å´ã¯ããã¾ã§æ£ã è°è«ããã¦ããè¨è¨ãå©ç¨ã§ãã¾ããã
ã¾ã¨ã
MVï¼ã¨ããåªããFluxã¨ããåªãã«ç§»ãæ¿ããã¨ãã«ãFluxã®åæ¹åãã¼ã¿ããã¼ã¨ãã価å¤ã«MVï¼ãé£ãåããªãã¦ãç価交æã§Modelãæã£ã¦ãããããã¨ããåã¹ãã¼ãªã¼ãã©ããã®ã«ã³ãã¡ã¬ã³ã¹ã§åããã
— ãªããã (@Nkzn) 2018å¹´5æ15æ¥
MVï¼ã¯Modelå ã®è¨è¨ã«ã¤ãã¦å®ç¾©ãã¦ãã¾ããã§ããããFluxã¯Modelã®åå¨èªä½ãç§ãã¡ã«æ¼ãä»ãã¦ããªãåãªã®ã§ã¯ãã¨æãå§ãã¾ãããModelç¸å½ã®ãã®ããªãã¦ããããããªãã®ã§ãããåæ¹åãã¼ã¿ããã¼ãå¼·åããã¦ãModelç¸å½ã®é¨åããããµãã§ããã¿ããªä½ã¨ããªã£ã¡ãã£ã¦ãããããªãããªã»ã»ã»*3
Modelç¸å½ã®é¨åãè¨è¨ããFluxãæ¥åã§è²ã ã¨è©¦ãã¦ã¿ã¦ããã®ã§ãã©ããã®ã¿ã¤ãã³ã°ã§å¸æãã¦ããããã§ãã
è£è¶³ãããã ãã¾ãã
ãã®è¨äºã®æ¬è³ªãè¨èªåãç´ãã¦ããã¾ããã
ãããStoreã¨VMã®è©±ã¯ä½è¨ã ã£ããªã¨ããæ°æã¡ã¯ããã¾ãã
ãã¾ã
DroidKaigi 2018ã§ããã¯ãããç´¹ä»ãã¦ããModel-View-Intentã¯éå®çãªããModelç¸å½ã®é¨åï¼Repositoryã¨ãï¼ã«ãè¨åãã¦ããåæ¹åãã¼ã¿ããã¼ã§ãFluxã®åæ¹åãã¼ã¿ããã¼ããè¦ããã¨ããªãã£ãç§ã«ã¨ã£ã¦ã¯ããªãå¦ã³ããã£ãã®ã§ãèå³ãããã°è¦ã¦ã¿ã¦ãã ããã
*1:VMãæã¡åºãã¨æèãã¼ããã¦ãã¾ãã¾ãããPresentation Domain Seperationã«ãããPresentationã®ä¸ã«ããã¨ãããã¨ã ãä¼ããã°OKã§ãã
*2:StoreãViewModelã«è¦ãã¦ããã®ã¯åã®ä¸»è¦³ã§ããModelã ã¨ä¸»å¼µãããæ¹ã®ææ³ãå¦å®ãããã®ã§ã¯ããã¾ããã®ã§ãç°è«åè«ã¯ãèªèº«ã®ä¸»å¼µãèªåã®ããã°ãä½ãã§å±éãã¦ãã ãããããã¯ããã§åãèªã¿ããã
*3:Fat Controllerç¸å½ã®ãã®ãAction CreatorãReducerã®ä¸ã«å¢æ®ãã¦è¦éããæ»ã¬ã»ã©æªããªã£ãã³ã¼ãããã¾ã«è¦ããããæ¸ãããã¨ãããã¾ãã