ã¯ããã«
æ¬è¨äºã¯ãã¹ãé§åéçº Advent Calendar 2021ã®3æ¥ç®ã®è¨äºã§ãã8æã«æ¸ããè¨äºã§ãããæ°ä½ã§ã¯ããã¾ããããã¢ããã³ãã«ã¬ã³ãã¼ãã¹ã«ã¹ã«ãªã®ã§ç©´åããã¾ãã
ã¢ããã³ãã«ã¬ã³ãã¼ã¸ã®ãåå ããå¾ ã¡ãã¦ããã¾ãï¼
ãã®è¨äºãæ¸ããç®çãèªãã§ããããã対象
æ¸ç±ããã¹ãé§åéçºãã«ã¯ä¸è¨ã®ããã«æ¸ããã¦ãã¾ãã
ãã¹ãé§åéçºã®è¯ããå¼·ã¿ã¯æãåããã°åããã¾ãã
çµæã§ã¯ãªãéç¨ã«æ¬è³ªãããã¾ãã
ãã¹ãé§åéçºã¨ã¯ç·´ç¿ã«ãã£ã¦ç²å¾ã§ããæè¡ã§ãã
ã§ããããã®ç·´ç¿ã®é¡æã¨ãã¦ä½ãããã®ããç¥ããªã人ãå¤ãããããã¾ããã
ããã§æ¬è¨äºã§ã¯ããã¹ãé§åéçºï¼ä»¥ä¸ãTDDï¼ã®ç·´ç¿é¡æã«ãªããããªãã®ãç´¹ä»ãã¦ããã¾ããã¾ããç§ãªãã®é¡æã®ãã¤ã³ããåããã¦ç´¹ä»ãã¾ãã
ãFizzBuzzã®æ¬¡ã«ä½ããããâ¦ï¼ãã¨æ©ãã§ãã人ã«åèã«ãã¦ããããã°ã¨æãã¾ãã
ç®æ¬¡
- ã¯ããã«
- ãã®è¨äºãæ¸ããç®çãèªãã§ããããã対象
- ç®æ¬¡
- é¡æãç´¹ä»ããåã«ããé¡æã®ä½¿ãæ¹ã
- åºæ¬åé¡
- è¨è¨ã¾ã§è¸ã¿è¾¼ãåé¡
- ããã ã¢ããã§åãçµãåé¡
- ããããã¦ã³ã§åãçµãåé¡
- ã¬ã¬ã·ã¼ã³ã¼ãã®ãªãã¡ã¯ã¿ãªã³ã°ã®åé¡
- ãããã«ããåèæç®ãªã©ã
é¡æãç´¹ä»ããåã«ããé¡æã®ä½¿ãæ¹ã
TDDã§é¡æãé¸ã¶ãã¤ã³ãã¯ä»¥ä¸ã®2ã¤ãããã¾ãã
- ããã°ã©ãã³ã°è¨èªãTDDã«å¯¾ããæ £ãï¼å°ãªãorå¤ãï¼
- é¡æã®é£æ度ï¼ä½ãoré«ãï¼
TDDãç·´ç¿ããã«ã¯ããã®2ã¤ã®ãã©ã³ã¹ãèããæ¹ãè¯ãã§ãã
ä¾ãã°ãæ°ããå¦ã¶ããã°ã©ãã³ã°è¨èªã®TDDãç·´ç¿ãããã¨æã£ãããç°¡åãªé¡æãé¸ã³ã¾ãããã
ä¸æ¹ãããç¨åº¦æ¥åã§ã使ã£ã¦ããããã°ã©ãã³ã°è¨èªã®TDDãç·´ç¿ãããã¨æã£ãããå°ãå¿ç¨ã®é¡æã§ãè¯ãããããã¾ããã
åºæ¬åé¡
ããããã¯ãé¡æã«ãªããããªãã®ãã©ãã©ãç´¹ä»ãã¦ããã¾ãã
ã¾ãã¯åºæ¬åé¡ã§ããæ°ããããã°ã©ãã³ã°è¨èªã使ã£ãããåãã¦TDDãç·´ç¿ãã¦ã¿ãæã¯ããã®åºæ¬åé¡ã«æ¸ãã¦ããé¡æããå§ããã¨è¯ãã§ãããã
é¡æ1. FizzBuzz
ã¿ããªå¤§å¥½ãFizzBuzzã§ãã
ãã®é¡æãç¨ãã¦ãt_wadaãããã©ã¤ãã³ã¼ãã£ã³ã°ãã¦ããè¬æ¼ãæ¢ã«Youtubeã«ä¸ãã£ã¦ã¾ãããã®åç»ãè¦ãªãããåçµãã¦ã¿ãã®ãè¯ãããããã¾ããã
é¡æ2. ãã¼ãæ°åå¤æ
ãã¼ãæ°åãæ°å¤ã«å¤æããããã°ã©ã ã§ãã
ä¾ãã°ãä¸è¨ã®ããã«ãªãã¾ãã
âå
¥åå¤
MCMXLIV
âåºåå¤
1944
æ¯åFizzBuzzã°ããã§é£½ãã人åãã§ãã
ãã ããåç´ä½æ¥ãå¤ãçºçãããããéä¸ã§é£½ããå¯è½æ§ãããã¾ãã
é¡æ3. ãã¦ãªã³ã°
ãã¦ãªã³ã°ã®ç¹æ°ãç®åºããããã°ã©ã ã§ãã
ä¾ãã°ãä¸è¨ã®ããã«ãªãã¾ãã
âå ¥åå¤ X 12 9/ 12 â»ãXããã¹ãã©ã¤ã¯ãã/ããã¹ã㢠âåºåå¤ 30
æåã¯åç´ãªè¶³ãç®ããã£ãå¾ã«ãã¹ãã©ã¤ã¯ãã¹ãã¢ã®è¨ç®ã«ã¤ãã¦ã®ä»æ§ã追å ãã¦ããå½¢ã«ãªãã§ãããã
é¡æ4. æ ¼åç¹
x座æ¨ã¨y座æ¨ãããªãæ ¼åç¹ã«ã¤ãã¦ã®åé¡ã§ãã
å ¥è©¦æ°å¦ã®ããã«å°ããããããªé çªã§åºé¡ããã¦ããã®ã§ãã¹ããããã¤ã¹ãããã§TDDãç·´ç¿ãããã¨ãã§ãã¾ãã
ãã®é¡æãç¨ããããã®ããããã¨ã¨ã¼ã¾ãããã®ãã¢ããåç»ãæ¢ã«Youtubeã«ä¸ãã£ã¦ã¾ãããã®åç»ãåèã«ãã¦ãã ããã
è¨è¨ã¾ã§è¸ã¿è¾¼ãåé¡
åºæ¬åé¡ããå°ãçºå±ããåé¡ã§ããè¨èªãTDDã«å°ãæ £ãã¦ãã人ã解ãã¦ã¿ãã¨è¯ãã§ãããã
é¡æ5. ç«ææ¢ç´¢æ©
åæä½ç½®(x,y)ã¨ã¹ãã¼ã¸ã®åºããå®ç¾©ããå¾ãã90°å³å転ãã90°左å転ããåé²ããå¾é²ãã®æ示ãå ã«ãç¾å¨ä½ç½®(x',y')ãæ±ããåé¡ã§ãããé¡æ4. æ ¼åç¹ãã®å¿ç¨ã®ãããªä½ç½®ä»ãã§ãã
ç«æã¯çä½ãªã®ã§ãã¹ãã¼ã¸ã®åºãã(5,5)ã®åºãã®æãåæä½ç½®(1,1)ã®ååãã§90°左å転ãã¦åé²ããã¨ãç¾å¨ä½ç½®ã¯(5,1)ã«ãªãã®ããã¤ã³ãã§ãã
ä¾ãã°ãä¸è¨ã®ããã«ãªãã¾ãã
âå ¥åå¤ åæä½ç½®(1,3)ãã¹ãã¼ã¸ã®åºã(5,5)ãååã ã90°左å転ããåé²ãã90°å³å転ããåé²ã âåºåå¤ ç¾å¨ä½ç½®(5,4)ãååã
é¡æ6. ãã¼ã«ã¼
ãã¼ã«ã¼ã®ææã®å½¹å¤å®ãªã©ãè¡ãåé¡ã
ä¸è¨ã®TDDBC Sendaiã®åºé¡ãã¹ããããã¤ã¹ãããã§åãããããã®ã§ãå ¥åºåä¾ã«ã¤ãã¦ã¯ãã¡ããè¦ã¦ãã ããã
é¡æã«ã馴æã¿ãããã®ã§ãåãçµã¿ãããããããã¾ããã
ããã ã¢ããã§åãçµãåé¡
ä¸å®ã®ã«ã¼ã«ã«åºã¥ãã¦ããã®ã§ãã¾ãã¯å°ããç¯å²ã§èãã¦ãã ãã ãã¨ãã®ç¯å²ãåºãã¦è§£ãã¦ããå½¢å¼ã®åé¡ã§ãã
é¡æ7. ã©ã³ã°ãã³ã®ã¢ãª
æ£æ¹å½¢ãæ·ãè©°ããããå°é¢ã«ã¢ãªããã¦ãä¸è¨ã®ã«ã¼ã«ã«å¾ã£ã¦ã¢ãªãé²ãåé¡ã§ãã
- ç¾å¨ä½ç½®ãç½ãã¹ã ã£ããé»ãã¹ã«å¤æ´ãã¦å³ã«é²ã
- ç¾å¨ä½ç½®ãé»ãã¹ã ã£ããç½ãã¹ã«å¤æ´ãã¦å·¦ã«é²ã
ã·ã³ãã«ãªã«ã¼ã«ã§ãããä¸è¨ç»åã®ããã«é¢ç½ãåãã«ãªãã¾ãã
ããã°ã©ã å ¥åºåä¾ã¯ä¸è¨ã®ããã«ãªãã¾ãã
âå ¥åå¤ ã¹ãã¼ã¸ã®åºã(3,3)ãåæä½ç½®(2,2) âåºåå¤ï¼â»ã-ããç½ãã¹ãã*ããé»ãã¹ï¼ 0 --- -a- --- 1 -a- -*- --- 2 -*a -*- --- 3 -** -*a --- 4 -** -a* --- 5 -** --* -a-
é¡æ8. ã©ã¤ãã²ã¼ã
æ£æ¹å½¢ã«æ·ãè©°ããå°é¢ã«å¯¾ãã¦ãæ¡ä»¶ã«ãã£ã¦ã»ã«ãçãããæ»ãã ããã¾ãã æ¡ä»¶ã¯ä¸è¨ã®éãã§ããããã§ãããé£æ¥ããã»ã«ãã¨ã¯ãèªèº«ã®ã»ã«ã®ä¸ä¸å·¦å³æãã®8ã¤ã対象ã§ãã
- æ»ãã§ããã»ã«ã«é£æ¥ããçããã»ã«ãã¡ããã©3ã¤ããã°ã次ã®ä¸ä»£ãèªçãããï¼èªçï¼
- çãã¦ããã»ã«ã«é£æ¥ããçããã»ã«ã2ã¤ã3ã¤ãªãã°ã次ã®ä¸ä»£ã§ãçåãããï¼çåï¼
- çãã¦ããã»ã«ã«é£æ¥ããçããã»ã«ã1ã¤ä»¥ä¸ãªãã°ãéçã«ããæ»æ» ãããï¼éçï¼
- çãã¦ããã»ã«ã«é£æ¥ããçããã»ã«ã4ã¤ä»¥ä¸ãªãã°ãéå¯ã«ããæ»æ» ãããï¼éå¯ï¼
ãã®é¡æãé¢ç½ãåãã«ãªãã¾ãã
ããã°ã©ã å ¥åºåä¾ã¯ä¸è¨ã®ããã«ãªãã¾ãã
âå ¥åå¤ ã¹ãã¼ã¸ã®åºã(5,5)ãåæçåã»ã«(2,3)(3,3)(4,3) âåºåå¤ï¼â»ã-ããæ»æ» ã»ã«ãã*ããçåã»ã«ï¼ 0 ----- ----- -***- ----- ----- 1 ----- --*-- --*-- --*-- ----- 2 ----- ----- -***- ----- -----
ããããã¦ã³ã§åãçµãåé¡
éä¸ã§ä»æ§ã追å ããã¦ããåé¡ã§ããåé¡ãé²ããã«å¾ã£ã¦ã³ã¼ããå¤åãã¦ããã¯ãã§ãã
é¡æ9. Potter
ã«ã¼ã«ã«å¾ã£ã¦ãåãã·ãªã¼ãºã¾ã¨ãè²·ãã«ããå¤æ®µã®å²å¼ãè¡ãããæããã®æå®å¤ãæ±ããåé¡ã§ãã
ã«ã¼ã«ã¯ä¸è¨ã®éãã§ãã
- 1å1000å
- åãã·ãªã¼ãºã®å¥ã®å·»ã2åè²·ãã¨ããããã5%å¼ã
- åãã·ãªã¼ãºã®å¥ã®å·»ã3åè²·ãã¨ããããã10%å¼ã
- åãã·ãªã¼ãºã®å¥ã®å·»ã4åè²·ãã¨ããããã15%å¼ã
- åãã·ãªã¼ãºã®å¥ã®å·»ã5åè²·ãã¨ããããã20%å¼ã
ä¾ãã°ãä¸è¨ã®ããã«ãªãã¾ãã
âå ¥åå¤ ç¬¬1å·»ã1åã第2å·»ã1å âåºåå¤ (1000*2)*0.95=1900å âå ¥åå¤ ç¬¬1å·»ã2å âåºåå¤ 1000 * 2 = 2000å â»åãå·»ãªã®ã§å²å¼ãªã âå ¥åå¤ ç¬¬1å·»ã2åã第2å·»ã1å âåºåå¤ (1000*2)*0.95+1000=2900å âå ¥åå¤ ç¬¬1å·»ã2åã第2å·»ã1åã第3å·»ã1å âåºåå¤ (1000*2)*0.95+(1000*2)*0.95=3800å (1000*3)*0.9+1000=3700å â»ï¼ç¬¬1å·»ï¼ç¬¬2å·»ï¼ã®5%å¼ãï¼ï¼ç¬¬1å·»ï¼ç¬¬3å·»ï¼ã®5%å¼ãã®ãã¿ã¼ã³ã¨ã ï¼ç¬¬1å·»ï¼ç¬¬2å·»ï¼ç¬¬3å·»ï¼ã®10%å¼ãï¼ç¬¬1å·»ã®ãã¿ã¼ã³ãåå¨ãã
é¡æ10.LCD表示
æ°å¤ãä¸ããããã¨ãããã«å¯¾ããLCD表示ï¼ãã¸ã¿ã«è¡¨ç¤ºï¼ãæ±ããåé¡ã§ãã
ä¾ãã°ãä¸è¨ã®ããã«ãªãã¾ãã
âå ¥åå¤ 2 âåºåå¤ _ _| |_
åé¡ãé²ãã¨ãéä¸ã§ä»æ§å¤æ´ãçºçãâ¦ã¨ããã®ããã½ããã¿ãã¬é²æ¢ã®ããã«ãããã«ã¯è¨è¼ãã¾ããã
é¡æ11.èªå販売æ©
èªå販売æ©ã®åããããã°ã©ãã³ã°ããåé¡ã§ãã
é¡æï¼ プログラミングのお題: 自動販売機 (設計進化重視バージョン) · GitHub
ä»æ§ãæ示ããã¦ããå½¢å¼ãªã®ã§ãåãªãTDDã§ã¯ãªããcucumberãªã©ãç¨ããATDDã§è§£ãã®ããªã¹ã¹ã¡ã§ãã
ã¾ããã®é¡æãå ã«ãTODOãªã¹ãã®æ´çã®ä»æ¹ã«ã¤ãã¦èª¬æããçºè¡¨ã以åã«è¡ãã¾ããã
ã¬ã¬ã·ã¼ã³ã¼ãã®ãªãã¡ã¯ã¿ãªã³ã°ã®åé¡
ããããã¯æ¢åã®ã³ã¼ãï¼ãã¹ãã³ã¼ãç¡ãï¼ã«å¯¾ãã¦ããªãã¡ã¯ã¿ãªã³ã°ããã¦ããåé¡ã§ãã
é¡æ12. ããã¹ã²ã¼ã
ããã¹ã®ç¹æ°è¡¨ç¤ºãé¡æã¨ããåé¡ã§ãã詳ããã¯ããªã³ã¯å åç §ã
åãä»æ§ã«å¯¾ãã¦3ãã¿ã¼ã³ã®å®è£ ãããã®ã§ã1ã¤ã®è¨èªã«å¯¾ãã¦ãªãã¡ã¯ã¿ãªã³ã°ã3åç·´ç¿ã§ãã¾ãã
ããã¹ã®è¨ç®æ¹æ³ãç¥ã£ã¦ããã°ãä»æ§ã®èªã¿è¾¼ã¿ãè¡ãå¿ è¦ããªããããã«åé¡ã«åãçµããã®ã§ä¾¿å©ãªé¡æã§ãã
ã½ã¼ã¹ã«ã¯ãã¹ãã³ã¼ããæ¢ã«ããã¾ãããæ¢åã®ãã¹ãã³ã¼ããæ¶ãã¦ãã¬ã¬ã·ã¼ã³ã¼ãã®ãªãã¡ã¯ã¿ãªã³ã°ã®ç·´ç¿ã¨ãã¦ä½¿ãã®ããªã¹ã¹ã¡ã§ãã
å æ¥å ¬éããæ¸ç±ããã¹ãã³ã¼ãã®æ³¨å ¥ããå§ããã¬ã¬ã·ã¼ã³ã¼ãã®ãªãã¡ã¯ã¿ãªã³ã°ãã§ã¯ããã®é¡æã®ãªãã¡ã¯ã¿ãªã³ã°éç¨ãè¼ãã¦è§£èª¬ãã¦ãã¾ãã
é¡æ13. GildedRose
ä»æ§ããã£ã¦é¢ç½ãåé¡ã§ãã詳ããã¯ããªã³ã¯å åç §ã
ä»å¹´ã®JaSST Tokyoã§ãé¡æã«ãã¦ãå®éã«ãªãã¡ã¯ã¿ãªã³ã°ããæ§åãã©ã¤ãã³ã¼ãã£ã³ã°ãã¾ããã
ã¾ããå æ¥å ¬éããæ¸ç±ããã¹ãã³ã¼ãã®æ³¨å ¥ããå§ããã¬ã¬ã·ã¼ã³ã¼ãã®ãªãã¡ã¯ã¿ãªã³ã°ãã§ã¯ããã®é¡æã®ãªãã¡ã¯ã¿ãªã³ã°éç¨ãè¼ãã¦è§£èª¬ãã¦ãã¾ãã
é¡æ14. trivia
ã¯ã¤ãºã²ã¼ã ãé¡æã¨ããåé¡ã§ãã詳ããã¯ãªã³ã¯å åç §ã
ãã®é¡æããªãã¡ã¯ã¿ãªã³ã°ãã¦ããåç»ãæ¢ã«Youtubeä¸ã«ãã£ãããã¾ãã
ãããã«ããåèæç®ãªã©ã
TDDã®é¡æã«ãªããããªãã®ããã£ã¨ç´¹ä»ãã¦ã¿ã¾ããã
ãèªèº«ã®ããã°ã©ãã³ã°è¨èªã®ã¹ãã«ã¬ãã«ãTDDã®ã¹ãã«ã¬ãã«ã«åããã¦ãé©åãªé£æ度ãã¤æ¥½ããããªåé¡ãé¸ãã§åãçµãã§ã¿ã¦ãã ããï¼
ããããä»ã®é¡æãæ¢ãããï¼ãã¨ãã人ã¯ãä¸è¨ã®ãµã¤ãããªã¹ã¹ã¡ã§ãã
TDD Boot Camp(TDDBC)
ããããTDDã«é¢ãã¦æ¥æ¬ã§ä¸çªå å®ãã¦ãããµã¤ããã³ãã¥ããã£ã§ãã
å¹´ã«æ°åãã¯ã¼ã¯ã·ã§ããå½¢å¼ã®ã¤ãã³ããéå¬ãã¦ãã¾ãã
æ¬æä¸ã«ç´¹ä»ãããt_wadaããã®ã©ã¤ãã³ã¼ãã£ã³ã°åç»ãããã®ããããã¨ã¨ã¼ã¾ãããã®ãã¢ããåç»ã¯ãã®ã³ãã¥ããã£ã®ã¤ãã³ãã«ãããã®ã§ãã
All Kata
ä»åç´¹ä»ããé¡æã®å¤ããè¼ã£ã¦ãããµã¤ãã§ãã
Kataã®ç¨éãã¨ã«Topicãåããã¦ããã®ã§ãè¡ãããå 容ãå ã«é¡æãæ¢ãã«ãæé©ã§ãã
Coding Dojo
ä»åç´¹ä»ããé¡æã®å¤ããè¼ã£ã¦ãããµã¤ããã®2ã§ãã
All Kataã«æ¯ã¹ãã¨ãç®çã«ãã£ãé¡æãæ¢ãã®ã¯å°ãé£ããã§ãã
Cyber Dojo
ãªã³ã©ã¤ã³ä¸ã§TDDãç·´ç¿ã§ãããµã¤ãã§ãã
ç¾æç¹ã§58種é¡ã®åé¡ãç¨æããã¦ãã¾ãã
ãã ãä¸è¦§ã«ãªã£ã¦ããã®ã§ãé£æ度ãç®çã«æ²¿ã£ããé¡ãªã®ãã¯åããã¥ããããã
Philippe Bourgau's XP Coaching Blog - A coding dojo exercises plan towards refactoring legacy code
é¡æéã§ã¯ãªãã§ãããä»åã®ããã°ãæ¸ãã«ããã£ã¦å¤§ãã«åèã«ãããµã¤ãã§ãã
é¡æãåºåã£ã種å¥ã®ä»æ¹ï¼ããã ã¢ãããããããã¦ã³ãªã©ï¼ã¯ããã®ãµã¤ããåèã«ãã¾ããã
æå¾ã«ãæ¸ç±ããã¹ãé§åéçºãã®æç« ãããä¸åº¦è¼ãã¾ãã
ãã¹ãé§åéçºã®è¯ããå¼·ã¿ã¯æãåããã°åããã¾ãã
çµæã§ã¯ãªãéç¨ã«æ¬è³ªãããã¾ãã
ãã¹ãé§åéçºã¨ã¯ç·´ç¿ã«ãã£ã¦ç²å¾ã§ããæè¡ã§ãã
ãã²ãããããç·´ç¿ãã¦ãTDDã身ã«ä»ãã¦ãã ãããï¼