æ鬱æ¬ãè²·ã£ã¦ã¿ã¾ãã
javablack さんが最近とりあげã ã¡ãã£ã¨ã ã話é¡åçããã®æé¬±æ¬ ãã¨ãæ鬱ãªããã°ã©ãã®ããã®ãªãã¸ã§ã¯ãæåéçºè¬åº§ãã以ååãã¦èªãã ãã¨ãããã®ã§ããããé ·ãããã¨æã£ããã¨ä»¥å¤å ·ä½çãªãã¨ã¯ä½ãè¦ãã¦ãã¾ãã(^^;
ã§ãå ·ä½çã«ãªã«ãé ·ãã£ãã®ãã®ããªï¼ã¨ã¶ã¶ãã¨Webãæµãã¦ã¿ãã®ã§ãããè¦ã¤ãããªããã¨ããããããã¯ããæ¬ã ã¼ãã¨ããææ³ã°ã£ããã§ãäºæ³ä»¥ä¸ã«ãé ·ããã¨ããã¬ãã¥ã¼ããªãã®ã«æ¹ãã¦ããã¯ãªã§ãã
ãã¼ãããã¯ããã£ããã¬ãã¥ã¼ã®éè¦ãããããªï¼ã¨ã¹ã±ãå¿ãã ãã¦è²·ã£ã¦ãã¾ãã¾ããã§ã
æ鬱ãªããã°ã©ãã®ããã®ãªãã¸ã§ã¯ãæåéçºè¬åº§ (DDJ Selection)
- ä½è : Tucker
- åºç社/ã¡ã¼ã«ã¼: ç¿æ³³ç¤¾
- çºå£²æ¥: 1998/05/31
- ã¡ãã£ã¢: 大åæ¬
- è³¼å ¥: 10人 ã¯ãªãã¯: 508å
- ãã®ååãå«ãããã° (78件) ãè¦ã
ã§ãæ¹ãã¦èªã¿ç´ãã¦ã¿ã¾ãã¨ããã£ã±ãããã¯é ·ãã¨è¨ã£ã¦ããã¨æãã¾ãã
Smalltalk ãã¡ã³ã¨ãã¦ã¯ã
ãªãã¸ã§ã¯ãæåã¨ãã£ããSmalltalkã§ããã°ã©ãã³ã°ãããã¨ã§ãã,ã¨ããå®ç¾©ãæãç«ã£ã¦ããæ代ãããã¾ãã.ãã®å½æã¯Smalltalkã§å¤§è¦æ¨¡ãªãã¸ãã¹ã·ã¹ãã ãæ¸ããããã¨ã¯ã»ã¨ãã©ç¡ã,å°ããªå®é¨ããã°ã©ãã³ã°ã主ã§ãã.å½ç¶ã®ãã¨ãªãã,ç·»å¯ãªè¨è¨ãå¿ è¦ã¨ãããæ©ä¼ã¯å°ãªã,ã¯ã©ã¹ã©ã¤ãã©ãªããã¾ã使ã£ã¦æçã«ããã°ã©ã ãçµã¿ä¸ãããã¨ãéè¦è¦ããã¾ãã.
ã®è¨è¿°ã ãã§ããããããªæ¬çããã¦ãã¾ãï¼ã¨ããæ¤ããé ãã¾ããã
Smalltalkã使ã£ããã¨ãç¡ããã£ã¦ãGoFæ¬ã«ã¯Smalltalkã®ã¯ã©ã¹ã©ã¤ãã©ãªã«ã¤ãã¦ããã£ã¡ã ãè¨åãã§ã¦ãã¾ãããããç®ã«ãã¦ããã°ãã®ãããªä¸åãªçºè¨ã¯ã¨ã¦ãåºæ¥ãªãã¨æãã¾ãããªã®ã§ãããã®èè ãã㯠GoFã®ãã¶ã¤ã³ãã¿ã¼ã³ããèªã¾ãã«OOP ãèªãè¿éããã§ãã...orzã ã¨æã£ãã®ã§ããããã®æ¬ã¯ 1998å¹´ããã¶ã¤ã³ãã¿ã¼ã³ã®è¨³æ¬ã¯ 1999 å¹´çºè¡ãªã®ã§ããã
ãã¼ããªãã»ã©ã¼ã
ãã®æ¬ã¯ã©ããä¼èã»åèãã®æ å ±ãå ã«ãèè ã®æ¹ã試è¡é¯èª¤ãã¦èº«ã«ã¤ããããªãã¸ã§ã¯ãæåéçºãã解説ããæ¬ã®ããã§ããã¨ãè¨ãã¨ãæ¬ãæ¸ãã®ã«æ å ±åéãè£åããæ ã£ãè¨èªéæ(int *n; *n = 5 ã¿ãããª)ãªæ¬ã®ããã«æãã¾ãããããã§ã¯ãªããå½ææã«å ¥ããããã£ãæ å ±ã¯ãããªã¹ã¦ãããªã¢ã³ãªã®ãããããªããä»æ¹ããªããã¨ãªã®ããããã¾ãã*1ã
ããããã¯ãããã ããã¨ãã£ã¦ããã®æ¬ã®å 容ãè¯ãã¢ãã«ãªãããã§ã¯ãªãã§ãã容赦ããããã£ããææãã¡ããã¾ãããã
* * *
ãã®æ¬ã®ã¾ããã¨ããã¯ãã£ã±ãããã®ã ããã©ã大ããªã®ãäºã¤ã ããä¸ã¤ã¯ããªã¢ã¼ãã£ãºã ã®æå³ã使ãã©ãããèè èªèº«ãç解ãã¦ããªãæã§ãã
åºç¤ã§ããã ããã¯ã©ã¹ã¯åãã¨ãã¦ã¼ã¶å®ç¾©åã§ãããã¨ã強調ãã¤ã¤ããç¶æ¿ã®è©±ã¯å®è£ ç¶æ¿ã®äºã°ããã§ãåã微塵ãã§ã¦ããªãã§ãããåãç¶æ¿ãããã¨ããè¨èãåºã¦ããªãã ãã§ãªããæ¦å¿µã¨ãã¦ãèªç¥ããã¦ããªãããã«ããæãã¾ããå½ç¶Java ã®ã¤ã³ã¿ã¼ãã§ã¤ã¹ ã®ãããªãã®ãç¡ããããªã¢ã¼ãã£ãºã ã¯æ®ã©ç¡ãã£ããã¨ã«ããã¦ãããããªãã®ã§ããï¼æ¬ç·¨ã§ã¯ãªããC++å ¥éãã¨éæã£ãã³ã©ã ã®1æ¬ã¨ãã¦è¨è¼ããã¦ãã¾ãããå®è£ 段éã«ããã便å©ãªæ©è½ã«ããã OO å ¨ä½ããã¿ãã° ãã»ãªãOOAD ã§ã¯åå¨ããªããåç¶ ã¨è¨ãåã£ã¦ãã¾ãï¼
OOPLã使ããã£ã¨ã大ããªç¦é³ã¯ãå¼ã³åºãå ã®å ±éåããåºæ¥ãããã«ãªã£ããã¨ã ã¨ç§ã¯èãã¾ããããã¯æ¬æ¸ã§è¨ããããªãå®è£ ä¸ã®ãã¯ããã¯ããªã©ã§ã¯ãªããè¨è¨ã®åææ¡ä»¶ãè¦ããé常ã«å¤§ããªè¦ç´ ã§ããOOPã¯ãã¡ãããããªã¢ã¼ãã£ãºã ã軽è¦ããã¾ã¾OOAD ãèªãã®ã ã£ã¦ãç輪ã®æ¬ ããè»ã§è«ãé²ãããããªãã®ã§ãã®ã§ããã®æ¬ãèªäºãçµããå ã«é£ãã¦è¡ãããã®ã¯ããããªãã¨ã OO ã§ã¯ãªãä½ãã§ãã
ããä¸ã¤ã®å¤§ããªåé¡ã¯ OOAD ã«åéã OOP ããªããããã«ããå 容ã§ããçè ã¯ããOOPLã®ç¥ã¯ Simula ãâ ãSimula ã¯ç¾å®ãã·ãã¥ã¬ã¼ã·ã§ã³ããããã®è¨èªã â ãOO ã¯ç¾å®ãã·ãã¥ã¬ã¼ããããã®ã ã¨ãã¦ãOO ã¨ã¯ç¾å®ã®æ¦å¿µããã®ã¾ã¾ããã°ã©ã ã«è½ã¨ããããã¨ãã¨ãã¦ãã¾ããããã¯ãåãã®ã¨ããééãã§ããããã°ã©ã ã®æ½è±¡åãã¯ããã¯ã¨ã¯èããªãã®ã...orz
ã ãããåæçµæãã³ã¼ãã«è½ã¨ããªãã£ã¦ããå ¨ç¶å¹³æ°ãããããããä¾ã§è¨ãã°ããã¨ã㯠9ç« ã10ç« ã¯ç¶æ é·ç§»ã®ã話ãªã®ã§ãããé·ç§»å³ã®ä½æã«2ç« ãè²»ããã¦ãããªããããããã³ã¼ãã«è½ã¨ããªãã®ã
ãã¦ããã§ã¯,ä»ã¾ã§è¦ã¦ããç¶æ ã®å¿ç¨æ¦å¿µã,ããã°ã©ã ã³ã¼ãä¸ã§ã©ã®ããã«å®è£ ããããè¦ã¦ã¿ã¾ããã,ã¨ããããã¨ãããªã®ã§ãã,æ®å¿µãªããããã¾ã§ããã¨,ãããã®OOPLã§ããããã¹ãã¬ã¼ãã«å®è£ ããæ¹æ³ã¯ããã¾ãã.
ã¨OOPLã®ããã«ãããã¯ã©ã¹ã¨éã£ã¦ç¶æ é·ç§»å³ããã®ã¾ã¾è½ã¨ãè¾¼ãè¨èªæ§é ãç¡ãããã¨è¨ããç¶æ ããªãã¸ã§ã¯ãã«ããã¨ããçºæ³ãåºããã«ãC ã®ãããª1é¢æ°1ç¶æ ãªã³ã¼ãããåºã¦ããªãã§ããããªãã¨ãè¨ãã¦ãã¾ãã®ã¯ãç¾å®ãUML*2ã§æ¸ãèµ·ãããã¨ããããããã®çè ã«ã¨ã£ã¦ã®OOã ããã§ãã
èè ã®æ¹ã¯ä¸åå¼·ã§ã¯ãªããããã OO ã«æ ç±çã«åãçµãã§ããã®ã窺ãç¥ãã¾ãããªã®ã«ãããå¤ãªãã¨ãæ¸ãã¦ãã¾ãã®ã¯ãOOã¨ã¯ä½ãã®æåã®ä¸æ©ã§éãããã¦ãã¾ã£ãããã¨ããæãã¾ãããæ¬æ¸å ¨ä½ãéãã¦æããããã³ã¼ãã«è½ã¨ããªãåæã»è¨è¨ãã¯ã³ã¼ãããã価å¤ããããã¨ããé°å²æ°ã«ãã¤ãã¤ãæ¥é ç®ã«ããä¸å強㪠SE(ç¬) ã®å§¿ãéãã¦ãã¾ãã¾ããããã¯ããã¾ãã§ãã
å ¨ä½ã¨ãã¦ã¯ãããªæãã§ãã
* * *
ç´°ããæèã«ã¤ãã¦ã¯ãç«ã®æ§æ ¼ã®æªããä¸æãæ´»ç¨ãã¦ãã¡ã£ãã責ãä¸ãããã¨ãå«ãããããã³ãã¢çºè¨ãããã¯ã¢ãããã¤ã¤èªã¿é²ããã®ã§ãããããªãç¡ãã®ã§æ念ãã¾ããã以ä¸ããã¼ããã®ãä½ç¹ãå¼ç¨ãã¾ãã®ã§ããã¨ã¯æ¨ãã¦ç¥ã£ã¦ãã ããã¾ãã
åã¯ã¯ã©ã¹ï¼ã®ä¸ç¨®ï¼ã
ãªãã¸ã§ã¯ãæåã«ããã¦ããªãã¸ã§ã¯ããã¨ããè¨èã¯ãã¾ãã«å¤ãã®ã·ãã¥ã¨ã¼ã·ã§ã³ã§ãããããªæå³ã§ä½¿ç¨ããã
ä¸è¬çã«ã¯ã¯ã©ã¹ã®å±æ§ã«ã¯ã©ã¹ãæãããã¨ããåæã¯ãã¾ãã(ä¸ã«ã¯ããããåææ¹æ³ãæ¨å¥¨ããæ¹æ³è«ãããã¾ãã,å°æ°æ´¾ã§ã).
(ä¸ç¥)
ã¯ã©ã¹ãå±æ§ã«ãªãã®ã¯,åºæ¬çã«æ°å¤çãªã©ã®åºæ¬çãã¼ã¿ã§ã.ã¯ã©ã¹ãå±æ§ã«ãªãå ´åããªããã¨ã¯ãªãã§ãã,ãããæååã¯ã©ã¹ãªã©ã®ãããã¦åå§çãªã¯ã©ã¹ã«éããã¾ãã
ããªãã¸ã§ã¯ãæåã®å ç¥ã¯ã·ãã¥ã¬ã¼ã·ã§ã³è¨è¿°è¨èªã ã£ãããå¤ãã®ããã°ã©ã ã¯ã·ãã¥ã¬ã¼ã·ã§ã³çå´é¢ãæã£ã¦ããã.ãã®å³ãã¿ãã¨,ãããã®è¨èã«é常ã«èª¬å¾åãæãããã¨æãã¾ã.
ããã°ã©ã ã³ã¼ãã¬ãã«ã§ãæã£ã¦ããããã¨ããhas-aé¢é£ãã¨ããã®ã¯,ä½è¨ãªæ··ä¹±ãæããã¨ã«ããªãããã¾ãã.å®éã« has-aé¢é£ã¨ããè¨èãæè¿ã¯ãã¾ã使ããã¾ãã.
ãã¯ã©ã¹ã®é¢é£ã«ã¯is-aé¢é£ã¨has-aé¢é£ãããã,ããã¯ã³ã¼ãã£ã³ã°ã¬ãã«ã§ã®ã¿ä½¿ãããè¨èã¨èããæ¹ãããã§ããã.
å¤æ æ§ã«ããã£ã¦ã¯åæè¨è¨æ®µéã§ã¯æ確ã«æèãããªãæ¦å¿µã¨ãããã¨ããã,æè¿ã®ãªãã¸ã§ã¯ãæåæè¡ã®ã³ã³ã»ã³ãµã¹ã¨ãã¦ã¯,ã©ã¡ããã¨ããã¨å®è£ ä¸ã®ãã¯ããã¯ã«è¿ããã®ã ã¨èªèããã¤ã¤ããã¾ã.ï¼ä¸ç¥ï¼ãªãã¸ã§ã¯ãæåéçºã§ç¹ã«éè¦ãªã®ã¯åæï¼è¨è¨å·¥ç¨ã§ãã,ã¨ããèªèãå®çãã¦ãã¦ããç¾å¨ã§ã¯,å¤æ æ§ã«ç¹ã«æ³¨ç®ãéã¾ãã¨ãããã¨ã¯ã»ã¨ãã©ããã¾ãã.
ãªãã¸ã§ã¯ãæåçè¦ç¹ããèããã¨,ãã³ãã¼ãã¨ããè¡çºèªä½ãä¸èªç¶ã§ãã,ã¨ããã®ãçç±ã®ä¸ã¤ã ã¨ãããã§ããã.
ãªãã¸ã§ã¯ãæåã¯ç¾å®ããã®ã¾ã¾ããã°ã©ã åãããã®ã§ãã,ã¨ãããã¨ã¯ä»ã¾ã§ä½åº¦ãæ¸ããéãã§ã.ç¾å®ã§ä½ããã³ãã¼ããã,ã¨ããã·ãã¥ã¨ã¼ã·ã§ã³ã¯æ®ã©ããã¾ãã.
- 14ç« P377 ã®æ¯è¼ç¨Cã³ã¼ã(LIST14-1)㯠ééããªã Cããã°ã©ãã³ã°è¨ºæ室 éã(こんなコード)
ãªãã¸ã§ã¯ãæåä¼èª¬ ã¨éæã£ãã³ã©ã ã¯ç¹ã«é
·ããå¼è§£ã®ä½å°ç¡ããªæãã§ãã
* * *
Web ã¯é«ééè·¯ã ãªããã¨æãã¾ãããããã®å ´å㯠sumim ããã®æ·è¨ãã OOPèªåè»éã«ä¹ã£ã¦æ¥½ã¡ãOOPå¦ç¿ã§ãã(ãããã« Smalltalkã¸ã£ã³ã¯ã·ã§ã³ã«é£ãã¦è¡ããã¦ãã¾ã£ãããã©w)ãç§ãã¨ãããã¾ãé¡ã§ãããªãæ¸ãã¦ããããã®ã¯ä¸éã«é«ééè·¯ã®ãããã ããªããã¨æãã¾ãã
ãã®æ¬ãæ¸ãããæ代ã¯ã¾ã é«ééè·¯ãååãããªãã£ã¦ãæ å ±ãå¾ãã³ã¹ããé«ãã£ããããæ å ±ãéããã¦ãã¾ã£ã¦ããäºæ¬¡æ å ±ã ã£ããããã¨æãã¾ããä½ããéãããã¦ãã¾ã£ãã¨ããæãã¦ããã誰ããããªãã®ãçãã§ãããããç°å¢ã®ä¸è¶³åãåªåã¨ã¤ãã¸ãã¼ã·ã§ã³ã§è£ã£ã¦ãå®è·µãã¦ãããç¨åº¦ææãä¸ããã°ãOOã¨ãã³ã¸ã§ãªã¹ããææããã¡ããã大ããééã£ã¦ãã¾ããã¨ãæ æ ¢ãå²æ ¢ã®çµæã§ã¯ç¡ãã£ãæ代ãªã®ããªï¼ã£ã¦æãã¾ããï¼ããã¾ã§æ³åã§ãï¼
ãã®ã¨ã³ããªãæ¸ããã¨æã£ãã®ã¯ãå®ã¯ javablack ããã®ã¨ã³ããª
おれおれオブジェクト指向は何が違うのか. - カレーなる辛口Javaな転職日記
ãããã¾ãã«ãã£ãããããã¦ããããã
æ鬱æ¬è³¼å ¥ãã鬱ã°ã©ãã§ããç§èªèº«ã¯çµæ§å½¹ã«ãã£ãã¨æã£ã¦ãæ´¾ãªã®ã§ã©ã®è¾ºãå±ãªã®ããªã¹ãã¢ãããã¦ä¸ããã¨ãããããã§ã
http://d.hatena.ne.jp/JavaBlack/20070730/p1#c1186372421çï¼å ¨é¨éãï¼
ããããããªãã§ããããã©ããããªãã§ããããã©(^^;
ä¸å¿ è£è¶³ã¨ã㦠ã·ã¼ããã³ãã«ããã®ãã¨ã話ãããã¦ã¾ããããå ·ä½çã«ä½å¦ãã¾ããã®ï¼ãã¨ããçåã«å¯¾ãã¦ãå ¨é¨ãã¡ãããã¨ã話ãããã°...ãã§ã¯ãçãã«ãªã£ã¦ãã¾ããããã£ã¨å ·ä½çã«æ¸ãã¦ãã¼ã£ãã¨æãã¾ããã
ã§ãèªåã§ãã©ã¤ãã¦ã¿ãã®ã§ããããã¼ããããã¯ãå ¨é¨ãã¡ãã¨è¨ãã®ãä¸çªé©åã§ãããï¼âãï¼
è¨èå°»ã¬ãã«ã§ããç« ãé ã§èªã£ã¦ããå 容ã¬ãã«ã§ããæ¬å ¨ä½ã¨ãã¦ãåé¡ã ããã§ãããªãããã¾ããããªã®ã«é¨åé¨åã§ã¯æ£ãããã¨ãæ¸ãã¦ãã£ãããããã®ã§ãä½è¨èª¬æãã¥ããã§ããããããæ鬱æ¬ã®é ·ãã¨ãããç·æ¬ããã¨ã©ããªãã®ï¼ã«ã¤ãã¦ã¯ããªãã®ããã®ã§ ã·ã¼ããã³ãã«ããã®ãã¨ã話 ãã¨ã¦ãè¯ãã§ãã¦ãã¾ãã
å½¼ã®ææ³ã¯ï¼
ããããã«è ã¯æªããªããï¼
ãªããªãç¾å³ããã·ã¼ããã³ãã«ããã ã£ããï¼
ã§ããããã¨ç§ã¨ãä¸ä½ãªãã®é¢ä¿ããããã ãï¼ã
ãã®è ãæªããªãã¨ãããã¬ã³ã§ãå£ããåºé±ç®ãåãã¦ãã¦ãããã»ããã¾ã è¯ãã£ããåã¯çå®ãæ··ãè¾¼ãã æ¹ãããåã¨ãã¦å¹æçã«ãªãã¾ãããªã¾ãããã³ã¨ãã¦ãã ãã«ãããã£ã¦ãã¡ã¼ã¸ãã§ããã¨ããæ¬ã§ãã
èè ã®æ¹ã¯ã¨ã¦ãå¤åãªæ¹ã£ã½ãã®ã§ãä»ãããã°ã©ãã¨ãã¦ãå¥å¨ãªãããã¤ã¦ã®èªåã®è§£èª¬ãä»ã§ã¯ãééããã«ãªã£ã¦ãã¾ã£ããã¨ã¯ååãæ¿ç¥ã®ãã¨ã ã¨æãã¾ãããã®æ¬ã¯ããããªé¢¨ã«ã¿ããªã§èª¤è§£ãã¦ãæ代ããã£ããªããã¨èªãã®ãç¸å¿ããæ¬ãªã®ã§ãããããã£ã¨ã
ä»æ¥ã§ã¯ãJava ã¯ãã¡ãããC++ ã§ãã£ãã£ã¦ ãã®æ¬ã®å 容ã¯è«å¤ã§ããåæï¼è¨è¨è«ã ãåãé¢ããã¨ãã¦ãåé¡ãå¤ãã¨è¨ããããå¾ã¾ããã
*1:ç§ã¯å½æããã°ã©ãã§ã¯ãªãã£ãã®ã§åãªãæ³åã§ããã«ã¢ããã·æ¬ãã¡ã¤ã¤ã¼ã»ã³ã»ã®ãªãã¸ã§ã¯ãæåå ¥éããæ¢ã«è¨³æ¬ããã£ãããºã§ãããJavaã ã£ã¦ä¸ã«åºã¦ããã®ã ãããããããããä»æ¹ãç¡ããªãã®ããããã¾ããããã³ãã®ã¨ããã¯ã©ããªãã§ãããï¼>詳ãã人
*2:æ¬å½ã¯OMTæ³ã§ãããè¨æ³ã«ã¤ãã¦ã¯ããããæèãªã®ã§