ããã«ã¡ã¯ ã«ãã£ã¢ã§ã Yandex.Moneyã§ããã³ããšã³ããæžããŠããŸãã
倧äŒæ¥ã§åãããšã§ãã¿ã€ãã»ãã¿ãŒããããã°ã©ããŒã«æé·ããã®ã«ã©ã®ããã«åœ¹ç«ã£ããã説æããŸãã 貧匱ãªã¢ãŒããã¯ãã£ãšäœãrpsã§ããã©ãŠã¶ã®æ©èœãšæåã®æ®µéã§èŠåŽããããæ¹æ³ã«ã€ããŠã ãã®ã¹ããŒãªãŒã§ãå®éã®ããã³ããšã³ããšæŠãã®ã§ã¯ãªããã©ã³ãã£ã³ã°ããŒãžãã¹ã¿ã³ãããæèœã®ããéçºè ã®æéãç¯çŽã§ããŸãã
ãã®èšäºã§ã¯ãã¯ãŒã¯ãããŒãæé©åããæ¹æ³ãšããœããã¹ãã«ãéçºããçç±ãéçºããŠããããšã説æããŸãã 第äºéšã¯æ¥ãŠããŸã-ããã¯æè¡çã§ãã ãã®äžã§ãã¹ã¿ãã¯ã®è©³çŽ°ããããã2ã€ããçç±ãReactã䜿çšããBEMã®å人ïŒã¹ãã€ã©ãŒïŒå€ãã®ã³ãŒããããïŒã«ã€ããŠè©³ãã説æããŸãã è¡ããïŒ
æŽæ°ããŸããã 2çªç®ã®éšåãåºãŸãã ã
ããŒã1.ããã»ã¹ã«ã€ããŠ
2015幎ãŸã§ãGrunt.jsã¯ãBootstrapã«ã«ãŒã»ã«ã䜿çšããŠåä»ãªjavascriptã³ãŒããåéããstyles2.cssãäœæããŸãã
2016幎ã¯Reactãç§ã®äººçã«ãããããŸãã ããããç§ã¯ãŸã åãäœãããã¿ã³ãæŒããŸãããããŠèª°ããå€ã«ãããé£ç©ã«è»¢ãããŸãã ããã³ããšã³ãã¯æãããããŸããè·æ¥ã§ã¯ãªããšèãå§ããŠããŸããããã¿ã³ãç¥ã£ãŠããã°ãæ¬åœã®ããã°ã©ããŒã«ãªãã§ãããã
2017幎ã¯Yandex.Moneyã§å§ãŸããç§ã¯åããæ¬ç©ã®ããã°ã©ããŒããšããŠå§ãŸããŸãã
CSSããNode.jsãžã®ã¯ã³ã¹ããã
-ããã«ã¡ã¯ã äŒç€ŸYandex.Moneyã ãããã¹ãã¯æ¥œã§ããïŒ
-o_o
-é¢æ¥ã«æåŸ ããããšæããŸãã
-O_o
é ã®äžã®ããã¯ïŒãã¢ã«ãŽãªãºã ïŒ é£æ床ãå€æã§ããŸããïŒ ãœãŒãã¯ããã€ç¥ã£ãŠããŸããïŒ ããªãã¯äœã§ãããããããããªããããããæžãããšãã§ããŸããïŒ Node.jsã¢ããªã±ãŒã·ã§ã³ãã¯ã©ã¹ã¿ãŒåããæ¹æ³ãç¥ã£ãŠããŸããïŒ IISãæ§æããŸããïŒ ãããããã¯ãšã³ãã§ãããã€ããŒïŒ ãããŠãããªãã¯Canvasã§ç«ãæãæ¹æ³ãç¥ã£ãŠããã ãã§ããã ãã³ãã³ã°ã®æºåãšéå§ã«1é±éããããŸããããŒã¿æ§é ã«ã€ããŠèªã¿ãã¢ã«ãŽãªãºã ã®åââé¡ã解決ããNode.jsã®ãã¿ãŒã³ãšããã»ã¹ã³ã³ãããŒã©ãŒãåŠç¿ããŸãã ãã¿ãã¬ïŒOïŒnïŒãšOïŒlog nïŒãåºå¥ããããšããNode.jsã®ã¢ããªã±ãŒã·ã§ã³ç®¡çæ¹æ³ãç¥ã£ãŠããããšã誰ãæåŸ ããŠããŸããã§ããã
Yandex.Moneyã§ã®ã€ã³ã¿ãã¥ãŒã¯ãç§ããã§ã«èšªããã€ã³ã¿ãã¥ãŒãšã¯éåžžã«ç°ãªã£ãŠããŸããã ç§ã¯ä»æ§ã®ãã¥ã¢ã³ã¹ã«ã€ããŠå°ãããããæœè±¡çãªåé¡ã解決ããããæ±ããããŸããã§ããã ããã«ãããå®å¿ããŠæéãéããããšãã§ããŸãã
æåã®æ®µéã§ã¯ãjavascriptã®å°æ¥ã«ã€ããŠè°è«ããLodashã®ã¡ãœãããããã€ãå®è£ ããçšèªãšãã¿ãŒã³ã«ã€ããŠãè°è«ããŸããã 第äºæ®µéã§ã¯ãå°æ¥ã®ãªãŒããŒãšåºäŒããããã«èªåã«ã€ããŠã®ãã£ãŒãããã¯ãåãåããŸããã
圌ãã¯è¶
èªç¶çãªãã®ãå¿
èŠãšããŸããã§ããïŒ
-JavaScriptã®èªä¿¡ã®ããç¥èïŒã¯ããŒãžã£ãã¿ã€ããç¶æ¿ïŒ;
-ãµãŒããŒãšããåãããæ©èœïŒãã©ã³ã¹ããŒããOSIã¢ãã«ãREST APIïŒ;
-ãã©ãŠã¶ããã»ã¹ã®ç解ïŒãªãœãŒã¹ã®èªã¿èŸŒã¿ãã³ãŒãã®è§£æãã¬ã³ããªã³ã°ïŒã
ããã¯ãšã³ãã«ã€ããŠã¯ãNode.jsã®ã€ãã³ãã«ãŒãããã€ã¹ãç解ããExpressã§ã®æãåçŽãªã¢ããªã±ãŒã·ã§ã³ã«ã€ããŠèª¬æããã®ã«ååã§ããããšãå€æããŸããã
ãã®ãããhttpsã®httpsãšãããã¿ã€ãã®__proto__ã®éããç¥ã£ãŠãYandex.Moneyã«è¡ãçããŸããã
ãããžã§ã¯ãã®äœæ¥äžã«ãsshãã³ãã«ãäžããæ¹æ³ãããããªãããšã«æ°ä»ããŸããã åºæ¬çãªã³ã³ãœãŒã«ã¹ãã«ãšUNIXããã»ã¹ã®ç解ãäžè¶³ããŠããŸããã ãµãŒããŒããžãã¯ã«æ²¡é ããåŸãPromiseã®å®è£ ãç 究ããããããåºå¥ããæ¹æ³ãåŠã¶å¿ èŠããããŸããã ä»å€ã¯Webpackã®ããã¥ã¡ã³ããèªã¿ãææ¥ã¯ã¬ãã¥ãŒãµãŒã®äœæã®æŠå¿µã«ç²ŸéããRobert Martinã®Clean Codeãèªã¿ç¶ããŸãã ãªããããç¥ãå¿ èŠãããã®ã§ããïŒ ããã³ããšã³ãããžã·ã§ã³ã®ã€ã³ã¿ãã¥ãŒã«åæ Œããããã«äœãæºåããããç解ã§ããããã«ããŸãã
倧äŒæ¥ã®ããã»ã¹ããŸãã¯1æ¥ã§1è¡ã®ã³ãŒããèšè¿°ããªãæ¹æ³
ç§ãã¡ã®éšçœ²ã«ã¯50人ãããŸãã ãããŠããŸã 人ãå¿ èŠã§ãã ãµãŒãã¹ã®æ°ã¯å¢ãç¶ããŠããŸããæ°ããæ¹åæ§ãå§ãŸããæ°ããã¢ããªã±ãŒã·ã§ã³ãå¢ããŠããŸãã çç·Žããããã³ããšã³ãã¯ãŒã«ãŒã®13ããŒã ãYandex.Moneyã®Webãµã€ãã§äœæ¥ããŠããŸãã åœç€Ÿã®ãã€ã¯ããµãŒãã¹ã¯ããªãå€ç«ããŠãããããŒã ã¯åã ã®è£œåããµããŒããã責任ãè² ã£ãŠããŸãã ãã®ãããéçºè ã¯ã¢ããªã±ãŒã·ã§ã³ã®ã³ãŒãã«ç²ŸéããŠããããŠãŒã¶ãŒã®ããŒãºãç解ããŠããŸãã ãŸããå¥ã®ããŒã ã®äžéšãšããŠããã¯ãããžãŒã®å°å ¥ã«é¢ããå®éšãå®æœã§ããŸãã
åããŒã ã«ã¯ç¬èªã®è©³çŽ°ããããŸãã Expressã§ã¯ãªãKoaã®ã©ãããpromiseã§ã¯ãªãasync / awaitã®ã©ããã è€éãªãµãŒããŒããžãã¯ãèšè¿°ãããã®ãããã°ããšã¬ã¬ã³ããªã€ã³ã¿ãŒãã§ã€ã¹ãèšè¿°ãããã®ããããŸãã éèŠãªã¿ã¹ã¯ãšå éšããŒã«ã¯ãRïŒDããŒã ã«ãã£ãŠæ¹åãããŠããŸãã éèŠãªã¢ãžã¥ãŒã«ã®ãªãã¡ã¯ã¿ãªã³ã°ãå®è¡ããããã©ãŒãã³ã¹ãåæããã¹ã¿ãã¯éçºçšã®ããŒã«ãå®è£ ããŸãã å¥ã®ããŒã ãã€ã³ãã©ã¹ãã©ã¯ãã£ã«é¢äžããŠãããããä»ã®ããŒã ã®éçºè ã¯å€éšãŠãŒã¶ãŒåãã®æ°æ©èœã®ããã®æéã確ä¿ã§ããŸãã
ç§ã¯ãYandex.Cashã®å人ã¢ã«ãŠã³ããéçºããŠããããŒã ã§å§ããŸããã ãªã³ã©ã€ã³ã¹ãã¢ã®ææè åãã®ã€ã³ã¿ãŒãã§ã€ã¹ãäœæããæ¯æãå±¥æŽã確èªããŠé¡§å®¢ã«è«æ±ã§ããããã«ããŸããã çŸåšãç§ã¯RïŒDããŒã ãF-platformãã§åããŠããŸãã Node.jsã¢ããªã±ãŒã·ã§ã³ã®è² è·ã®é«ããããã¡ã€ãªã³ã°ã«åãçµãã§ãããReactã¢ããªã±ãŒã·ã§ã³ãäœæããã³ãµããŒãããããã®ãã©ãããã©ãŒã ãäœæããŠããŸãã åéçºè ã¯ãèªåã®å°éç¥èãé«ããããã§ä»èå³ã®ããããšãè¡ãããã«å¥ã®ããŒã ã«åãæ¿ããããšãã§ããŸãã
ã³ãŒãããŒã¹ã¯æ¥éã«æé·ããŠããŸãã 1æ¥ãããå¹³å26ã®ãã«ãªã¯ãšã¹ããéãããŸãã 1é±éã«æ倧20åã®ããã³ããšã³ãã³ã³ããŒãã³ãã®ãªãªãŒã¹ãè¡ãããŸãã ãã®ããžãã¯ããããäœããã®åœ¢ã§ç®¡çããããã«ãå®æçãªã¢ãŒããã¯ãã£äŒè°ãšã³ãŒãã¬ãã¥ãŒãéå¬ããŠããŸãã
å€ãã®äŒè°ããããŸãã 圌ãã¯ãã¹ãŠããã¹ãŠããããŠå šå¡ãšè°è«ããŸãã ååæã®çµããã«ãäŒè°å®€ã¯2é±éã§äºçŽãããŸãã 亀æžã¯åãããŠãããå£ã£ãŠããŠãæ°ãããã®ãè£ åããŠããŸãã ããããäŒè°ã«è²»ãããæéã¯åžžã«å ±ãããŸãã ç§ã¯ããã蚌æããããã«ããã€ãã®äŸãæããŸãã
Vasyaã¯javascriptãæããŠããŸããã匱ãåä»ãã¯å¥œãã§ã¯ãããŸããã Vasyaã¯äžå¹žã§ãã æ¯é±ã®ããã³ããšã³ãããŒäŒè°ã¯åœŒãå©ããŸãã 圌ãã¯ãã¹ã¿ãã¯éçºã®ããã®æ°ããã¢ãããŒããšããŒã«ã«ã€ããŠè°è«ããåé¡ãå ±æãã劥åãæ±ããŸãã ããã§åœŒã¯ã¿ã€ãã¹ã¯ãªãããèŠããã®ãäŒãã圌ã®äžçã¯ãã¯ãåãã§ã¯ãããŸããã Typescriptãç§ãã¡ã«ãšã£ãŠæçšãªå ŽæãèŠã€ããVasyaã¯å¿ãåãããã人ã ãèŠã€ãã圌ã®ãããžã§ã¯ãã«ãããå®è£ ããŸãã Vasyaã¯å¹žãã§ã-圌ã¯ä¿¡é Œã§ããã³ãŒããæã£ãŠããŸãã éšéã®å šå¡ãæºè¶³ããŠããŸã-Typescriptã¯ã䟿å©ã§å¿ èŠãªå Žåã«ã®ã¿äœ¿çšããŸãã ãŸããå¿ èŠã«å¿ããŠãæããåŽã«ç§»åããããšãã§ããŸãã
ãªãªãŒã¯ãã®åå¿ã«ã€ããŠæžããŠããŸãã ãªãªãŒã¯ãããŒã¿ãä¿åããå ŽæïŒããŒã«ã«ç¶æ ãŸãã¯ã¹ãã¢ïŒã決å®ããŸããã ãªãªãŒã¯setStateïŒïŒãå®è¡ããŸãããå人ã¯åœŒå¥³ãç¬ããŸãã ãªãªãŒã¯ãã¹ãŠãã¹ãã¢ã«ä¿åããããšã«ããŸããããã³ãŒãã®ã¬ãã¥ãŒã§ç«¶åããã³ã¡ã³ããååŸããŸãã ãªãªãŒã¯äžå¹žã§ãã 圌女ã¯ããžãã¯ã®ã¬ãã¥ãŒãæäŒããŸãã ããã¯ãç°ãªãã¬ãã«ã®ããã³ããšã³ãéçºè ãäºãã«ã¢ãŒããã¯ãã£äžã®èª€ã£ã決å®ãåé¿ããã®ãå©ããäŒè°ã§ãã ããã§ããªãªãŒãšç§ã¯ããŸããŸãªã±ãŒã¹ãèŠãŠããã¹ãŠã®ãã¥ã¢ã³ã¹ãèæ ®ã«å ¥ããŠãæè¯ã®è§£æ±ºçãèŠã€ããŸãã ãªãªãŒã¯çµè«ãèšé²ããã³ãŒãã¬ãã¥ãŒã«åæ ŒããŸãããªãªãŒã¯å¹žãã§ãã ãã®è³ªåã¯ä»ã®äººãå°æãããããšã¯ãããŸãã-éšéã®èª°ãã幞ãã§ãã
ã¹ã±ãžã¥ãŒã«ãããäŒè°ã«å ããŠãæã«æ°åæè¡éèš³ãå®æœãããã¬ãŒãã³ã°ã³ãŒã¹ãéå¬ããŠããŸãã ããšãã°ãReactãžã®ç§»è¡äžã«ãéšéã®äœäººããæ®ãã®è¬çŸ©ãæºåããŸããã ãããã®ã¬ã¯ãã£ãŒã¯ãReactã䜿çšããŠããªãéçºè ããããã«é¢é£ããã¿ã¹ã¯ãè©äŸ¡ããŠå®äºããããšãã§ããããã«ãå¿ èŠãªæå°éãæäŸããŸããã ãããŠæ°é±éåŸãå®å šã³ãŒã¹ãå§ãŸããŸãã ããã³ããšã³ãã«æ¯æãããžãã¯ããªããšããäºå®ã«ãããããããç§ãã¡ã¯ãŠãŒã¶ãŒã®å¿ èª å¿ãšä¿¡é Œã«è²¬ä»»ããããããã¯ç°¡åã«å€±ãããã³ãŒãã«è匱æ§ãæ®ããŸãã
äŒè°ã«åºåžããããšã¯è² æ ã«ãªããŸããã ç§ã¯ãããã奜ãã§ããç§ã¯æçšã ãšæããçã¿ãšçµè«ãå ±æããæ°ããããšãåŠã³ãéšéã®ç掻ã«åå ã§ããŸãã çµå±ãçããŠããã³ãŒãã¯ããã°ã©ããŒã ãã§ã¯ãããŸããã ãããŠããã 座ã£ãŠã³ãŒããæžãããšã¯ã§ããŸããã ããŒã ã®äžå¡ãšãªãããããžã§ã¯ãã®ãã¹ãŠã®æ®µéã«åå ããŸãã ãããŠãé¢ããŠè¡ãïŒ
- ãããã¯ããããŒãžã£ãŒãšãããžã§ã¯ãã«ã€ããŠè©±ãåããæè¡çãªè§£æ±ºçãäœæããåé¡ã®ã±ãŒã¹ã«åãçµã¿ãŸãã ãããŠãããã³ããšã³ãã«ã¯ééããªãæäŸãããã®ãšèŠåããå ŽæããããŸãã ãŸãããããžã§ã¯ããéå§ããåã«ãå¿ é ã®ããžãã¯ã¬ãã¥ãŒãå®æœããŸãã
- ã¿ã¹ã¯ã®å解ãå®è¡ããå®è£ æéãèšç»ããŸãã 誰ãèšç»ããã®ã奜ãã§ã¯ãããŸããã ãããã誰ãããããè¡ããŸãã 誰ãç· ãåãã¢ãŒãã§åãã®ã奜ãã§ã¯ãªãããã§ãã ãããã誰ããæã ãããããŸãã
- éçºãéå§ããŸãã ãã£ãïŒ ã³ãŒããæžãããšãã§ããŸãïŒ ããã§ã¯ãããŸããã ã³ãŒããã¢ããªã±ãŒã·ã§ã³ãŸãã¯ã©ã€ãã©ãªã®å šäœæ§é ã«ãšã¬ã¬ã³ãã«çµ±åããããã«ãåã¢ãžã¥ãŒã«ã®APIãæ€èšããŸããããã«ãããä»ã®éçºè ãå°æ¥ã³ãŒããç°¡åã«æäœã§ããããã«ãªããŸãã ãããç§ãã¡ã®ã»ãšãã©ã®æéãã€ãŸãå°ããªãœãªã¥ãŒã·ã§ã³ã®ã¢ãŒããã¯ãã£ã§ãã
- ã³ãŒãã¬ãã¥ãŒãå®æœããŸãã ããã§ãããã³ããšã³ãã«é¢ããå€ãã®èå³æ·±ãããšãããããŸãã ãããŠèªåèªèº«ã«ã äžéšã®ã¢ããªã±ãŒã·ã§ã³ã§ã¯ãæ°žç¶çãªã¬ãã¥ãŒæ åœè ãå²ãåœãŠãŸãã 人ãã³ã³ããã¹ãã«ãšã©ãŸããããžãã¯ãããç解ããããã«ãã³ãŒããããæ·±ãåæããéèŠãªã³ã¡ã³ããããããšãã§ããŸãã
- ç§ãã¡ã¯ãªãªãŒã¹ããŠããŸãã ããã³ããšã³ãã¯ãã·ã¹ãã 管çè ã»ã©æéããããŸããããªãªãŒã¹ããã»ã¹ã¯ãJenkinsã䜿çšããŠå¯èœãªéãèªååãããŸãã ãŸããäœãã足ããªãå Žåã¯ãjsãŸãã¯groovyã«ã¹ã¯ãªãããè¿œå ã§ããŸãã
ãããã®ããã»ã¹ãžã®åå ã¯ãç§ã®ä»äºæéã®å€§éšåãå ããé£ãç¶ããŠããŸãã ç§ã¯ã³ãŒãã®60ïŒ ãæžããŠããŸãã æ®ãã®40ïŒ ã¯ãéšéã®éçºãšãããžã§ã¯ããµããŒããžã®åå ã«è²»ããããŸãã ã¢ã¯ãã£ããªã©ã€ãã¹ã¿ã€ã«ãæã€ã·ãã¢éçºè ã¯ãå€ãã®å Žåãã³ãŒããçŽæ¥æžãã®ã«ãããæéã¯åå以äžã§ãã ååã®çžè«ãæŠéäžã®äºä»¶ã®åæã管çè ããããŒãžã£ãŒãšã®ããåã-ãããã¯ãã¹ãŠç§ãã¡ã®ä»äºã®äžéšã§ãã ãããŠã確ãã«ãçŽ æŽãããéšåã§ãã
ã³ãŒãã«ããå€ãã®æéãå²ãããã«ãå°éå¯èœãªãã¹ãŠãèªååããŸãã Jenkinsã䜿çšããŸãããªãªãŒã¹ããã»ã¹ã ãã§ãªããæ©èœã®ã¢ã»ã³ããªãšå±éããã¹ãå®è¡ãè匱æ§ãã§ãã¯ãç°¡çŽ åããŸããããããã¯ãã¹ãŠãã¿ã³ãã¯ãªãã¯ããã ãã§å®è¡ã§ããŸãã ãããŠãæãã¢ã¯ãã£ããªããã³ããšã³ãéçºè ã¯ãå éšããŒã«ã䜿çšããŠãªããžããªãäœæããŸããïŒãã©ãŒã ã®äºåå ¥åãã¬ãã¥ã¢ãŒã®ãã¹ããŒããéžæãã¡ãã¥ãŒããŒããã®Jiraã§ã®ãã«ãªã¯ãšã¹ããšã¿ã¹ã¯ã®ãªã¹ããžã®ã¢ã¯ã»ã¹ã
ããã¯ãã¹ãŠã«ãŒãã³ãæé€ãããããããéèŠãªããšãè¡ããŸãã ããšãã°ãèšäºã翻蚳ããããããã£ã¹ããæžããŸããã :)
çµçã ãã§ã¯ãã¯ãã¯ãŒã«ã§ã¯ãªãçç±
ãã¥ãŒã©ã«ãããã¯ãŒã¯ã¯ãã§ã«è£ãããšãã§ããããã§ãã ã¹ã¯ãªããã«çœ®ãæããããªãããã«ããã«ã¯ã©ãããã°ããã§ããïŒ ããã°ã©ãã«ãªãã åªããããã°ã©ããŒã«ãªã£ãŠãã ããïŒ==çŸããã³ãŒããæžãããmatanãç¥ã£ãŠãã ããã ãœããã¹ãã«ã®èšèšãšã¢ããã°ã¬ãŒããåŠã³ãŸãã
å€ãã®æçœã§ãªãã¿ã¹ã¯ã¯ãããã³ããšã³ããšåªç§ãªããã°ã©ããŒã®è©ã«ããã£ãŠããŸãã ãªãã¡ã¯ã¿ãªã³ã°ã®å¿ èŠæ§ããããŒãžã£ãŒã«äŒããæéã®å²ãåœãŠã調æŽã§ããå¿ èŠããããŸãã æéããªãå Žåã¯ãèšèšè ã«ã€ã³ã¿ãŒãã§ã€ã¹ãç°¡çŽ åãããã説åŸããŠãã ããã ãŸããé¢é£éšéåãã®ãœãªã¥ãŒã·ã§ã³ãéçºããéã«ã¯ãååã®ããŒãºãåæããããã¥ã¡ã³ããæ€èšããæè¡çãªãœãªã¥ãŒã·ã§ã³ãç¬èªã«çå®ããŸãã ããªãããŸã ãã®ãããªä»äºã«åŸäºããŠããªããªãããã£ãšããªãã¯ãããã«åºäŒãã§ãããã ããããããã§ããç§ãã¡ãšäžç·ã«ãYandex Moneyã§ã ;ïŒ