翻蚳è ããïŒJim Weirichã¯Rubyã³ãã¥ããã£ã®äŒèª¬çãªäººæ Œã§ãã æ®å¿µãªããã圌ã¯ç§ãã¡å šå¡ãšåãããã«äººéã§ãã å°ãåã«åœŒã¯ç§ãã¡ãå»ã£ãã ãã®ç¿»èš³ã¯ãäžçãå°ãå€ãããã®ç·ãžã®ãªããŒãžã¥ã§ãã
ç§ã¯ãžã ã«ã€ããŠé·ãéèããŠããŸãããçµå±ã®ãšããã圌ã¯å®éã«ã«ãŒãã¹ãã®éã§äºå®äžã®æšæºã«ãªã£ãã¬ãŒããŠãŒãã£ãªãã£ã®èè ã§ãã ç§ã®å¹žéãªããšã«ãç§ã¯GoRuCo 2012ã§ã®åœŒã®ã¹ããŒãã®ãªã¹ããŒã®1人ã§ãrakeã®é«åºŠãªæ©èœã«ã€ããŠè©±ããŸããã ãžã ãè€éãªãããã¯ã«ã€ããŠèªã£ãæilityæ§ãšå®¹æãã«ã©ãã»ã©æéãåãããèŠããŠããŸãã ãã®å¹Žã®åŸåãRubyConfã«ã³ãã¡ã¬ã³ã¹ã§ã圌ã®ãã1ã€ã®æ³šç®ãã¹ããã¬ãŒã³ããŒã·ã§ã³ãèŠãŸãããããã¯ãã©ã ãèšç®ã®åºæ¬ååã®ããã€ãã説æããŸããã ãžã ã¯ããããæãç°¡åãªãããã¯ã§ã¯ãªããç°¡åã«èª¬æããã ãã§ãªããéäžã§ãªã¹ããŒã倱ããŸããã§ããã
ãžã ãããã®ã€ã³ã¿ãã¥ãŒãåããçç±ãç解ã§ãããšæããŸããããã¯ã圌ã«ã€ããŠããå°ãåŠã³ãäœããåŠã¶ãŠããŒã¯ãªæ©äŒã ããã§ãã éçºäžçã§ã®åœŒã®éã®å§ãŸããRubyã§ã®åœŒã®æåã®ã¹ããããé¢æ°åããã°ã©ãã³ã°ãRubyã®ã¹ã¬ããã®ã¢ãã«ãããã«åœŒã®ãã¹ããã¬ãŒã ã¯ãŒã¯ã§ããRSpec-Givenã«ã€ããŠã話ããŸããã ã ããããã®ã€ã³ã¿ãã¥ãŒãéããŠãæãå é²çã§ã«ãªã¹ãçãªéçºè ã®1人ãèŠã€ããã®ãæ ããªãã§ãã ããïŒ
ããã°ã©ããŒã®çãèŠçŽ
ã©ã®ããã«ããŠéçºè ã«ãªããŸãããïŒ ãã®è·æ¥ãéžãã çç±ã¯äœã§ããïŒ
ç§ã¯å€ãè¯ã70幎代ã«åŠæ ¡ã§ããã°ã©ãã³ã°ã«åºããããŸããã ããããç§ã¯ãBCDã·ã¹ãã ã®éçºã«æ§ããããæ¬ãå³æžé€šã§åããŸããã ã¢ã»ã³ãã©ãŒã«äŒŒãèšèªãããã°ã©ãã³ã°èšèªãšããŠäœ¿çšãããŸããã äžè¬çã«-ãã¡ãããã¢ã»ã³ãã©ãŒã§BCDã®äžã§æžãã®ã¯å°ãã¯ã¬ã€ãžãŒã§ãããç§ã¯ãããç解ããŸããã
ãããŠãé åèªBCDã¯ã©ãããæå³ã§ããïŒ
BCDã¯Binary Coded Decimalã§ããããã¹ãŠã®æ°å€ã10é²è¡šèšã§æ ŒçŽãããã·ã¹ãã ã§ãïŒåŸæ¥ã®ãã€ããªãšã¯ç°ãªããŸãïŒã
ããã¯éåžžã«çãããã·ã³ã¢ãŒããã¯ãã£ã§ãããããã°ã©ãã³ã°ã®åå¿è ã§ãåãå ¥ããããŸãã ç§ã¯ã³ãŒããæžãããšãåŠãã§ãããšãã«ã©ã®ããã«æããã®ããèŠããŠããŸãã è·æ¥ã®éžæã«é¢ããŠãç§ãã¢ããã€ã¶ãŒã«æ£ç¢ºã«å®£èšããããšãæšæž¬ããŠãããšæããŸãã 確ãã«ããã³ãã¬ããã§å žåçãªããã°ã©ããŒã®èª¬æãèªãã åŸãç§ã¯ç¹ã«èœã¡èŸŒãã§ããã
ããã«æžããããã®ãèŠãããŸãããïŒ
ããŠã次ã®ãããªãã®ïŒ
ã...ããªãã¯æ·±ãæéã®äžã§å®å šã«äžäººã§åº§ã£ãŠããŸãã ...ä»äºã®äœæéãã®éã誰ãšãã³ãã¥ãã±ãŒã·ã§ã³ãåããŸããïŒâ
ãã®åŸãããã°ã©ãã³ã°ã¯çŽ æŽããããšæããŸãããããã®ãããªä»äºã¯...ãããããããšãïŒ
ç§ã®å€§åŠæ代ãã³ã³ãµã«ã¿ã³ãã¯ç§ã«ã¢ããã€ã¹ããŸããããFortran for Beginnersã³ãŒã¹ã«ãµã€ã³ã¢ããããŸãããïŒ æ°ã«å ¥ããããããŸãããã ç§ãæåã®ã¬ãã¹ã³ã«æ¥ããšããè¬åž«ã¯é»æ¿ã«è¡ãããã®éçšã§ããã説æããã³ãŒããæžãå§ããŸããã 圌ãæžããæåã®é¢æ°ã®åå-ã¡ã³ããŒã ç§ã¯è¬çŸ©ãèããŠããŠããããç§ã«æ°ã¥ããŸããããããã¯ãFortranã®ããçš®ã®ããŸãã«ãå¥åŠãªæ¹èšã§ãã ãã©ã±ãããå€ãããŸãïŒã ãããããããã¯Lispã ã£ãïŒ çµå±ã®ãšãããç§ã¯ãªãã«ã»ãªã¹ããŒã®èè ã§ãããã³ã»ããªãŒããã³ã®æåã§å¯äžã®ã³ãŒã¹ã«åå ããŸããã
ãŸãããã³ãã¬ããããããã°ã©ãã®äžåãªèª¬æã¯ã©ãã§ããïŒ
ããããã°ã©ãã³ã°ã¯éåžžã«ç€ŸäŒçãªæŽ»åã§ããããšãå€æããŸããã ä»æ¥ãäžäººã§ä»äºãããŠããŠããTwitterãIRCãgithubã®åé¡ããŸãã¯ã¡ãŒãªã³ã°ãªã¹ããéããŠä»ã®äººãšãã€ã§ããã£ããããããšãã§ããŸã...ç§ãã¡ã¯1970幎代ã«èª¬æãããå¯äžã®ãªãªã«ãã§ã¯ãããŸããã
幞ããªçºèŠ
ã©ã®ããã«ããŠRubyã«æ¥ãã®ã§ããïŒ
ç§ã®èšæ¶ãç§ã«æ£ãã圹ç«ã€ãªããããã¯2000幎ã§ããã ãã®åŸãC ++ãšJavaã§äœæããPerlã§ãäœæããŸããïŒæ¥åžžçãªäœæ¥ãæžããããã®å°ããªã¹ã¯ãªããã§ãïŒã ãããŠãæ®å¿µãªããããã°ããããŠããŒã«ã¯ç§ãæããå§ããŸãããããã¯ãé«éãªããã¯ã«æé©ã§ããããçŸããæœè±¡åãæžãã®ãé£ããããã§ãã ããã§ã¯ãããšãã°ããªã¹ããå¿ èŠã§ã-ããŒã«ã§ãããåãåºããŠãã ãããããããªã¹ãã®ãªã¹ãããã§ã«å¿ èŠãªå Žå-ãããŠããã¹ãŠãèšèªã¯ããã¡ãªãåäœãå§ããŸãã
ãããŠãç§ã¯èªåã«åã£ãæ°ããèšèªãæ¢ãå§ããŸããã ãã£ãšè¡šçŸåã®ãããã®ã欲ããã£ãã®ã§ãæœè±¡åãããç©æ¥µçã«äœ¿çšã§ããããã«ãªããŸããã ãŸãããªããžã§ã¯ãæåããã°ã©ãã³ã°ã倧奜ãã ã£ãã®ã§ã察å¿ããèšèªãå¿ èŠã§ããã ç§ã¯Pythonãéåžžã«æ éã«ç 究ããå°ãªããšã3ã€ã®ã¢ãããŒããè¡ããŸããã ãããããåç¥ã®ããã«ãç§ã®é ã®äžã«ã¯ãã®ãããªããã ïŒãã¯ãããŸããã§ããã ãã®ããããã°ãããããšãPythonã®é²æ©ãæ¢ãŸããŸããã
PythonãåŠãŒããšãã3åã®è©Šã¿ã®ã©ããã§ããã€ãã»ããŒãã¹ããæçŽãåãåããŸããã圌ã¯æ¬¡ã®ããã«æžããŠããŸãããRubyãšããå°ããªèšèªãèŠã€ããŸããã ã The Pragmatic Programmer ããšããæ¬ãèªãã§ããã€ãèªèº«ãäœãããå§ããããªããããã¯å°ãªããšãäžèŠã®äŸ¡å€ããããšæèšããŸããã ç§ã¯RubyãããŠã³ããŒãããã»ãã®æ°åé圌ãšéãã ãšãããçªç¶æ°ã¥ããã ããã¯ãŸãã«ç§ãæ¢ããŠããèšèªã§ãïŒã 3æ¥åŸãPerlã§ã®æžã蟌ã¿ãåæ¢ããå®å šã«Rubyã«åãæ¿ããŸããã
ããã¯ã©ã®ããŒãžã§ã³ã®Rubyã§ãããïŒ
ããã¯Ruby 1.6ã§ããïŒåºã§2000幎å€ã ã£ãã®ã§ïŒã
Rubyã¯ããªãã«äœã倢äžã«ãããŸãããïŒ
圌ã¯çç ãšåãããã«ãã¹ãŠãããŸãããããªããžã§ã¯ãæåã®æ¹æ³ã§ã®ã¿ã§ããã ãããŠãç§ã¯ãã®åé¡ãPerlã§æžããŸããããªããžã§ã¯ããããã°ããã®æ¹æ³ã§åé¡ã解決ããŸãããšèããããšãèŠããŠããŸãã ãã®åŸãRubyã«åº§ã£ãŠããªããžã§ã¯ãã«åºã¥ããŠæ§ç¯ããããœãªã¥ãŒã·ã§ã³ãæ©èœããããã«ãªããŸããïŒ ãã¡ãããPearlã§ã§ããããšãšåãããã«ãçŽ æ©ãïŒãããŠæ±ãïŒããªãã¯ã䜿çšã§ããŸãããããã°ãããããšãRubyã«ã¯åªããæœè±¡åããããèšèªèªäœãéåžžã«æ£ããéçºãããŠããããšãããããŸããã ç§ã¯åœŒã«äŒã£ãããšã ãã§å¹žãã§ããã
Rubyã¯æ©èœããŸããïŒ
ããã§ã¯ãRubyã¯ãªããžã§ã¯ãæåèšèªã§ãã ããããåæã«æ©èœããŸããïŒ ãããŠããæ©èœçããšããèšèã¯ã©ãããæå³ã§ããïŒ
ããã¯æ¬åœã«è¯ã質åã§ãã ä»æ¥ãé¢æ°åèšèªã¯ãŸããŸã泚ç®ãéããŠããŸããããšãã°ãä»å€ãã·ã³ã·ããã£åžã§é¢æ°åèšèªã®ããã°ã©ããŒãšããŒãã£ã³ã°ãè¡ããŸãã ãã®æ±ºå®ã«å¯Ÿããç§ã®åŠ»ã¯ãããŸãã倧äžå€«ããããŠææ¥ãããªãã¯åãªã人éã®éçºè ãšäŒã£ãŠããã®ã§ããïŒããšèšããŸããã
äžè¬ã«ãèšèªãæ©èœãããã«ã¯2ã€ã®èŠä»¶ããããŸããæåã®èŠä»¶ã¯ãé¢æ°ãæåã®ã¯ã©ã¹ã®ãªããžã§ã¯ããšããŠæäœããããšã§ããããå Žæããå¥ã®å Žæãžã®é¢æ°ã®è»¢éãå€æ°ãšã®é¢é£ä»ããã¯ããŒãžã£ãŒã䜿çšããæ°ããé¢æ°ã®äœæãªã©ã§ãã Rubyã¯æåã®èŠä»¶ãæºãããŸããã©ã ããšã¯ããŒãžã£ããããããããå€æ°ã«ãã€ã³ãããåçã«æ°ããé¢æ°ãäœæããããšãã§ããŸãã ãã®ããããã¡ãåŽããèŠããšãRubyã¯éåžžã«æ©èœçãªèšèªã§ãã
ãããã2çªç®ã®èŠä»¶ããããŸãïŒ é¢æ°åèšèªã¯éåžžã«èå³æ·±ããã®ã«ãªããŸãã ããã¯ããšã³ãã£ãã£ã®ç¶æ ãå€æŽããããšã®å®¹èªã§ããªãããšã«ãããŸãã Rubyã¯ãªããžã§ã¯ãã®ç¶æ ãåžžã«å€åãããããããã®èŠä»¶ãæºãããŠããŸããïŒ
é¢æ°åããã°ã©ãã³ã°ã¯ããã®ãã«ãã¹ã¬ããå®è£ ã«ãšã£ãŠèå³æ·±ããã®ã§ãã ãã«ãã¹ã¬ããããã°ã©ãã³ã°ã®éèŠãªåé¡ã®1ã€ã¯ãããšãã°ãåãããŒã¿ãåŠçãã2ã€ã®ã¹ã¬ãããããå Žåã®ç«¶åç¶æ ã§ãã ãã®ã¬ãŒã¹ã§ã¯ã誰ãåã€ãããããŸããã ããšãã°ãã«ãŠã³ã¿ãŒã®å¢å ã 2ã€ã®ã¹ã¬ããããããæåã®ã¹ã¬ãããçŸåšã®å€ãèªã¿åããã¡ã¢ãªã¬ãžã¹ã¿å ã®å€ãã€ã³ã¯ãªã¡ã³ãããŠããæ»ããŸãã ãã®æç¹ã§ã2çªç®ã®ã¹ããªãŒã ã¯å€ãèªã¿åããå€ãå¢ãããŠæžã蟌ã¿ãŸãã ããããå³å¯ãªé åºã§æ¬¡ã ã«äº€äºã«ãªãã10ããå§ãŸãå Žåã11ã12ãªã©ã«ãªããŸãã ã¹ã¬ããå ±æãªãœãŒã¹ãå€æŽãããå¯èœæ§ãããå Žåã¯ãéåžžã«æ³šæããå¿ èŠããããŸãã
ãã®åé¡ã解決ããã«ã¯ã2ã€ã®æ¹æ³ããããŸããå ±æãªãœãŒã¹ã䜿çšããªããããã®åããªãœãŒã¹ãå€æŽããªãã§ãã ããã é¢æ°åããã°ã©ãã³ã°ã¯2çªç®ã®ã¢ãããŒãã䜿çšããŸããããŒã¿ã¯å€æŽããããäœæãããã ãã§ãã ãã®ã¢ãããŒãã«ããããã«ãã¹ã¬ããããã°ã©ãã³ã°ãèããç°¡åã«ãªããŸãã ç§ãã¡ã®æè¡ç€ŸäŒã§ã¯ãæ°ããé/ããã»ããµã®ããããã§ããã«ãã¹ã¬ããã®å¿ èŠæ§ãé«ãŸãã ãã ãšæããŸãã ãŸããClojureã®ãããªèšèªã«ã¯ãã¹ã¬ããæäœã容æã«ããããã®éåžžã«åªããæ§é ãæ¢ã«çµã¿èŸŒãŸããŠããŸãã Clojureã§ã¯ãããŒã¿ãå€æŽããŠããå®å šãªãšãã«éåžžã«ç¹æ®ãªæ¡ä»¶ã§ãããè¡ããŸãã
ãããŒã®åœŒã®ã¢ãã«ã¯1960幎ãã1970幎ã«ç±æ¥ãããããRubyã¯ããã«èŠããã§ããã®ã§ã¯ãªãããšå¿é ããŠããŸãã
Rubyã¹ã¬ããã¢ãã«
ã¯ããç¹ã«MRI Rubyã å人çã«ã¯ãã€ã³ã¿ãŒããªã¿ãŒèªäœã¯ã¹ã¬ããã»ãŒãã§ã¯ãªããšèããŠããŸãã ããã¯æ¬åœã«ããã§ããïŒ
ã€ã³ã¿ãŒããªã¿ãŒã¯ã¹ã¬ããã»ãŒãã§ãããããã¯GILïŒGlobal Interpreter LockïŒã®å©ããåããŠéæãããéçºè ã¯RubyConfã§ããã«ã€ããŠå€ãã®ããšã話ããŸããã ãã®ã¢ãããŒãã®æ¬è³ªã¯ãã€ã³ã¿ãŒããªã¿ãŒã«å ¥ããšãä»ã®ã¹ã¬ãããåæã«ã€ã³ã¿ãŒããªã¿ãŒã«å ¥ãããšãã§ããªãããã«ããã¯ãèšå®ãããããšã§ãã ãã¡ãããããã¯ãã¹ãŠã¹ã¬ããã®å®å šæ§ã«ã€ãªãããŸãããããçšåºŠã¯ãã¹ã¬ããèªäœã®äœæ¥ãè€éã«ããŸãã
ããããJRubyãšRubiniusã¯ã¹ã¬ããã»ãŒãã§ããïŒ
ã¯ãïŒ äžäœã¬ãã«ã§ããã¯ã課ããŸãã ãã®ãããªããšããããŸããæåã«å¿ èŠãªã¬ãã«ã§ã¢ãŒããã¯ãã£ã«ããã¯ã€ã³ããã°ãæçµçã«ãããè¡ãã®ã¯ç°¡åã§ãã æ¢åã®èšèªã«ã¹ã¬ããã»ãŒããè¿œå ããããšã¯ãMRIéçºè ã察åŠããªããã°ãªããªãæ¬åœã®åé¡ã§ãã 圌ãã¯æåŸã«GILãè¿œå ããŸããããããã¯å°ãè¡šé¢çãªè§£æ±ºçã§ãã
Matzã¯ããã€ã¯ãããã¯ïŒãã€ã¯ãããã¯ïŒãã€ãŸãå ±æããŒã¿ã«ããã¯ãããããšããå¥ã®ã¢ãããŒãããã¹ããããšè¿°ã¹ãŸããã ãŸãããã®å Žåãã³ãŒãã¯GILã䜿çšããããŒãžã§ã³ãããã¯ããã«é ãåäœãå§ãããšè¿°ã¹ãŸããã ããã«ãã®ãããªãœãªã¥ãŒã·ã§ã³ã®äŸ¡æ ŒããããŸãã ãããã£ãŠãã¹ã¬ããã䜿çšããå¿ èŠãããå Žåã¯ãJRubyãŸãã¯Rubiniusã詳ãã調ã¹ãå¿ èŠããããŸãã ãããããããã䜿çšããå Žåã§ããå ±æãªãœãŒã¹ã¯å€æŽãããå¯èœæ§ãããããšãèŠããŠããå¿ èŠããããŸããRubyã¯ãã®åé¡ã«å¯Ÿããåªãããœãªã¥ãŒã·ã§ã³ããŸã æäŸããŠããªãããã§ãã
ãã¹ãŠã®éçºè ãèªãã¹ã10ã®åºçç©
ç§ã¯ãæ°ããã¢ãã³ãªã¢ã€ãã¢ããã°ãã°ç 究ãšéå»ããã®é ãæ¥ã ã®åºç€ã«åºã¥ããŠãããšããäºå®ã奜ãã§ãã äŸãã°ãRubyConfã§ã®ãã¬ãŒã³ããŒã·ã§ã³ã§è©±ããé¢æ°åããã°ã©ãã³ã°ãLambdaèšç®ã®ã¢ã€ãã¢ã
ãããã¯80æ³ã®ãã®ã§ãïŒ
ããªãã¯ãŸã ããªãã®è¢ã«ãã®ãããªãã®ãæã£ãŠããŸããïŒ
2009幎ãMichael Feathersã¯ããã¹ãŠã®ããã°ã©ããæäœ2åèªãã¹ã10ã®è«æããšããèšäºãæžããŸããïŒ æ®å¿µãªãããå ã®èšäºã¯ããå©çšã§ããŸãã ïŒã
æåã®æ¬ã¯David Parnanã«ãã£ãŠæžããã ãã·ã¹ãã ãã¢ãžã¥ãŒã«ã«å解ããéã«äœ¿çšãããåºæºã«ã€ããŠããšé¡ãããŠããŸã ã 圌ã¯ãç°¡åãªããã°ã©ã ãã³ã³ããã¹ãã®ããŒã¯ãŒããæžããŸããã
ããã°ã©ã ã¯ããã¹ããã¡ã€ã«ãå®è¡ãããã¹ãŠã®åèªãèŠã€ãããããã®åèªãèŠã€ãã£ãããã¹ãé åãèŠã€ããèŠã€ãã£ãããã¹ããããã¯ãèšé²ããŠãåèªãåŸã§ãããã眮ãããŠããããã¹ããšãšãã«ãã£ã¬ã¯ããªã«è¡šç€ºãããããã«ããŸãã ããã¯å®éšã§ããã Davidã¯ç°ãªãã¢ãããŒãã䜿çšããŠ2ã€ã®ããã°ã©ã ãäœæãããããã®ããã°ã©ã ã«æ°ããèŠä»¶ãå ãããããšãã«äœãèµ·ãããã調ã¹ãŸããã å®éšäžã«ãããã°ã©ã ãæžãæè¯ã®æ¹æ³ã¯ãã¢ãžã¥ãŒã«ã«åå²ããããšã§ããããšãããããŸãããåã¢ãžã¥ãŒã«ã¯å éšã³ã³ãã³ããé ããŸãã
ããã¯ãªããžã§ã¯ãæåããã°ã©ãã³ã°ïŒOOPïŒã®ã¢ã€ãã¢ã§ã¯ãããŸãããïŒ
ã¯ãããããã®ãã¡ã®1ã€ãOOPã§ã¯ãåãªããžã§ã¯ãã¯æ å ±ã®äžéšãšãäžçãå éšã§äœãèµ·ããããæ°ã«ãããªããã®ãæ ŒçŽããŸãã ãããã£ãŠãä¿ç®¡æ¹æ³ããã³å éšéšåãšã®çžäºäœçšã®æ¹æ³ãå€æŽããŠããä»ã®éšåã«ã¯åœ±é¿ããŸããã ãããŠããã®éåžžã«åçŽãªå®éšã¯ãäœãããå¿ èŠããããã瀺ããŸããã ãã®èšäºå šäœãèªãããšã匷ããå§ãããŸã ã ãããããå®éã«å®éšãè¡ã£ãã®ãæ°ã«å ¥ã£ãŠããŸãã圌ã¯ã³ãŒããæžããŠãæ°ããæ¡ä»¶äžã§ã®åäœã確èªããŸããã
ãã1ã€ã®ã¯ãŒã«ãªèšäºã¯ããžã§ã³ããã«ã¹ãæžãããããã°ã©ãã³ã°ããã©ã³ãã€ãã³ã¹ã¿ã€ã«ãã解æŸã§ããŸããïŒ ãã§ãã ããã¯åœŒããMLããã€ãŸãé¢æ°åããã°ã©ãã³ã°èšèªãšåŒãã æåã®åºçç©ã®1ã€ã§ãã MLã¯ãHaskellãOCalmãªã©ã®èšèªã®åºç€ãšãªã£ãŠããŸãã
ç§ãå ±æãããããäžã€ã®çŽ æŽãããç 究ã¯ãã±ã³ã»ãã³ããœã³ã®Trusting Trustã«é¢ããReflectionsã§ãã 圌ã¯ããœãŒã¹ã³ãŒãã«ãªããã°ãUnixã«è¿œå ã§ããã³ã³ãã€ã©ã®ããã¯ã«ã€ããŠèª¬æããŸããã
å ¬æŒ
ããªãã«ã¯èªç¶ãªæèœããããŸããããªãã¯éåžžã«è€éãªãããã¯ã説æããããšãã§ããŸãã ã©ããã£ãŠããã®ïŒ
å®ã¯ãããã©ãŒãã³ã¹ã«é¢ããæ¬ãããããèªãã§ããŸããé©åãªæºåæ¹æ³ãå®éã®ããã©ãŒãã³ã¹æ¹æ³ãªã©ã§ãã ãã¹ãŠã®æ¬ã§ãã¡ã¢ãä»ã®åæ§ã®ãã®ããšãããšããå§ãããŸã-ãããããã®ã¢ãããŒãã¯ç§ã«ã¯ããŸããããŸããïŒ
ããã©ãŒãã³ã¹ã®æºåããããšããMac OSçšã®Omnigraffleã®ãããªãã¯ã€ãããŒããŸãã¯ãŠãŒãã£ãªãã£ã䜿çšããã®ã奜ãã§ãã ã¢ã€ãã¢ãæžãããŠããå°ããªé·æ¹åœ¢ããå§ããŸãã ãã®åŸã察å¿ããã¢ã€ãã¢ãç·ã§ã€ãªããŸãã ããšãã°ãããã©ãŒãã³ã¹ãRubyã«é¢é£ããŠããå Žåã¯ã話ãããããšããã¹ãŠæžãçããŸãã ãã®åŸãããã€ã³ããããã³ã°ãã®ããã«ãããããæ¥ç¶ããŸãã 確ãã«ãæåã°ã©ããååŸããŸãã
ãã®åŸãçŽã®äžã§é¢çœãã¹ããŒãªãŒãäœã£ãŠãåŸãããã°ã©ãã«æ²¿ã£ãŠæ©ããŸãã ãã¡ãããå¿ ãããã¢ã€ãã¢ãæŽçãããé çªã§ã¯ãããŸããã
ã€ãŸãããã¯ãã«ã«ã©ã€ã¿ãŒã®ãããªãã®ã§ããïŒ
ã¯ããç§ã¯ãã®èª¬æã奜ãã§ãïŒ
ã©ã ãèšç®ã®ãããªé£ãããããã¯ãèå³æ·±ãã¹ããŒãªãŒã«å€ããããšã¯èžè¡ã§ãã 80幎åã«æžããããã®ãããã¯ã«é¢ããå ã®ç§åŠçç 究ãèªãããšãããšãå€ãã®äººãç®ã倱ã£ããšæããŸãã
ããã©ãŒãã³ã¹ãæåãããç§keyã¯ãèªåã§ç®ãçããããšã ãšæããŸãã ããªããäœãèšã£ãŠããã®ããããªãèªèº«ã«ãšã£ãŠäœããããŸãé¢çœããªããããã¯èŽè¡ã®æ®ãã®éšåã«èå³ãã²ãããšãå€æããŸãã å匷äžã«ææã«ã©ãã»ã©ã²ã©ãå調ãªå£°ã§äŒã£ãããåç¥ã§ããïŒ ããã¯éããªææã§ãã ãã®å¿ããããªãçµéšã®åŸãç§ãæŒãããªããè¬åž«ã®ããã«ã¯æ±ºããŠãããªããšæ±ºããŸããã ããã©ãŒãã³ã¹ã®ããã®ããããã¹ãŠã®æºå-ããã¯ãã¡ããè¯ãããšã§ãããå©ãã«ã¯ãªããŸããã話ããšãã¯ããªãã®ç®ã®çãããéèŠã§ãã
Rspecã§æå®
ããæŒå¥ããäºå®ã¯ãããŸããïŒ
1æã«ãç§ã®é è³ã«ã€ããŠã Given / When / Thenãã¬ãŒã ã¯ãŒã¯ã«ã€ããŠã話ããŸãã ããã¯ç§ã®ãæ°ã«å ¥ãã®åã§ãããã¹ããæžããã³ã«ããã¬ãŒã ã¯ãŒã¯ã䜿çšããŸããããã¯ãç§ã®èããéåžžã«ãšã¬ã¬ã³ãã«è¡šçŸããŠããããã§ãã ããã«ã€ããŠã¯CodeMashã§èª¬æããŸãã
ãã®ãã¬ãŒã ã¯ãŒã¯ã«ã¯ãBDDã®å²åŠãšå ±éç¹ããããŸããïŒ ãã¥ãŠãªã¯ã©ãã§ããïŒ ãŸãã¯ãåã3ã€ã®ããŒã¯ãŒãã䜿çšããŠãããšããäºå®ã¯åãªãå¶ç¶ã§ããïŒ
ããã¯åãªãå¶ç¶ã§ãããç§ã®ãã¬ãŒã ã¯ãŒã¯ã¯Cucumberãšã¯é¢ä¿ãããŸããããGiven / When / Thenã䜿çšããã¢ãããŒãã§ã¯æ¬åœã«æ°ã«å ¥ã£ãŠããŸãã
Rspec-Givenã䜿çšãããšã次ã®ããã«ç°¡åã«æå®ã§ããŸããããã¯äžãããããã®ã§ããã¹ãããã³ãŒãã以äžã«ç€ºããŸããããã¯ãã¹ããåæ Œããããã«åœãŠã¯ãŸããŸãã ç§ã®æèŠã§ã¯ãããã¯ãã¹ããæžãçŽ æŽãããæ¹æ³ã§ãã Test :: UnitïŒããŒã¿ãäžãããããšãã§ããåæ§ã®ã¢ãããŒãã䜿çšããŸãããããã«ãã¹ãã³ãŒãããããããã«ãã¹ãèªäœããããŸãã ããããTest :: UnitãRspecãå¿ èŠãªã¡ãœãããæäŸããŠããªãããããããšã¬ã¬ã³ããªãœãªã¥ãŒã·ã§ã³ãèŠã€ããããšããŸããã
çŽ2ã3幎åãç§ã¯ãã®åé¡ãæ¯ãè¿ããã¢ã€ãã¢ãçŽã«æžããŸããã åœæãç§ã¯ããã·ã¥ãã«ã§éå¬ãããRuby Hoedownã«ã³ãã¡ã¬ã³ã¹ã«åå ããŠããŸããã ãã®çŽåããè¿æã®éçºè ã«æž¡ããŠããã£ãŒãããã¯ãšæèŠãéããŸããã ãžã§ãŒãªãã©ã€ãšã³ã¯ç§ã«åãçŽãããå¥ã®ãã¹ããã¬ãŒã ã¯ãŒã¯ãæžãã€ããã¯ãªãã®ã§ããïŒããšèšããŸããã
Rspecã§éåžžã«ã·ã³ãã«ã§éåžžã«æ©èœããå®è£ ã«åºäŒããŸã§ãç§ã¯1ã2幎éã¢ã€ãã¢ãè©ŠããŸããã Rspecããç§ãæãã§ãããã®ãå®è£ ããã®ã«ååãªæè»æ§ãšæœè±¡æ§ãåããŠããã®ã¯çŽ æŽãããããšã§ãã ãã®çµæãRspecã®äžã«å°ããªã©ã€ãã©ãªãäœæãããŸããã ãããã£ãŠããã¹ããããæ確ã«ããããšã§ãRspecã§èšè¿°ããŠããéã«åŸãç¥èã䜿çšã§ããŸãã
翻蚳è ããïŒãã©ã€ããŒãã¡ãã»ãŒãžã䜿çšããŠãã°ãå ±åããŠãã ããããã°ã¯ããã«ä¿®æ£ãããŸãã
åç §ïŒ
- ãžã ã®äŒèšïŒ en.wikipedia.org/wiki/Jim_Weirich
- GoRuCo 2012ã§ã®Jimã®ã¹ããŒãïŒrakeãŠãŒãã£ãªãã£å°çšïŒïŒ www.confreaks.com/videos/988-goruco2012-power-rake
- ãžã ã¯ãRuby Conference 2012ïŒY Not-é¢æ°åããã°ã©ãã³ã°ã®åéºïŒã§è¬æŒããŠããŸãïŒ www.confreaks.com/videos/1287-rubyconf2012-y-not-adventures-in-functional-programming
- Rspec-Givenã©ã€ãã©ãªïŒ github.com/jimweirich/rspec-given
- æçµã³ãããïŒ github.com/jimweirich/wyriki/commit/d28fac7f18aeacb00d8ad3460a0a5a901617c2d4