ãæ¬ç¨¿ã¯ãæåDBãã¬ã¸ã³ 2009/09 æå·ãã®è¨äºãJavaã®éçãè¶ ãã¦å®ç¨åãç®æããæ°éçºè¨èªãScalaãã® ã¡ãªããã¨ã¯ãã転è¼ããä¸é¨ä¿®æ£ãããã®ã§ãã
Scalaã¨ã¯
ãScalaã¯ã2003å¹´ã«Javacï¼ã³ã³ãã¤ã©ï¼ãJavaã®Genericsã®è¨è¨ï¼éçºè²¢ç®è ã§ããMartin Oderskyæ°ï¼ã¹ã¤ã¹ã»ãã¼ã¶ã³ãå·¥ç§å¤§å¦ææï¼ã«ãã£ã¦ãéçºãéå§ãããæ¯è¼çæ°ããããã°ã©ãã³ã°è¨èªã§ããJavaã¯å®ç¨è¨èªã¨ãã¦å¹ åºãã·ã¹ãã ã§ä½¿ç¨ããã¦ãã¾ããããä¸ä½äºææ§ãä¿ã¤ã¨ããè¦è«ã®ä¸ãè¨èªã¨ãã¦ã®æ©è½å¼·åããªããªãé²ã¾ãªãã¨ãã£ãéçãè¦ãã¦ãã¦ãã¾ãããã®ãããªç¾ç¶ããããã¨ãããScalaã¯Javaã®å¾ç¶ã¨ãã¦å®ç¨çãªè¨èªãç®æãã¦éçºããã¦ãã¾ãã
ãScalaæ大ã®ç¹å¾´ã¯ãJavaã®è¯ããæ大éç¶æ¿ãã¤ã¤ãã¹ã¯ãªããè¨èªãé¢æ°åè¨èªã®è¯ãã¨ãããå¸åããå é²çãªæ©è½ï¼ææ³ãåãå ¥ãã¦ããç¹ã§ããã¾ããä»å¾ã®ãã¼ãã¦ã§ã¢ã®ãã«ãã³ã¢åãè¦æ®ããç°¡æã«ä¸¦åå¦çããã°ã©ãã³ã°ãè¡ããã¨ãã§ããã©ã¤ãã©ãªãä»å±ãã¦ãã¾ãã
Scalaã®ã¡ãªãã
ãScalaãå©ç¨ããããã§ã®ã¡ãªããã¨ã¯ãã©ããªã¨ããã«ããã®ã§ãããããã¾ãã¯ãããããæ¢ã£ã¦ããã¾ãããã
ã³ã³ãã¤ã«æã«Javaã¯ã©ã¹ã«å¤æããJavaVMä¸ã§åä½
ãããã¯ãWrite once, run anywhereï¼ä¸åº¦æ¸ãã°ã©ãã§ãåä½ããï¼ããç®æãJavaã®é·æããã®ã¾ã¾å¼ãç¶ãã§ãã¾ããã¾ããç°¡åã«ScalaããJavaãå¼ã³åºããããJavaããScalaãå¼ã³åºãããã§ãã¾ãã
ç°¡æã«è¨è¿°ã§ããã³ã³ãã¤ã«è¨èªã¨ãã¦ã¨ã©ã¼ãã§ãã¯ãå¯è½
ãScalaã¯ã¹ã¯ãªããè¨èªã®ããã«ç°¡æ½ã«è¨è¿°ã§ããããè¨è¨ããã¦ãã¾ããç¹ã«ãå¶å¾¡æ§é ã®è¨è¿°ãç°¡æ½åã§ããã®ã§ãæ¬è³ªçãªãã¸ãã¯é¨åã«éä¸ã§ãã¾ãã
ãã¾ããJavaã®1/2ç¨åº¦ã®ã³ã¼ãéã§è¨è¿°å¯è½ãªãã¨ã¯å¤§ããªã¢ããã³ãã¼ã¸ã§ãããããå®è¡é度ã¯Javaã¨åçãä¿ã£ã¦ãã¾ããããã«éçåä»ãã®ã³ã³ãã¤ã«è¨èªãªã®ã§ãJavaãC++ãªã©ã¨åæ§ã«ã³ã³ãã¤ã«æã«ã¨ã©ã¼ãæ¤åºã§ãã¾ããå ãã¦ãã³ã³ãã¤ã«æã«èªåã§é©åãªåãæ¨è«ããåæ¨è«ï¼æ³¨1ï¼ã®ä»çµã¿ãæã¤ãããå¤ãã®å ´åã¯åãæ¸ããªãã¦ãè¯ãã®ã§ãï¼çç¥å¯è½ï¼ã
ãéçãªåä»ããæã¤è¨èªã«ããã¦ãå¤æ°ãé¢æ°ã®åã宣è¨ããªãã¦ããããå°ãã®ã«ä½¿ãããé¢æ°ã®åãªã©ããèªåçã«åã決å®ããä»çµã¿ã
å®ä¾¡ãªãã¼ãã¦ã§ã¢ã¨ãã«ãã³ã¢åã«åãããè¨èªè¨è¨
ãç¾å¨ã¯ãã¼ãã¦ã§ã¢ãå®ä¾¡ã«ãªããCPUã®ãã«ãã³ã¢åãé²ã¿ã¤ã¤ããã¾ãããã®ãããªæ代ã®å¤åã«åãããè¨èªè¨è¨ããªããã¦ãããå¹ççãªä¸¦åå®è¡ãè¡ãæ©è½ãæ¨æºã©ã¤ãã©ãªï¼Actorï¼ã¨ãã¦æä¾ããã¦ãã¾ãããã®ã»ãã«ãã次ã®ãããªç¹å¾´ãããã¾ãã
- ç°¡æã«æ±ããã³ã¬ã¯ã·ã§ã³ã¯ã©ã¹ï¼ListãMapãArrayãªã©ï¼ãæ¨æºæè¼ããã¦ãã
- å¤éç¶æ¿ã¨åçã®ä»çµã¿ããã
- é常ã«æè»ã§é«æ©è½ãªãã¿ã¼ã³ããããå°å ¥ããã¦ãã
- æ¢åã®ã¯ã©ã¹ãé¨åçã«æ¡å¼µã§ãã
- XMLåãæ¨æºã§æè¼ããã¦ãããã½ã¼ã¹ã³ã¼ãä¸ã«ç´æ¥XMLãè¨è¿°ã§ãã
- ã¦ããããã¹ãç¨ã®ã©ã¤ãã©ãªãæ¨æºæè¼ããã¦ãã
- Liftwebã¨ãããªã¼ã«ã¤ã³ã¯ã³ã®Webãã¬ã¼ã ã¯ã¼ã¯ãåå¨ããé«æ©è½ãªWebã¢ããªãä½æå¯è½
ãè¿ããã¯æ欲çã§åªç§ãªå¤ãã®æè¡è ããScalaã«æ³¨ç®ãã¦ãã¾ããScalaãç¨ããææ³ãè¨ãã¦ããããã¬ã¼ãå¤ããå½¼ããä¸è¨ã®ãããªã¡ãªãããèªèãã¦ãã¾ãã
éçºã«ç¨ããçµé¨ããè¨ãããã¨
ãçè ãæå±ããããã³ããã¥ã¼ãã§ã¯ãå®éã«Scalaã使ã£ãéçºãè¡ã£ã¦ãã¾ãï¼ãã³ã©ã ããå®éã®éçºã«Scalaã使ç¨ãããåç §ï¼ãå®éã«éçºãè¡ã£ããã¨ã«ãããå¾ãããScalaã®è¯ãã¯é常ã«å¤ãã§ããæã ãä½æã§ããScalaã®è¯ãç¹ãç°¡åã«ã¾ã¨ãã¦ããã¾ãã
- ã³ã³ãã¤ã«è¨èªã®å®å¿æã¨ãã¹ã¯ãªããè¨èªçãªãæ軽ãï¼çç£æ§ã®é«ããä½µãæã¤
- ã¹ã±ã¼ã©ããªãã£ãé«ããç°¡åãªãããå¦çãããWebã¢ããªã±ã¼ã·ã§ã³ãã¨ã³ã¿ã¼ãã©ã¤ãºã¢ããªã±ã¼ã·ã§ã³ã¾ã§é«ãçç£æ§ãçºæ®ã§ãã
- éçºè¨èªã¨ãã¦æå 端ã®æ©è½ãææ³ããµãã ãã«åãå ¥ãã¦ããããªããã¤ãããã«ç¸ãããã«èªç±ãªè¨è¿°ãå¯è½
ãããããè¸ã¾ãã¦ã次ãã¼ã¸ããScalaã¨ããè¨èªã®åºç¤ã解説ãã¦ããã¾ãã
ãçè ããæå±ããããã³ããã¥ã¼ãã§ã¯ããastamuseãã¨ããWebã¢ããªã±ã¼ã·ã§ã³ãæ°è¦éçºããã«ããããè£æ¹ã®ãããå¦çãããããã³ãã¨ã³ãã®Webã¢ããªã±ã¼ã·ã§ã³ã¾ã§ãå ¨é¢çã«Scalaãæ¡ç¨ãããã¨ã«ãã¾ãããåè¿°ããScalaã®çç£æ§ã®é«ããæå¾ ãã¦ã®ãã¨ã§ãã
ã2009å¹´11æç¾å¨ãastamuseã¯è¿å¹´ã®ç¹è¨±æç« 150ä¸ä»¶å¼·ããæ½åºããæè¡æ å ±ãå å·¥ããç´400ä¸ãã¼ã¸ã®æè¡æ å ±ã»é¢é£æ å ±ãç¡æã§å ¬éãã¦ãã¾ããæè¡æ å ±éã§ã¯æ¥æ¬æ大ã®ãµã¼ãã¹ã§ãã
ãç¹è¨±ææ¸ã¯ã1ææ¸ãããå¹³å1ä¸5000åç¨åº¦ã®é·ããæã¡ãææ¸å ¨ä½ã¨ãã¦ã¯200ååãè¶ ãã¦ãã¾ãããããã«å¯¾ãã¦ãèªç¶è¨èªè§£æå¦çãçµ±è¨å¦çãåçã³ã³ãã³ãã®çæãªã©ãå¹ åºãè¡ã£ã¦ãã¾ããScalaã¯ã©ã®æ©è½ãä½æããã«ãã¦ããã³ã¼ãã£ã³ã°éã®ä½æ¸ãã³ã³ãã¤ã«è¨èªã¨ãã¦ã®ã¨ã©ã¼ãã§ãã¯ã¨å®è¡é度ã®éããçºæ®ããé«ãçç£æ§ãæä¾ãã¦ããã¦ãã¾ãã
ãastamuseéçºã¯ãæ°åã®å°è¦æ¨¡ãã¼ã ã§è¡ããã¦ãã¾ããéçºè éã®å¯ãªã³ãã¥ãã±ã¼ã·ã§ã³ãã¨ã£ã¦ãããã¨ããããæ°è¨èªScalaã«æè²ã³ã¹ããé«ãã¨ããå°è±¡ã¯ããã¾ããï¼Webçµç±ã§å¾ãããæ å ±éãå°ãªãç¹ã¯äºå®ã§ããï¼ãJavaçµé¨è ã ãã§ãªããCè¨èªçµé¨è ããScalaããã¹ã¿ã¼ããã¾ã§ãã»ã©æéãè¦ãã¾ããã§ããã
ãã¡ãªã¿ã«ããastamuseãã¯ãScalaãã¼ã¹ã®webãã¬ã¼ã ã¯ã¼ã¯ãLiftwebãã§ä½æããã¾ãããLiftwebã«ã¤ãã¦ã¯å¾è¿°ãã¾ããWebã¢ããªã±ã¼ã·ã§ã³ãastamuseãã®æ¦è¦ç´¹ä»è¨äºã¯ãCodeZineã«æ²è¼ããã¦ãã¾ãã