ã¢ããªã±ãŒã·ã§ã³ãéçºãããšããç§ãã¡ã¯åžžã«æ°ããã¢ãããŒããèšèªãæŠå¿µã«çŽé¢ããŠããŸãã ãããŠãç§ãã¡ã¯åžžã«ãæ³¢ã«ä¹ã£ãŠããã¹ãŠã®å€åãšåŸåãèæ ®ã«å ¥ããŠç«¶äºåãç¶æã§ããŸããïŒããšããçåãæ¥ãã§ããŸãã ç§ã®ãæ°ã«å ¥ãã®æ ç»ãã«ãµãã©ã³ã«ãã®ãã¬ãŒãºãæãåºããŠãã¡ãã£ãšèããŠã¿ãŸããã-æã«ã¯æ°ããæ³åã¯ãããŸãã-ãããå ã®çææ¹æ³ã§ãã
æã«é¢é£ãããã¹ãŠãã³ãŒãã«é©çšãããŸãã ã³ãŒãã«ã¯æ°ããæ³åŸã¯ãããŸããã éçºã®åºæ¬çãªèãæ¹ãæ確ã«ç解ããŠããã°ãæ°ããã¢ãããŒãã«ã§ããã ãæ©ãé©å¿ããããšãã§ããŸãã ãã®èšäºã§ã¯ãéçºã®è€éããèŠå¶ã§ããä»ã®3ã€ã®åºæ¬ååã«ã€ããŠèª¬æããŸãã ç§ã¯ãã®åé¡ã«å¯Ÿããç§ã®ããžã§ã³ãå ±æããŸããããã¯ããªãã®æ¥ã ã®ä»äºã«åœ¹ç«ã€ããšãé¡ã£ãŠããŸãã
也ç¥-ç¹°ãè¿ããŠã¯ãããŸãã
ãã®ååã¯éåžžã«éèŠãªã®ã§ãç¹°ãè¿ãã¯å¿ èŠãããŸããïŒ éåžžãããã¯æªåé«ãæ¬ã å®çšçãªããã°ã©ã㌠ãã«æåã«ç»å Žããé åèªDRYã«ãã£ãŠèšåãããŸãããæŠå¿µèªäœã¯é·ãéç¥ãããŠããŸããã ãœãããŠã§ã¢ã®æå°éšåãæããŸãã
倧èŠæš¡ãªãããžã§ã¯ããéçºããå Žåãå®è£ å šäœã®é床ã®è€éãã«å¯ŸåŠããå¿ èŠããããŸãã 人ã ã¯è€éãªã·ã¹ãã ã®ç®¡çã«ããŸã察å¿ã§ãããç¹å®ã®åé¡ã«å¯Ÿããç°åžžãªè§£æ±ºçãèŠã€ããããšãã§ããŸãã è€éãã軜æžããæãç°¡åãªãœãªã¥ãŒã·ã§ã³ã¯ãã·ã¹ãã ã管çããããå°ããªç¬ç«ããã¢ãžã¥ãŒã«ã«åå²ããããšã§ãã
è€éãã軜æžããæãç°¡åãªæ¹æ³ã¯ãã·ã¹ãã ã管çå¯èœãªéšåã«åå²ããããšã§ãã
ããšãã°ãCMSã®äžéšã¯ããŠãŒã¶ãŒç®¡çãæ åœããã³ã³ããŒãã³ãã§ãã ãã®ã³ã³ããŒãã³ãã¯ãã»ãã¥ãªãã£ã·ã¹ãã ã®ä»ã®ã³ã³ããŒãã³ããšé£æºã§ããã¢ã¯ã»ã¹ã¬ãã«ã®ç®¡çãªã©ãä»ã®ã³ã³ããŒãã³ãã«åå²ã§ããŸãã
ãã®ããã«ã·ã¹ãã ãããæ·±ãã³ã³ããŒãã³ãã«åå²ããããšã§ãã·ã¹ãã ã®åéšåãæ確ã«å®çŸ©ãããã¢ã¯ã·ã§ã³ãæ åœããããã«ãªããŸãã ãã®ãããªã¢ã¯ã·ã§ã³ã¯ãã¯ã©ã¹ã«ç·šæã§ããŸãã ã¯ã©ã¹ã«ã¯ã¡ãœãããšããããã£ãå«ãŸããŸãã ã¡ãœããã¯ãã·ã¹ãã ã®ããžãã¹ããžãã¯ãæ§ç¯ããã¢ã«ãŽãªãºã ãè¡šããŸãã
DRYååã§ã¯ããã®ãããªæ å ±ãã³ãŒãã«1åã ã衚瀺ãããããšãå¿ èŠã§ãã
ãããã®ããŒãã«ã¯1ã€ã®ã¢ã€ãã¢ãå¿ èŠã§ãã
æ å ±ïŒããŒã¿ïŒãšãã®è¡šç€ºã®éãã«æ³šæããŠãã ããã CMSã§ããŒã¿ããŒã¹ãžã®æ¥ç¶ãæŽçãããšãç®çã®ãã©ã€ããŒãçæããæ¿èªãåãå ¥ããæ¥ç¶ãžã®ãã€ã³ã¿ãŒãå€æ°ã«ä¿åããã³ãŒããäœæãããŸãã ããã§ãã³ãŒãã¯ãäœãïŒæ¥ç¶ïŒãååŸããæ¹æ³ã説æããæ å ±ã§ãã æ¥ç¶ãã€ã³ã¿ãæã€å€æ°ã¯ãã·ã¹ãã å ã®ã©ãã§ã䜿çšã§ãããã®æ å ±ã®è¡šçŸã§ãã çªç¶æ¿èªãå€æŽãããå Žåããã¬ãŒã³ããŒã·ã§ã³ã§ã¯ãªããããŒã¿ãã®ã¿ãå€æŽããå¿ èŠããããŸãã
åããŒã¿ã«ã¯ãã·ã¹ãã ã®æ確ã§ä¿¡é Œã§ãããã¥ãŒãå¿ èŠã§ãã
çæ³çãªã·ã¹ãã ã§ã¯ãããžãã¹ããžãã¯ã®åéšåã¯ããã®ããŒã¿ãè¡šçŸïŒã¯ã©ã¹ã®å€æ°ãŸãã¯ããããã£ïŒã«ã«ãã»ã«åããŸãã ãã®å€æ°ã¯ãã¢ãŒããã¯ãã£ã®äžéšãæ åœããã¯ã©ã¹ã«ã«ãã»ã«åãããŸãã ã¯ã©ã¹ã¯ãã·ã¹ãã ã®æ©èœã®äžéšã®å®è£ ã§ããã³ã³ããŒãã³ãã®äžéšã§ãã
ãããã£ãŠãã·ã¹ãã ã®æäžäœãã€ãŸãæ©èœå®è£ ã®è€éãªã»ããã«å°éã§ããŸãã ãã®çµç¹ã®ã¢ãããŒãã¯ã¢ãžã¥ãŒã«åŒã¢ãŒããã¯ãã£ãšåŒã°ããDRYã¯ãã®éèŠãªéšåã§ãã
ã¢ãŒããã¯ãã£ã®ã¿ã¹ã¯ã¯è€éãã管çããããšã§ã
ç¹°ãè¿ãã®ãããã
ç¹°ãè¿ããæé€ããæ¹æ³ã¯ããªããããŸãã ãã³ããšããŒãã¹ã¯ãã³ãŒããžã§ãã¬ãŒã¿ãŒãšããŒã¿å€æãæäŸããŠããŸãã ããããDRYã¯æçµçã«ãè¡šçŸãéããŠããžãã¯ãæäŸãããšããå²åŠã§ãã
ã¢ããªã±ãŒã·ã§ã³ã®åéšåã¯ãã¬ãŒã³ããŒã·ã§ã³ã«ããããšãã§ããåéšåã¯ç¹å®ã®ããžãã¯ãæäŸããŸããèš±å¯ç®¡çã¢ãžã¥ãŒã«ã¯ãŠãŒã¶ãŒãžã®ã¢ã¯ã»ã¹ãæäŸãããŠãŒã¶ãŒã¯ã©ã¹ã«ã¯çŸåšã®ãŠãŒã¶ãŒã«é¢ããæ å ±ãšãã®ããããã£ã»ãããå«ãŸããŸãã ãã®ã¯ã©ã¹ã¯ãããŒã¿ããŒã¹ãã¥ãŒãä»ããŠããŒã¿ãåãåããŸãã
DRYã¯ãããžãã¯ãè¡šçŸã«å解ããå²åŠã§ãã
DRYãšã¢ãžã¥ã©ãŒã¢ãŒããã¯ãã£ã«ã¯ãé©åãªèšç»ãå¿ èŠã§ãã ãã¥ãŒã®éå±€ãé©åã«ç·šæããã«ã¯ãã·ã¹ãã ããé£æºããŠæ©èœããå°ããªéšåã«åå²ããŸãã 倧èŠæš¡ãªãããžã§ã¯ãã管çããå¿ èŠãããå Žåã¯ãDRYã䜿çšããŠã³ã³ããŒãã³ãã§ãããžã§ã¯ããæŽçããããšãæ€èšããå¿ èŠããããŸãã 次ã®ã«ãŒã«ã«åŸãããã«ããŠãã ããã
- ã·ã¹ãã ã®å³ãäœæããèŠèŠçãªã³ã³ããŒãã³ãã«åå²ããŸãã è€éãªãããžã§ã¯ãã§ã¯ãã³ã³ããŒãã³ãããšã«ãã®ãããªéå±€ãå¿ èŠã«ãªãå ŽåããããŸãã
- é£æ¥ããã¬ãã«ã®å®è£ ïŒå ±éã·ã¹ãã ã®äžéšïŒã«åå ããŠããå Žåã¯ãUMLãã€ã¢ã°ã©ã ïŒãŸãã¯åæ§ã®ïŒã䜿çšããŠã¿ãŠãã ããã
- ã³ãŒããèšè¿°ããåã«ãã°ã©ãã£ãã¯ãã€ã¢ã°ã©ã ã«ããŒã¯ãä»ããã·ã¹ãã ã®ä»ã®ã³ã³ããŒãã³ãéã®åœ¹å²ã決å®ããŸãã
- ã³ãŒããã·ã¹ãã ã®ä»ã®éšåã«æäŸããé衚瀺ã«ããå¿ èŠãããè¡šçŸïŒãã©ã€ããŒã/ãããªãã¯ïŒãæ確ã«å®çŸ©ããŸãã
- ã³ãŒããã·ã¹ãã ã®ä»ã®è¡šçŸãšççµåãããŠããããšã確èªããŠãã ãã-ããŒããªã³ã¯ã¯ã¢ãŒããã¯ãã£å šäœã«éåžžã«æªã圱é¿ãäžããŸãã
ããŒã¿ããŒã¹ãã©ã€ããŒã¯ãå®éã®ãããžã§ã¯ãã«ä»ã®å€ãã®ã¬ãã«ã®ããžãã¯ãå«ããããšãã§ããããããã軜éãªäŸã§ãããŸããç¹ã«ææ°ã®èšèšãã¿ãŒã³ãèæ ®ãããšãããå°ããªã³ã³ããŒãã³ãã«åå²ã§ããé åãå€ããããŸãã ããããããªãããã éåãããšããŠããéèŠãªããšãå¿ããªãã§ãã ããïŒ
çªç¶ãã®ã³ãŒãããã§ã«æžãã/äŒã£ãããšãèªåèªèº«ã§ãšããããããããŠãèããŠãç¹°ãè¿ããªãã§ãã ããã
å®éã®ãããžã§ã¯ãã§ã¯ã100ïŒ DRYãéæããããšã¯ã»ãšãã©äžå¯èœã§ãã ããããé çªã«ãåãå ¥ããããªãã¬ãã«ã§é也ç¥ã§ããã管çãé£ãããããžã§ã¯ãããããããããŸãã ãããŠããããããã¯ããªããé©ãããã§ããã-ãã¹ãŠã®ãããžã§ã¯ãã®50ïŒ ã圌ãã®ã³ãŒããèŠãã°å€±æããŸãã
å€ãã®äººã¯ãæªãããã°ã©ããŒãæªãã³ãŒããæžããšèããåŸåããããŸãã ç§ã®çµéšã§ã¯ãããã¯ãããäŸå€ã§ãã åžžã«æªãã³ãŒãã¯ãäŒèšå£«ã«ãã£ãŠæžãããŠããããšãã»ãšãã©ã§ãã ããã§ããäŒæ¥ã®ããã»ã¹ç®¡çãäžé©åã«èšå®ãããšãäžæ£ãªã³ãŒããçæãããŸãã
äŸ
äŸãšããŠãã³ãŒãã®å質ãšãã®ç®¡çã«åé¡ãããäŒç€Ÿã«æè¡ã³ã³ãµã«ã¿ã³ããšããŠæåŸ ããããšæ³åããŠã¿ãŸãããã ã³ãŒããèŠããšãå€ãã®ããã¯ããããã³ãŒããDRYã§ã¯ãªãããšãããããŸããã ããã¯äžè¯ã³ãŒãã®æåã®çç¶ã§ãããåå ã§ã¯ãããŸããã ã³ãããã®å±¥æŽãèŠããšããããã®ããã¯ããããžã§ã¯ãã®æçµæ®µéïŒæéããã€ã«ã¹ããŒã³ïŒã§äœ¿çšãããå¯èœæ§ãé«ãããšãããããŸãã ã¹ããŒãªãŒãåæããåŸãèŠä»¶ã®ããã€ãã®å€æŽããããã®åããããã³ã°ã䌎ãããšãç解ããŸãã
ãŸãã«æªãã³ãŒãã¯ãæªãããã°ã©ããŒã«ãã£ãŠæžãããŸãã
åªããèšç»ã«ãã£ãŠåçŸæ§ãæé€ãããããšãèŠããŠããŸãã ã·ã¹ãã ã®ç·æ¥ã®å€æŽã«ã¯ãã³ãŒãã®ç·æ¥ã§æé©ã§ãªã解決çãå¿ èŠã§ãã ã³ãŒããäžé©åãªæ±ºå®ã«ããããããšããã«ããã®ãœãªã¥ãŒã·ã§ã³ã®DRYååå šäœããå°æ¥ã®å€æŽãŸã§æ©èœããªããªããŸãã
æãæåããŠããITäŒæ¥ã®æŽå²ãèŠããšããããã®å€ãã¯åé¡ãç解ããŠãã人ã ã«ãã£ãŠäœæãããŸãã-ãã«ã²ãŒããããŒã¯ãºãã«ãŒããŒã°ãã¹ãã£ãŒããŠã©ãºãã¢ãã¯ãã¹ãã£ãŒããžã§ããºãã©ãªãŒãã€ãžãã»ã«ã²ã€ããªã³ãã©ãªãŒãšãªãœã³ç¹å®ã®åé¡ã®è§£æ±ºçã ããããã·ã¹ãã 管çãäŒèšå£«ã®æã«ç§»ããæŠå¿µãã³ã³ãµã«ã¿ã³ãã®æã«ç§»ãäŒç€ŸããããŸãã ã©ã¡ãããã®ãããªé åã管çããããšã¯ã§ããŸããã
DRYã¯ãå ±åèšç»ã«ãã£ãŠéæãããŸãã
ãã®ãããå€ãã®ãœãªã¥ãŒã·ã§ã³ã¯ãPowerpointãPhotoshopãããã³27ã€ã³ãã®ç»é¢ã§ã®ã¿æ©èœããŸãã ããã¯ãããçšåºŠéçãªãµã€ãã§éšåçã«æ©èœããŸããã ããããä»æ¥ã§ã¯ãªããããŸããŸãªã€ã³ã¿ã©ã¯ãã£ããªã¢ããªã±ãŒã·ã§ã³ãããã€ã¹ãããããããäžçã§ã¯ã
ãããŠããã§ãŒã³ã®æåŸã«ããããã°ã©ããŒã¯ãã·ã¹ãã ã®ãšã©ãŒãçŽ æ©ãä¿®æ£ãã矩åããããŸãã 顧客ã®æ°ãŸããã«æ¯åèããããšãã§ããªãäŒèšå£«ã«æ £ããŠããå Žåããã¹ãŠã®èšç»ãå°çã«è¡ããéåžžã«æªãã³ãŒããæžãããŸãã ã³ãŒãã¯DRYã§ã¯ãªããªããŸããã
ãã®äŸã¯å°ãæ²èŠ³çã§ããïŒããèŠãããŸããïŒãDRYã¯å€ãã®äººã ãäŸåããŠããæŠå¿µã§ããããšãæ確ã«ç€ºããŠããŸãã ããªããçªç¶å§ãŸã£ãã°ããã®äŒç€Ÿã§çªç¶åããŠããå Žåãããã»ã¹ã®å€æŽãææ¡ããããšããå§ãããŸãïŒäŸãã°ããããžã§ã¯ãã®åæ段éã§ã®æè¡çè©äŸ¡ïŒã
å¿ èŠã®ãªããšããã«éŒ»ãçªããªãããã«é ŒãŸããããèªã¿é²ããŠãã ãã-YAGNIã®ååã¯ããªããæããŸãïŒ
KISS-ã·ã³ãã«ã«ãã«ã«ããŠïŒç©äºãç°¡åã«ããïŒ
19äžçŽã®çµããã«ãç©çåŠè ã¯ãéåãç£å Žãå åŠãé è·é¢-倪éœç³»å ã®è·é¢ã§ã©ã®ããã«æ©èœãããã®èª¬æãèŠã€ããããšããŸããã ããããã¹ãŠã®åã«äœçšããç¹å®ã®ãšãŒãã«ã®ååšã«ã€ããŠçè«ãå°ãåºããã説æããããšã¯ã§ããŸããã åŸã«ãã®çè«ã¯ããã€ãã®å®éšã«ãã£ãŠæ¡åŒµãããŸããããåé¡ã説æãããã®ã¯ãããŸããã§ããã
å€ãã®å ŽåãæãåçŽãªèª¬æãæãæ£ãã解決çã§ãã
å°ãåŸã«ãã¹ã€ã¹ã®ç¹èš±äºåæã®åŸæ¥å¡ã§ããã¢ã«ããŒãã»ã¢ã€ã³ã·ã¥ã¿ã€ã³ã¯ããã®çè«ãæŸæ£ããè·é¢ã®èšç®ããã¹ãŠç¡èŠããæéã¯äžå®ã§ã¯ãªããšåçŽã«ä»®å®ããããšãææ¡ããŸããã æå°æ°ã®äŸåé¢ä¿ãèæ ®ãããã®ãããªåé¡ã®è§£æ±ºçã¯ããOccamã®ååãã®åçã«ãã£ãŠèª¬æãããŠããŸãã
åæ§ã®æŠå¿µã¯å€ãã®åéã§èŠãããŸãã ãœãããŠã§ã¢éçºïŒããã³ä»ã®ããã€ãïŒã§ã¯ãKISSãšåŒã³ãŸãã ãã®é åèªã«ã¯å€ãã®æå³ããããŸããããããã¯ãã¹ãŠäžã€ã®ããšã«åž°çããŸã-ã§ããã ãã·ã³ãã«ã«ããããã«ããŠãã ããã
人é¡ã®æŽå²ã«ãããé²æ©ã®ã»ãšãã©ã¯ã䞊å€ããææ³å®¶ã®ãããã§ãã
HTTP
HTTPãããã³ã«ã¯ãããšããšãã€ããŒããã¹ãããã¥ã¡ã³ãã®è»¢éçšã«äœæãããçæ³çãªã·ã³ãã«ãªãœãªã¥ãŒã·ã§ã³ã®äŸãšããŠéåžžã«ããåŒçšãããŠããŸãããä»æ¥ã§ã¯å€ãã®ã€ã³ã¿ã©ã¯ãã£ãã¢ããªã±ãŒã·ã§ã³ã®åºç€ãšãªã£ãŠããŸãã ããããããã®ãããã³ã«ã®å¶éã«é¢é£ããåé¡ã®åé¿çãæ¢ãå¿ èŠããããå°æ¥çã«ã¯å¥ã®ãããã³ã«ã«çœ®ãæããããå¯èœæ§ããããŸãã ããããä»æ¥ã«ã€ããŠã¯ãããã€ãã®èŠæ±ã¡ãœããïŒGET / POSTïŒãã¹ããŒã¿ã¹ã³ãŒããããã³åçŽãªããã¹ãåŒæ°ã«åºã¥ããŠãHTTPã¯éåžžã«æè»ã§ä¿¡é Œæ§ãé«ããšããäºå®ãæ®ã£ãŠããŸãã ãããããŠã§ãéçºè ãæ倧éã«æŽ»çšããããšããŠããçç±ã§ããããã®ãããã³ã«ããŸã éçšãããŠããçç±ã§ãã
ç©äºãç°¡åã«ããããã®ã¢ãããŒãã¯ããªãæçœã§ããããœãããŠã§ã¢éçºã®æŽå²ã«ã¯ããŸããŸãªæªããçã®æ±ºå®ããããããããŸãã ãããã¯ãã°ãã°å¥ã®åèªãšåŒã°ããŸã-ãããŒããŠã§ã¢ããŸãã¯DOAïŒå°çæã«æ»äº¡ïŒ-åºçæã«æ»äº¡ã ãã®ãããªãœãããŠã§ã¢ã«é¢é£ããŠãéDRYã³ãŒãã®çè«ã«é¡äŒŒããçè«ãé©çšã§ããŸã...ããã§ããã€ã³ã¿ãŒãããã®æåã¯ãã·ã³ãã«ã§å¹æçãªãœãªã¥ãŒã·ã§ã³ã«ãã£ãŠèª¬æã§ããŸãã
ããã§ã¯ãå¯èœãªéãã·ã³ãã«ãªãœãªã¥ãŒã·ã§ã³ãæ倧éã«å®çŸããæ¹æ³ã¯ïŒ ããã¯ãã¹ãŠããµããŒãã®å¯èœæ§ãšãœãããŠã§ã¢éçºã®è©³çŽ°ã«åž°çããŸãã ãã®ãããèŠä»¶å®çŸ©ãã§ãŒãºã§KISSãé©çšããå¿ èŠããããŸãã ã³ãŒãã«ã¯ã©ã€ã¢ã³ãèŠä»¶ãå®è£ ããããšããŠã次ã®ç¹ã匷調ããŠã¿ãŠãã ããã
- ã³ã¹ããšå©çã®éã«äžé©åãªé¢ä¿ãããæ©èœã
- å¥ã®ãã®ã«å€§ããäŸåããæ©èœã
- é«ã確çã§ãæé·ããããå°é£ã«ãªãåŸåã®ããæ©èœã
ã©ãããããããã¯ã©ã€ã¢ã³ããExcelã¹ãã¬ããã·ãŒãã人äºç®¡çããã°ã©ã ã«ã€ã³ããŒããããããžã§ã¯ãã«åå ããŸããã è¯ãäŸã§ãã Excelã¯ãè€éãªåœ¢åŒã®å°çšã¢ããªã±ãŒã·ã§ã³ã§ãã ææžã®åœ¢åŒã¯è€éã§ãããªããªãã è±å¯ãªæ©èœãå®è£ ããŸã-ããšãã°ãã°ã©ãã£ãã¯ã¹ããã®ä»ã®ããããè¿œå ã§ããŸãããå®éã«ã¯ã¯ã©ã€ã¢ã³ãã«ã¯å¿ èŠãããŸããã§ããã 圌ã¯ããŒãã«ã®æ°åã ããå¿ èŠã§ããã ãããã£ãŠãExcelããã®ã€ã³ããŒããå°å ¥ããã«ã¯ãäžå¿ èŠãªæ©èœã«å€ãã®æéãè²»ããå¿ èŠããããŸãã ããã«ãExcelã«ã¯ããã€ãã®ããŒãžã§ã³ããããæ¯å¹ŽãŸããŸãå¢ããŠããŸãã ã€ãŸã ãã®ãã¹ãŠã管çããã®ã¯å°é£ã§ãããå°æ¥çã«è¿œå ã³ã¹ãã®ãªã¹ã¯ããããŸããã
ãããŠãCSV圢åŒããã®ã€ã³ããŒããå°å ¥ããããšã«ããŸããã ãã®ãœãªã¥ãŒã·ã§ã³ã¯æ°è¡ã®ã³ãŒããå¿ èŠãšããããŒã¿ã§éè² è·ã«ãªããïŒCSV圢åŒãšExcel圢åŒãæ¯èŒããå ŽåïŒã管çãšä¿å®ãç°¡åã§ããã Excelã¯ãCSV圢åŒã§ããŒã¿ãç°¡åã«ãšã¯ã¹ããŒãã§ããŸãïŒã¯ã©ã€ã¢ã³ããå°æ¥äœ¿çšã§ããä»ã®å€ãã®ããã°ã©ã ãšåæ§ïŒã ãŸãããã®èŠä»¶ãå®è£ ããããã®æå°éã®ã³ã¹ããèãããšããã®ãœãªã¥ãŒã·ã§ã³ã¯KISSã®åªããäŸã§ãã
é埳-è€éã«èŠããå Žåã¯ãåçŽãªåŽé¢ããç©äºãèŠãŠã¿ãŠãã ããã å®è£ ãããªãã«ã¯é£ãããšæããã圌ã®èŠä»¶ãã¯ã©ã€ã¢ã³ããããªãã«åãããªãã°ãããªãã¯ã©ããªå Žåã§ãæ£ããã§ãã å®è£ ãéåžžã«é£ããããšãèæ ®ããŠããäžåœã«éè² è·ã«ãªããœãªã¥ãŒã·ã§ã³ã«ééããããšããããããŸãã ããã¯ã éçºããã»ã¹ã«ã¯ãè²»çš/䟿çãæ£ããèšç®ããããã®æè¡çãªå°éç¥èãæããªã人ãå«ãŸããŸãã ãããŠã圌ãã¯åé¡å šäœãèŠãŠããŸããã ãããã£ãŠãåžžã«ã¯ã©ã€ã¢ã³ãã®èŠä»¶ãå確èªããããããŸãã«ã¯ã©ã€ã¢ã³ããå¿ èŠãšããŠãããã®ã§ããããšã確èªããŠãã ããã éèŠãªãã€ã³ãã«ã€ããŠè©±ãåããä»ã®ãœãªã¥ãŒã·ã§ã³ãããå¹æçã«ãªãçç±ã説æããŠãã ããã
ããªãã¯ãããå¿ èŠãšããŸãã-ããªãã¯ãããå¿ èŠãšããŸãã
GoogleãGoogle+ãéå§ãããšããFacebookã®åµèšè ã§ããMark Zuckerbergã¯ããœãŒã·ã£ã«ãããã¯ãŒã¯ã«ç»é²ãããæåã®äººç©ã®1人ã§ããã圌ã®ãããã¯ãŒã¯ãäžåãããã«èšèšãããŸããã 圌ã¯ããèªå·±ã«ã€ããŠãã»ã¯ã·ã§ã³ã«ãI Build Thingsããšãã1è¡ã ããæžããŸããã å人çã«ã¯ãããã¯çŽ æŽãããææ¡ã§ãããããã°ã©ãã³ã°ã®æ¬è³ªãæããã«ããŠããŸãã ãªããšã³ã³ãŒããã¹ãéžæããã®ã§ããïŒ æè¡çãœãªã¥ãŒã·ã§ã³ãžã®ç±æïŒ å¹çã®çŸããïŒ çããäœã§ããããæšæºæ©èœãåãã100500çªç®ã®äŒæ¥ãµã€ããæ§ç¯ãããããšã¯ã»ãšãã©ãªãã§ãããã ããã«ãããããããç§ãã¡ã®å€ãã¯ãŸãã«ãããç²åŸããŠããŸãã ã©ãã§ä»äºãããå Žåã§ããéå±ãªæ¥åžžæ¥åã«å¯ŸåŠããå¿ èŠãããå ŽåããããŸãã
ããã°ã©ãã³ã°äžã§ãã ç©ãäœããŸãã
ãããªãã¯ãããå¿ èŠãšããªãããšããååïŒYAGNIïŒã¯ããã®ãããªåé¡ã解決ããããã«èšèšãããŠããŸãã
ããã¯ãã·ã¹ãã ã§æå³ãããŠããªããã®ãã³ãŒãã«è¡šç€ºãããªãããšãæå³ããŸãã ããšãã°ãå€ãã®å ŽåãããŒã¿ããŒã¹ãžã®ã¢ã¯ã»ã¹ã¯æœè±¡åãä»ããŠè¡ãããŸããæœè±¡åã«ã¯ãããŸããŸãªãã©ã€ãïŒMySQLãPostgreSQLãOracleïŒã®å®è£ ãå«ãŸããå ŽåããããŸãã LAMPã¹ã¿ãã¯ã§ãã¹ããããŠãããµã€ãã§äœæ¥ããŠããå Žåãã¯ã©ã€ã¢ã³ããããŒã¿ããŒã¹ãå€æŽããå¯èœæ§ã¯ã©ã®ãããã§ããïŒ ã³ã³ã»ããã¯åžžã«äºç®ã®äžã§æžãããŠããããšãå¿ããªãã§ãã ãã-å³ïŒ
äºç®ãããŒã¿ããŒã¹ã®æœè±¡åãæäŸããªãå Žå-ãã®æœè±¡åã¯ã·ã¹ãã å ã«ããã¹ãã§ã¯ãããŸããã ã¯ã©ã€ã¢ã³ããçªç¶å¥ã®ããŒã¿ããŒã¹ã«ç§»åããå¿ èŠãããå Žåãããã¯ã·ã¹ãã ãå€æŽããã³ã¹ãã䌎ãããšã¯æããã§ãã
YAGNIã·ã¹ãã ãšDRYã·ã¹ãã ã®éãã«æ°ä»ããã¯ãã§ãã åŸè ã¯ã·ã¹ãã ã管çå¯èœãªã³ã³ããŒãã³ãã«åå²ããããšã§è€éãã軜æžããããã«èšèšãããŠããŸãããåè ã¯ãããã®ã³ã³ããŒãã³ãã®æ°ãæžããããšã§è€éãã軜æžããŸãã YAGNIã®åçã¯KISSã«äŒŒãŠããŸã-ããã¯ç©äºãå¯èœãªéãåçŽåããããšããŸãã ããããKISSã¯ç°¡åãªè§£æ±ºçãèŠã€ããããšããŠããŸãããYAGNIã¯æ±ºå®ãäžããŸããã
ã¢ã¡ãªã«ã®ãµã€ãšã³ã¹ãã£ã¯ã·ã§ã³ã©ã€ã¿ãŒã§ããã»ãªãã¢ã¹ã¿ãŒãžã§ã³ã¯ãããã¹ãŠã®90ïŒ ãå®å šãªãŽãã§ããããšããæ³åŸãææ¡ããŸããã ããªãæ¥é²çãªå£°æã§ãããå®éã®ãããžã§ã¯ãã«åžžã«é©çšã§ãããšã¯éããŸããã ããã³ã»ã³ã¹ãã«ã¯å€ãã®æéããããããšãå¿ããªãã§ãã ããã èšè¿°ãããŠããªãã«ãŒã«ããããŸããéçºã«è²»ããããæéã®çŽ80ïŒ ã¯ãã·ã¹ãã ã®æ©èœã®ããã20ïŒ ã®å®è£ ã«è²»ããããŸãã ãããžã§ã¯ããèŠããŠãããŠãã ããã èªåã®ã¬ãã¥ãŒããããã³ã«ã80/20ã«ãŒã«ãã©ã®ããã«æ©èœããããåžžã«ç¢ºèªããŠããŸãã
éçºã«è²»ãããæéã®80ïŒ ã¯ãã·ã¹ãã ã®æ©èœã®ããã20ïŒ ã®å®è£ ã«è²»ããããŠããŸãã
ãã®æŠç¥ã¯ãæ確ã§ã¯ãªãæŠå¿µãæ··åšããæéã«æºæ ããããšãæ £ç¿ãšãªã£ãŠããäŒæ¥ã«éåžžã«ããé©çšãããŸãã DBã®æœè±¡åã«èª°ãæè¬ããŸããã äžåžãããŒã¿ããŒã¹ã®æœè±¡åãšã¯äœããç¥ããªãå¯èœæ§ãããããŸãã
ãã ãããã®ã¢ãããŒããããªãåçŽã«èŠããå Žåã§ããäžèŠãªéšåããå¿ èŠãªéšåãåé¢ããã®ã¯ããã»ã©ç°¡åã§ã¯ãããŸããã ããšãã°ãæœè±¡åãå®è£ ããŠããå Žåã§ããããŒã¿ããŒã¹ããã³ããããšãã«äœãåŸãããŸããã éèŠãªãã€ã³ãã¯ããœãããŠã§ã¢ãã©ã®ããã«èŠãŠãããã§ããã¡ã³ããã³ã¹ã容æã§ãå°æ¥å©çãäžããã³ãŒããæžãããã«æããããŸããã ã€ãŸã ãã¹ãŠã®å¯èœãªå€æŽãèæ ®ããŠãå ãèŠè¶ãããã«æããããŸããã ããã¯å€§èŠæš¡ãªãããžã§ã¯ãã§ã¯éèŠã§ãããå°èŠæš¡ãªãããžã§ã¯ãã§ã¯éèŠã§ã¯ãªãå ŽåããããŸãã æªæ¥ã«ã€ããŠèããã®ããããŠãã ããïŒ æ¥ã«å°ããªãµã€ãã§æ¥é²çãªå€æŽãå¿ èŠã«ãªã£ãå ŽåãæåããããçŽããæ¹ãè¯ãã§ãããã å šäœçãªæè³ãèãããšãããã¯ããã»ã©åé¡ã§ã¯ãããŸããã
ãããžã§ã¯ãèšç»
æ°ãããããžã§ã¯ããèšç»ãããšãã¯ã次ã®ããšãèæ ®ããŠãã ããã
- æœè±¡åã®ã¬ãã«ãäžããããšã§è€éãã軜æžããŸã
- æ©èœãæ©èœããåé¢ãã
- å°ããªéæ©èœèŠä»¶ãèæ ®ã«å ¥ãã
- æéã®ãããã¿ã¹ã¯ãç¹å®ããŠããããåãé€ã
ããã詳ããèŠãŠã¿ãŸãããã æåã®ç¹ã§ããã§ã«äŸã瀺ããŸãã-ããŒã¿ããŒã¹ãã©ã€ããŒã«æœè±¡åãå®è£ ããªãã§ãã ããã ã·ã¹ãã ãè€éã«ããå¯èœæ§ã®ãããã¹ãŠã®ãã®ãæ éã«è©äŸ¡ããŠãã ããã å€ãã®å Žåãå€ãã®æœè±¡åããµãŒãããŒãã£è£œåããã³ã©ã€ãã©ãªã«å®è£ ãããŠããããšã«æ³šæããŠãã ããã ããšãã°ãäœæããèšèªã«å¿ããŠãHibernateïŒJavaïŒãDoctrineïŒPHPïŒãActive RecordïŒRubyïŒã®ãããã«ããããŒã¿ããŒã¹ããã³ORMã®æœè±¡åã¬ãã«ãä»å±ããŠããŸãã ãããã®åã©ã€ãã©ãªã¯è€éããå¢ããŸãã ãããŠãããã¯å¶åŸ¡ãããªããã°ãªããŸããã æŽæ°ãããããã»ãã¥ãªãã£ä¿®æ£-ãããã¯ãã¹ãŠãä»åŸå®è¡/é©çšããå¿ èŠããããŸãã
æ¯æ¥åœ¹ç«ã€ãšæãããæ°æ©èœã玹ä»ããŠããŸãã ãããã£ãŠãç§ãã¡ã¯å ãèããå®çŸããããŠããŸãã ããšãã°ãå€ãã®é¡§å®¢ã¯ã¢ãã€ã«ããŒãžã§ã³ã®ãµã€ããæã¡ãããšèããŠããŸãã ã¢ããªãã£ã¯ããŸããŸãªæå³ã§è¡šãããšãã§ããŸãããããã¯å¿ ãããèšèšäžã®æ±ºå®äºé ã§ã¯ãããŸããã ããã¯ãŠãŒã¹ã±ãŒã¹ã§ãïŒ ã¢ãã€ã«ãµã€ãã䜿çšãã人ã¯ã¢ãã€ã«ã§ãã ã€ãŸãããã¹ã¯ãããããŒãžã§ã³ã䜿çšããæ å ±ä»¥å€ã®æ å ±ãæ©èœãå¿ èŠã«ãªãå ŽåããããŸãã æ ç»é€šã®ãŠã§ããµã€ããæ³åããŠã¿ãŠãã ãããæ ç»é€šã«è¡ãéäžããã¹ã«ä¹ã£ãŠãããŠãŒã¶ãŒã¯ã50ã¡ãŒãã«ã®äºåç·šã§ã¯ãªããã»ãã·ã§ã³ã®éå§æå»ãèŠãããšèããŠããŸãã
ååãªäºç®ãããã°ãã¢ãã€ã«ããŒãžã§ã³ã®èŠä»¶ãåå¥ã«åæããããšããŸãã ãã®ãããªåæããªããã°ãåã«ãã¹ã¯ãããã®å Žåãšåãæ å ±ãæäŸããã ãã§ãã ãããŠãããã¯å€ãã®ãããžã§ã¯ãã«ãšã£ãŠååãããããŸããã ä»æ¥ãå€ãã®ã¢ãã€ã«ãã©ãŠã¶ã¯ãµã€ãã®å€èŠ³ãé©åã«æ§æã§ãããããããã§ã¯YAGNIã®æ ¹æ¬çãªã¢ãããŒããé©çšã§ããŸããã¢ãã€ã«ããŒãžã§ã³ãäœæããªãã§ãã ããã
æªãæŠå¿µã¯ãå€ãã®å Žåãæ©èœä»¥å€ã®èŠä»¶ããªãããšã§ç¹å®ã§ããŸãã
éæ©èœèŠä»¶ã¯ã·ã¹ãã ã®åäœã説æãããã®ã§ã¯ãªãã補åã®å質ãè©äŸ¡ããããã«äœ¿çšã§ããè¿œå ã®ããããã£ã説æããŸãã ãªããªã å質ã®èª¬æã«ã¯è£œåã®ç¥èãå¿ èŠã§ãããæ©èœããªãèŠä»¶ããªãããšã§ã貧匱ãªæŠå¿µãç¹å®ã§ããããšããããããŸãã ãµããŒãããæ©èœãããã¥ã¡ã³ãã®ã¬ãã«ãçµ±åã®å®¹æãã¯ããã¹ãŠéæ©èœèŠä»¶ã®äŸã§ãã ãããã®èŠä»¶ã¯æž¬å®å¯èœã§ãªããã°ãªããŸããã ã€ãŸã ããµã€ãã¯è¿ éã«ããŒãããå¿ èŠããããŸããã¯äžè¬åãããããŠããŸããããããã©ãŒãã³ã¹ãã¹ãäžã«ãµã€ãã¯2ç§ã§ããŒãããå¿ èŠããããŸããã¯éåžžã«å ·äœçã§æ確ã§ãã YAGNIã¢ãããŒããé©çšããå Žåã¯ãæŠå¿µã§èæ ®ãããŠããªãïŒãŸãã¯èæ ®ãããŠããããããŸãæ確ã§ã¯ãªãïŒå Žåã§ããããã€ãã®éæ©èœèŠä»¶ãèæ ®ããŠãã ããã ãã®ãããªèŠä»¶ãäœæãããšãã¯ãçŸå®çã«èããŠãã ããã1æ¥ããã20ã50ã®èšªåãããå°èŠæš¡ãªãµã€ãã§ã¯ã3æ¥éã®ããã©ãŒãã³ã¹ãã¥ãŒãã³ã°ã¯å¿ èŠãããŸããã ãµã€ãã¯ããã«ããŒããããããããµãŒããŒãéè² è·ã«ãªããªãå Žåã äŒæ¥ãåºåžãå¢ãããŠãããã匷åãªãã¹ãã£ã³ã°ãè³Œå ¥ããããšã¯åé¡ã«ãªããŸããã
ãããŠæåŸã«ãåžžã«80/20ã«ãŒã«ãèŠããŠãããŠãã ããã æéã®ãããã¿ã¹ã¯ãç¹å®ããŠãã ããã ãã®ãããªã¿ã¹ã¯ãå¿ é ã®å Žåããããè¡ãå¿ èŠããããŸãã åé¡ã¯ããã®æ¹æ³ã ãã§ãã å°ããªã³ãã¥ããã£ã§å¥ã®ãã¬ãŒã ã¯ãŒã¯ãå¿ èŠã§ããïŒ ã©ã€ãã©ãªã®ããã¥ã¡ã³ãããŸã æŽæ°ãããŠããªãå Žåãæè¿ãªãªãŒã¹ãããã©ã€ãã©ãªã®ããŒãžã§ã³ã«ã¢ããã°ã¬ãŒãããå¿ èŠããããŸããïŒ æ°ããCMSã®ãã¹ãŠã®æ¡åŒµæ©èœãæ©èœããŠããªãå Žåãæ°ããCMSã䜿çšããå¿ èŠããããŸããïŒ ããªãã®ä»äºãå®çŸããããã«ãã©ã®çšåºŠè©³çŽ°ãªåæãè¡ãå¿ èŠããããŸããïŒ ãåžžã«ãããããªããã°ãªããªããã¢ãããŒãã¯ããŸããšããµã€ãã£ã³ã°ã§ã¯ãããŸããããé©ãããšãªãåé¡ã解決ããã®ã«åœ¹ç«ã¡ãŸãã
ãŸãããããã®ãã¹ãŠããããªãã座ã£ãŠããã¯ã§å³ä»ããããæªãã³ãŒããæžãããšãã§ãããšããæå³ã§ã¯ãªãããšãç解ããããšãéèŠã§ãã ããªãã¯å°ããªã¢ããªã±ãŒã·ã§ã³ãæžããŠããã ãã§ã æªããã®ã§ã¯ãããŸããïŒ ãã ãããå¿ èŠãªããã¢ãããŒãã¯éåžžã«å®çšçã§ãã ãããæ°è¡ã®ã³ãŒããæžããã®ã«åœ¹ç«ã€ãªããç§ã¯ããªãããã®ä»äºãäºç®ã«å ¥ããããšãã§ãããšå人çã«æããŸãããããŠå°ãã®éDRYã¯å šãåãå ¥ããããŸãã ã€ãŸã ãµããŒãè²»çšããããã«å¢å ããããã§ã¯ãªãããšã«åæããããšãã§ããŸã-ç§ãã¡ã¯çŸå®ã®äžçã«äœãã§ããŸãã
åºæ¬çãªèãã«æ»ããŸããã-ç©ãäœããŸãã ããŒããŒãŽã§ã³ã¯å¥çŽæžã«ããã£ã¢ããªå€å¥æ²ããæžããã ç§ã¯åœŒãäºç®ã§åŠ¥åãããšã¯æããªãã 圌ã¯ããå€ãã®æéãè²»ãããŸããããæªãé³æ¥œããªãªãŒã¹ããŸããã§ãã-圌ã¯å®ç§ãªæžãæ¹ãæ±ããŸããã
ãã¡ãããç§ãã¡ã¯ãã¹ãŠå€©æã§ãããç§ãã¡ã®å€©æããã¹ãŠã®ã³ãŒãè¡ã«ç€ºãããã¹ãã ãšããæå³ã§ã¯ãããŸãããããœãããŠã§ã¢ã¢ãŒããã¯ãã£ãäœæ²ãšããŠèããã®ã奜ãã§ãã ç§ã¯å®ç§ãªã³ã³ããžã·ã§ã³ãæ§ç¯ãããã®ã§ãæ ç±çãªéçºè ã§ãããèªåãæ§ç¯ãããã®ãèªãã«æã£ãŠããŸãã
çµéšè±å¯ã§äººæ°ã®ããéçºè ã«ãªãããå Žåã¯ãååãšããŠYAGNIã§ã¹ãã«ã磚ãå¿ èŠããããŸãã æ ç±ãæã¡ç¶ããããªããåžžã«æµæããªããã°ãªããŸããã
ãããã«
ãœãããŠã§ã¢ã®ååã¯ããã®ãœãããŠã§ã¢ã®èŠ³ç¹ã§ãã ç§ã«ãšã£ãŠãè¯ãååã¯ãä»ã®ã¢ãããŒããå²åŠã«çŽé¢ãããšãã«ãã¢ã€ãã¢ã®è€éãªãã¶ã€ã³ã«é²åããã¹ãã·ã³ãã«ãªã³ã³ã»ããã«åºã¥ããŠããã¹ãã§ãã 奜ããªãœãããŠã§ã¢ã®ååã¯äœã§ããïŒ