ãã®éèªã®ç¬¬2å·ã§ã¯ããžã§ã³ã¹ããŒãããä»®æ³ããã§ã¢ã«ç»å Žããããšãå¬ããæããŸãã John Skeetã¯çã®ã³ãã¥ããã£ã¢ã·ã¹ã¿ã³ãã§ããïŒStackOverflowã®ã¢ã€ã³ã³ãã芧ãã ããïŒãäž»èŠãªCïŒã¹ãã·ã£ãªã¹ãã§ãããå€ãã®æ¬ã®èè ã§ããããŸãã ãžã§ã³ã¯2003幎ããMS MVPãåããŠããŸãã 圌ã¯çŸåšGoogleã§åããŠããŸãã
玳士men女ã®çããããã以äžèŠåŽããããšãªãããœãããŠã§ã¢ãšã³ãžãã¢ã§ãã玳士ã§ãããžã§ã³ã»ã¹ããŒãã«æ³šç®ããŸãã
DNCïŒããã«ã¡ã¯ããžã§ã³ããã®ã€ã³ã¿ãã¥ãŒã®ã¹ã±ãžã¥ãŒã«ã«æéãåã£ãŠãããŠãšãŠãããããã§ãã ããããããžã§ã³ã¹ããŒãã«ã€ããŠãã£ãšç¥ããããšæããŸãã ãžã§ã³ã¯ã©ã®ããã«ã³ã³ãã¥ãŒã¿ãŒã䜿ãå§ããŸãããïŒ
JSïŒå®¶æå šå¡ã«å ±éã®æåã®ã³ã³ãã¥ãŒã¿ãŒã¯ã8æ³ã®ãšãã«è³Œå ¥ããSinclair ZX Spectrum 48 Kã§ããããããŠãä»ã®Spectrumã¢ãã«ãè³Œå ¥ããŸããããåŸã ã«PCã«åãæ¿ããŸããã é·ãéãã»ãšãã©ã®æéãã³ã³ãã¥ãŒã¿ãŒã§éãããã²ãŒã ãããŠããŸããããããã°ã©ãã³ã°ã¯åžžã«ããã«ãããŸããã
DNCïŒã·ã³ã¯ã¬ã¢ã§åããŠãããšãã«çŽé¢ãã課é¡ã¯äœã§ããïŒ ã³ã³ãã¥ãŒã¿ãµã€ãšã³ã¹ãæ·±ãæãäžããä»äºã¯ãããŸããïŒ
JSïŒ Spectrumã§ã®æåã®ã倧ããªããããžã§ã¯ãã®1ã€ã¯ãããŽèšèªã®é¡äŒŒç©ãæžãããšã§ããã åŠæ ¡ã§ã¯ãBBC Microsã®ãã€ã¯ãã³ã³ãã¥ãŒã¿ãŒããããããŽã¯ã³ã³ãã¥ãŒãã£ã³ã°ãå°å ¥ããããã®èšèªãšããŠäœ¿çšãããŠããŸããã ç§ã¯ãããæ¬åœã«æ¥œããã§ããŠãèªå® ã§äœ¿ããããšæã£ãŠããŸããããããŽã®éèš³ã¯ããŸããã§ããã ç§ã¯äžè§æ³ã«ã€ããŠã¯å šãç¥ããŸããã§ããããæ§é ããã°ã©ãã³ã°ã«ã€ããŠãè¯ãèããæã£ãŠããŸããã§ããããç§ã¯åºå·ããããªãè¯ãå®è£ ã«ãªããŸããã Spectrumã®ããã¥ã¢ã«ã¯éåžžã«åªããŠããã®ã§ãåŠæ ¡ã§å匷ãå§ãããã£ãšåãããæåéããããããã¹ãŠã®åºæ¬çãªäžè§æ³ãåŠã³ãŸããã
ç§ã¯ä»ã§ããã«ã¡ãè¡šãäžè§åœ¢ãæãããåé€ããããããµãã«ãŒãã³ãèŠããŠããŸãã ãµãã«ãŒãã³ã¯è¡çªå·7000ã§å§ãŸããçµæãããŸãè¯ããªãå Žåã¯ãæ©èœããéããGOSUB 7000ããžã®åŒã³åºããè¿œå ããŸããã ç¹å®ã®å Žæã«è€æ°ã®ãµãããã°ã©ã åŒã³åºããããå Žåãäœããééã£ãŠããããšãç解ããŸãã...ããããç§ã¯ãããäœã§ããããåžžã«ç¥ã£ãŠããŸããã§ããã
DNCïŒããŠããã®è³ªåã¯åŸåãã«ãããã£ãã®ã§ãããä»ããªãã¯ããŽã®é¡äŒŒç©ãäœæãããšèšããŸãã... 8ïŒïŒïŒ...ç¬èªã®ããã°ã©ãã³ã°èšèªã®äœæã«ã€ããŠèããããšã¯ãããŸããïŒ
JSïŒããŸã«...ããããç§ã¯çã«é©åœçãªäœããåµãåºãã»ã©åŒ·åãªæ³ååãæã£ãŠãããšã¯æããŸããïŒãã¡ãããç§ã¯ãã®ããã®æéã¯ãããŸããïŒã ããŒã ãæ°ããèšèªãèšèšããã®ãæäŒãããšãã§ãããšæããŸããããœãã¡ãã¶ã€ããŒã«ãªãæ¹ãã¯ããã«ç°¡åã§ããæ¢åã®èšèªã§ç¯ããééããå®éã®ãã®ãããææããŠãã ããã
DNCïŒã«ãŠãã®å°é家ã¯ããããããŸãããžã§ã³ãããŸãã ç§ãã¡ã¯çãCïŒã«å¯Ÿããããªãã®æã«ã€ããŠç¥ã£ãŠããŸãã ã»ãšãã©ã®äœæ¥ã¯Javaã«é¢é£ããŠããŸãã ä»ã®ã©ã®ããã°ã©ãã³ã°èšèªãä»äºã«äœ¿çšããŠããŸããïŒ è¶£å³ãšããŠèšèªãå匷ããŠããŸããããããšãåŠã³ããã§ããïŒ ãªãã§ïŒ
ç§ã®ç§å¯ã¯ãä»ã®ããã°ã©ãã³ã°èšèªãæ¬åœã«ç¥ããªãããšã§ãã StackOverflowã®ããã€ãã®è³ªåã«çããã®ã«ååãªVBãç¥ã£ãŠãããFïŒã®ããã€ãã®è³ªåãèªãããšãã§ããŸããããã®æå³ã§ã¯ããŸãå€èšèªã§ã¯ãããŸããã
JSïŒç§ã®ç§å¯ã¯ãä»ã®ããã°ã©ãã³ã°èšèªãæ¬åœã«ç¥ããªããšããããšã§ãã StackOverflowã«é¢ããããã€ãã®è³ªåã«çããã®ã«ååãªVBãç¥ã£ãŠãããFïŒã«é¢ããããã€ãã®è³ªåãèªãããšãã§ããŸããããã®æå³ã§ã¯ããŸãå€èšèªã§ã¯ãããŸããã ç§ã¯ééããªãFïŒã«ã€ããŠãã£ãšåŠã³ãGoã«ã€ããŠåŠã³ãããšæã£ãŠããŸããååãããããèªã£ãŠããã®ã§ã
ç§Theã¯ãç©äºã®å®éã®äœ¿çšæ³ãèŠã€ããããšã§ããç§ã®è¶£å³ã®ã»ãšãã©ã¯ãéç°ã¿ã€ã ãªã©ã®.NETã©ã€ãã©ãªãäœæããããCïŒã«é¢ããèšäºãæžãããšã§ãã
ç§ã¯ã¢ããªã±ãŒã·ã§ã³éçºè ã§ã¯ãããŸãããä»ã®ããã°ã©ãã³ã°èšèªãè©ŠããŠã¿ãæ¹ããã£ãšç°¡åã ãšæããŸãã ä»ãç§ã¯Raspberry PIãæã«å ¥ããŸããããããç§ã®æ³ååãåºæ¿ããããšãé¡ã£ãŠããŸãã Monoã¯ããã§åäœããŸãããGoãåŠã¶ããã«MonoïŒRaspberry PIïŒã䜿çšããŠã¿ãŸãã
DNCïŒéåžžã«è¯ããStackOverflowã®ãªã¹ãã«Goã¿ã°ãè¿œå ã§ããããã«ãªããŸããã å€èšèªããã°ã©ããšããŠããããŒã...ããã¯é¢çœãã§ãããä»ã®èšèªã§ã¯ç°ãªãåäœãããŸããïŒããšããæèŠãã©ã®ãããæã£ãŠããŸããïŒ
JSïŒ ã·ã§ãŒããµãŒããã ã ã¯ããŒãžã£ããå€éšå€æ°ãåç §ãããšããããã¯æ¬åœã«ã©ãããæå³ã§ããïŒ ç°ãªãèšèªã«ã¯ç°ãªãçãããããŸã... CïŒã§ã¯ããã®è³ªåã«å¯Ÿããçãã¯æéãšãšãã«å€åããŸãïŒCïŒ2.0-4.0ã§foreachã§ã«ãŒãå€æ°ããã£ããã£ãããšãæçµçã«ã¯ã·ãŒã±ã³ã¹ã®åå€ã«å¯ŸããŠåãå€æ°ããã£ããã£ããŸã; CïŒ 5.0ã§ã¯ãåå埩ã§æ°ããå€æ°ããã£ããã£ãããŸãïŒã
DNCïŒ CïŒã®æã«æ»ããŸããã©ã®é¢æ°ãåžžã«å¿ èŠã§ãããã決ããŠå®è£ ãããŸããããŸãã¯ããåäžã®ãé¢æ°ãCïŒã«è¿œå ã§ãããšããããããã¯äœã§ããããã
JSïŒ äœããã®åœ¢ã§äžå€åã®ãµããŒããå¢ãããããšæããŸãã 圹ã«ç«ã€å Žæã¯ãããããããŸãã ããšãã°ãå¿ååã®åäœãæ°ã«å ¥ã£ãŠããŸããEqualsãGetHashCodeãToStringã¡ãœããã䟿å©ãªæ¹æ³ã§ãªãŒããŒã©ã€ãããããããã£ã«å¿ èŠãªååãä»ããããšãã§ãããåã«äžå€ã®ã¯ã©ã¹ã§ãã éåžžã®ã¯ã©ã¹ã§ãåãããšãã§ããã°ãåããããç°¡åã§ãïŒ ããã€ãã®ããããã£ãå«ããéåžžã®ãã¯ã©ã¹ãäœæããå€ãåããããŸããŸãªã¡ãœããããªãŒããŒã©ã€ãããã³ã³ã¹ãã©ã¯ã¿ãŒã䜿çšããŠãã³ãŒããå°ããã€ã©ãŒãã¬ãŒãã«ããŸãïŒãã€ã©ãŒãã¬ãŒãã³ãŒã-ããã¯ãå°ããªå€æŽã§äœåºŠãåçŸãããããã°ã©ã ã³ãŒãã®ç¹°ãè¿ãéšåã®ååã§ãïŒãç¹ã«æ¬åœã«èªã¿åãå°çšã®å€æ°ãäœæããããããã©ã€ããŒãseterãæã€ããããã£ã¯æããªãããã«ããŸãã
ããã«ãäžå€åãäœæããããã®ãµããŒããå¢ãããããšæããŸãããªããžã§ã¯ããšã³ã¬ã¯ã·ã§ã³ã®åæååã¯é©åã§ãããå¯å€åã§ã®ã¿æ©èœããŸãã ãã«ããŒãã¿ãŒã³ã䜿çšã§ããŸãããããŸããããã§ã¯ãããŸããã ãã¿ãŒã³ãã«ããŒã«é¢é£ä»ããããæ©èœãè¿œå ããããšã¯ãèšèªã«èå³æ·±ãè¿œå ãå ãããã©ããçåã§ãã å°ãªããšãååä»ãåŒæ°ãšããã©ã«ããã©ã¡ãŒã¿ã¯ã代æ¿æ©èœãæäŸããŸãã ãã¡ããããããã®ã¢ã€ãã¢ã¯è¡šé¢çãªã¬ãã«ã§ã®äžå€æ§ã«é¢ãããã®ã§ãã æ·±ãäžå€æ§ã¯è€éã§ããã倧ããªå©ç¹ããããŸãã ç§ã¯ãCïŒããŒã ããã®å©ç¹ãèªèããŠããããšãç¥ã£ãŠããŸããå¹æçãªãœãªã¥ãŒã·ã§ã³ãèãåºãããšãã§ããã°ãããã¯çŽ æŽãããããšã§ãã
DNCïŒ CïŒã¯éçã«åä»ããããèšèªãšããŠå§ãŸããŸããããå€ãã®åçãªæ©èœãåŒãåããŸããã CïŒã«è¿œå ã§ããé©æ°çãªãã®ã¯ãããŸããããããšãæ¢åã®ãã®ã®é²åã§ããããïŒ
JSïŒããã«é¢ããŠæãèå³æ·±ãã®ã¯ãå ã åçèšèªã«ç»å Žããé¢æ°ã®å€ããå®éã«ã¯åçã§ã¯ãªããšããããšã§ãã LINQã¯å®å šã«éçã«åæå®ãããŠããŸããããªã¹ããžã§ãã¬ãŒã¿ãŒã¯ãã®åã«Python-eã§ç»å ŽããŸããã ãŸãããvarãã䜿çšãããšãCïŒã¯åçèšèªã®ããã«èŠããŸãããåã®å®å šæ§ã¯å€±ãããŸããã ãã¡ãããCïŒ4.0ã§è¿œå ããããåçãã¿ã€ãã¯ãŸã£ããå¥ã®åé¡ã§ãã
CïŒ5.0ïŒããã³åœç¶ã®ããšãªããVBïŒã§è¿œå ãããæ°ããasync / awaitæ©èœãã²ãŒã ãå€ãããšæããŸãã
ä»ã®ããŸã人æ°ã®ãªãããã°ã©ãã³ã°èšèªã«ãåæ§ã®æ©èœãååšããããšã¯ç¥ã£ãŠããŸãããæ®éã®éçºè ã«ãšã£ãŠã¯å€§ããªå©çã«ãªããšæããŸãã ã¹ãã²ããã£ã³ãŒãã«å€æããã«éåæã³ãŒããäœæããæ©èœã¯çŽ æŽãããã§ãã ç§ã¯ãã®æ©èœã«æ¬åœã«è奮ããŠãããå€ãã®äººãããŒã¿æäœã«ã€ããŠèããæ¹æ³ãLINQãå€ãããšæãã®ã§ãã³ãŒãã£ã³ã°ã®ç解ãå€ããããšãæåŸ ããŠããŸãã
DNCïŒ CïŒ5.0ã®ReadOnlyCollectionsã®ãµããŒãã§ã®ã¿å€æŽããããšæãããäžå€æ§ã«å ããŠãCïŒ6.0ã®ãŠã£ãã·ã¥ãªã¹ãã«ã¯ä»ã«äœããããŸããïŒ
JSïŒç§ãæäŸã§ããã®ã¯ããã ãã§ããCïŒããŒã ã®é ã®äžã«ã¯ãã£ãšçŽ æŽããããã®ããããšç¢ºä¿¡ããŠããŸãã äžå€åã®ãµããŒãã®æ¹åã«ã€ããŠã¯æ¢ã«è©±ããŸããããŸããã³ãŒããéåžžã«ç°¡åã«ããã¿ãã«ã®ãµããŒãã®æ¹åãèŠãããšæããŸãããCïŒã§äžèŠãªæ©èœã®æ±æãé¿ããããšãéèŠã ãšèããŠããŸãã éçºããŒã ã¯ãæ°ããæ©èœã®æ°Žæºãé«ãç¶æããå¿ èŠããããŸããããã¯ãéçºè ãæéããããŠåŠç¿ãããšããäºå®ã«äŸåããå¯äžã®æ¹æ³ã§ãã ããŒãžã§ã³1.0ããCïŒââãåŠã¶ããšãã§ããã®ã¯å¹žéã§ããããCïŒ5.0ã§CïŒãåŠã³å§ãããšæ³åã§ããŸããïŒ æè¿è¿œå ãããæ©èœãå«ããèšèªå šäœãåŠç¿ããã®ã«ã©ããããæéãããããŸããïŒ ïŒå®å šã§ãªãã³ãŒãã«ã¯è¿ã¥ããªãã€ããã§ããå®éãèšèªã®ç¥èããã»ã¯ã·ã§ã³å šäœãåãåããŸãã決ããŠå¿ èŠãšããªãããšãæã¿ãŸãïŒã
DNCïŒ Protobufãããžã§ã¯ãïŒ.NETã«ç§»æ€ïŒã«ã€ããŠèªè ã«è©³ãã説æããŸãã Protobufãããžã§ã¯ãã«å ããŠãçŸåšåãçµãã§ãã極ç§ãããžã§ã¯ãã¯ãããŸããïŒ
JSïŒãããã³ã«ãããã¡ã¯ãGoogleã®æ§é åããŒã¿ãè¡šãããã«äœ¿çšãããŸãã ããã¯ãæ§é ãèšè¿°ããããã®éåžžã«åçŽãªèšèªã§ãããä¿åãšäŒéã®ããã®æãå¹ççãªãã¬ãŒã³ããŒã·ã§ã³ã§ãã ããã¯ãã©ãããã©ãŒã ã«äŸåããªã圢åŒã§ããã䜿çšããŠãããã©ââãããã©ãŒã ãé©åãªã©ã€ãã©ãªããµããŒãããŠããå Žåã«æããã«åœ¹ç«ã€ã§ãããã Googleã¯ãProtocol Buffersãããžã§ã¯ãã«åå ããŠã»ãŒããã«ãªãŒãã³ã«ãã.NETã«ç§»æ€ããããšã«ããŸããã ç§ã®ããŒãžã§ã³ã¯ãGoogleãæäŸããJavaããã³C ++ããŒãžã§ã³ãšã»ãŒåçã§ãããä»ã®ããŒãããããŸãã ç¹ã«ãMarc Gravellã.NETçšã®ProtobufããŒãžã§ã³ã§èå³æ·±ãä»äºãããããšã¯ç¥ã£ãŠããŸãã
çŸåšãç§ã¯ãããã³ã«ãããã¡ã«ããŸãåãçµãã§ããŸãã-ãªãŒãã³ãœãŒã¹ã³ãŒãã£ã³ã°ã®ã»ãšãã©ã¯ãJodaTimeã®Javaçšã®æ¥ä»/æå»ã©ã€ãã©ãªãåããããŒããšããŠå§ãŸã£ãNodaTimeã«è²»ãããŠããŸãããæçµçã«ã¯JodaTimeãšã³ãžã³ããŒãã«ãªããŸãããããã®äžã«ããªãç°ãªãAPIãåããŠããŸãã ããã¯ãAPIèšèšã«ã€ããŠåŠã¶ã®ã«æ¬åœã«è¯ããããžã§ã¯ãã§ãã
DNCïŒ CïŒã«ã€ããŠ3ã€ã®èå³æ·±ã質åãèªè ã«ãå°ããã ããã
JSïŒ OKïŒ ããŸããŸãªè€éãã®ããã€ãã®è³ªåïŒ
質å1ïŒãã®ã³ã³ã¹ãã©ã¯ã¿ãŒã䜿çšããŠããã®ã³ãŒããå°å·ã§ããŸãTrueïŒMicrosoftã®.NETå®è£ ïŒ
object x = new /* fill in code here */; object y = new /* fill in code here */; Console.WriteLine(x == y);
ããã¯åãªãã³ã³ã¹ãã©ã¯ã¿ãŒåŒã³åºãã§ãããå€æ°ã®ã¿ã€ãã¯å€æŽã§ããªãããšã«æ³šæããŠãã ããã
質å2ïŒãã®ã³ãŒããã³ã³ãã€ã«ããŠã3ã€ã®ç°ãªãã¡ãœããã®ãªãŒããŒããŒããåŒãèµ·ããã«ã¯ã©ãããã°ããã§ããïŒ
void Foo() { EvilMethod<string>(); EvilMethod<int>(); EvilMethod<int?>(); }
質å3ïŒããŒã«ã«å€æ°ã䜿çšããŠããã®ã³ãŒãã2è¡ç®ã«ã©ã®ããã«ããããã§ããŸããïŒ
string text = x.ToString(); // No exception Type type = x.GetType(); // Bang!
DNCïŒ StackOverflowã§èå³æ·±ãäŒè©±ã1ã€ãŸãã¯2ã€éžæã§ããŸããïŒ ïŒå人çã«ã¯ããžã§ã³ã»ã¹ããŒãã«é¢ããäºå®ãèªãã®ã奜ãã§ã:)ïŒ
JSïŒã¯ãããžã§ã³ã¹ããŒãã«é¢ãããã¡ã¯ãã·ãŒããæ°ã«å ¥ã£ãŠããŸãã ãããç§ã®ãã¹ãŠã§ã¯ãªããšããããšãèšã£ãããã«ãç§ã¯æ¥œãã¿ã®ããã«ãããæããã®ã«äŸ¿å©ãªååã§ãã ç§ãæ°ã«å ¥ã£ãŠããæçš¿ã¯ãCïŒã«ã€ããŠäœãæ°ããããšãåŠãã æçš¿ããŸãã¯æ¬åœã«æãããã³ãŒããæžãçç±ãäžããæçš¿ã§ããéåžžãã³ã¡ã³ããšãšãã«-ãããã¯ã²ã©ãã§ããå®ç掻ã§ã¯äœ¿ããªãã§ãã ãããã Eric Lippertããããã®æçš¿ã®1ã€ã«ã³ã¡ã³ããè¿œå ãããšããç§ã¯éåžžã«æºè¶³ããŠããŸãã-ãããã¯ç§ãä»ãŸã§èŠãCïŒã®æ倧ã®æªçšã§ããã CïŒã¢ããã¥ã¢éçºè ã§ããããšã®å©ç¹ã®1ã€ã¯ãçµæãåºããã«ãã®ãããªã³ãŒããèšè¿°ã§ããããšã§ãã
DNCïŒåå¿è /è¥ãéçºè ãã䞊å€ããããã°ã©ããŒã§ããJohn Skeetã®ããã«ãªãããå Žåãã©ãããå§ããŸããïŒ ããã°ã©ãã³ã°ã§ãžã§ã³ã¹ããŒãã®ããã£ãŒãã³ããŒããäœæããããšã¯å¯èœã§ããïŒ
JSïŒãããããããŒã¯ãã£ãšé«ãä¿ãããªããã°ãªããŸããïŒ ããªããç§ã®ååãšè©±ãããå Žåãè€æ°åèããããšãããã®ã§ãç§ã®èœåã®ãããã¯éåžžã«èªåŒµãããŠããŸãã ç§ã¯å€ãã®äººã ããã詳现ã«CïŒä»æ§ãèªã¿ãæå³çã«èšèªãæªçšããæèœããããã³ãã¥ãã±ãŒã·ã§ã³ã¹ãã«ã¯ååã§ãããããã«ããããããç§ã¯å°é家ã§ã¯ãããŸããã APIãšèšèªã®èšèšã«ã€ããŠã¯åŒ·ãæèŠããããŸãããã¢ããªã±ãŒã·ã§ã³å šäœãæžãããã«é Œããšç¡åã«ãªããŸãã