Not your computer? Use a private browsing window to sign in. Learn more about using Guest mode
以ä¸ã¯ãããã¿ã¤ãçç¶æ¿ã ãã§ä¸éãã®æ©è½ãå®ç¾ã§ãããã¨ããä¸ã¤ã®ä¾ã§ãããã¡ããä»ã«ãæ¸ãæ¹ã¯ããã¾ãããnewã使ãã®ããããªãã¨ä¸»å¼µãã¦ããããã§ã¯ãªãã§ãã (誤解ãçã¿ãããªæä½ãæ··ãã£ã¦ãããããªã®ã§è¿½è¨: 2011/5/14) æ¥ã§ãããå°ãåå¿è åãã®è¨äºãæ¸ãã¾ããã¿ã¤ãã«éããJavaScriptã®ãªãã¸ã§ã¯ãæåã«ã¤ãã¦ãã¡ãã£ã¨é·ããªãã®ã§ç®æ¬¡ã§ãã ã¯ã©ã¹ï¼ã«ç¸å½ãããªãã¸ã§ã¯ãï¼ãä½ã ãªãã¸ã§ã¯ããããªãã¸ã§ã¯ããä½ãï¼ã¤ã³ã¹ã¿ã³ã¹åï¼ åä¸ç¶æ¿ å¤éç¶æ¿ privateã¯è«¦ãã¾ããã 親ã®ã¡ã½ãããå¼ã¶ ã³ã³ã¹ãã©ã¯ã¿ instanceofã«å¯¾å¿ãã ããã¯ã¿ã¤ãã³ã°ã®ã¹ã¹ã¡ JavaScriptæ¨æºã®ãªãã¸ã§ã¯ãæåã¨ããã°newããprototypeãããæ¸ãå¿ è¦ãããã¾ããããããã¯æ¸ãã®ãé¢åèãä¸ã«æ°ãã¤ããªãã¨ãããªãç¹ãããããããã¾ããJa
éæ¾/ééååï¼ããã»ãã¸ãããããããopen/closed principleãOCPï¼ã¨ã¯ããªãã¸ã§ã¯ãæåããã°ã©ãã³ã°ã®è¨è¨ã¸ã®æè¨ã§ããã ã½ããã¦ã§ã¢è¦ç´ ï¼ã¯ã©ã¹ãã¢ã¸ã¥ã¼ã«ãé¢æ°ãªã©ï¼ã¯ãæ¡å¼µã«å¯¾ãã¦ã¯éãã¦ãããä¿®æ£ã«å¯¾ãã¦ã¯éãã¦ããã¹ãã§ããã software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification.[1] ãã®ååã«å¾ã£ã¦ããã°ãã½ã¼ã¹ã³ã¼ãã®ä¿®æ£ãããã¨ããåè¦ç´ ã®æ¯ãèããæ¡å¼µãããã¨ãå¯è½ã«ãªãã¨ãã¦ããã ãã®éæ¾/ééã®ååã¯ã1988å¹´ã«ãã¼ãã©ã³ãã»ã¡ã¤ã¤ã¼ãæå±ãããã®ã¨ã1996å¹´é ã«ããã¼ãã»Cã»ãã¼ãã³ï¼è±èªçï¼ããæå±ãããã®ã®äºéãããããã©ã¡ããç¶æ¿ãããªã¢ã¼ãã£ãºã ã«ãã
> ããã¯ã»ã¿ã¤ãã³ã°ã®ã¡ãªãããæãã¦ãã ããã ã¡ãªããã¯ãªã³ã¯å ã«æ¸ããã¦ãã ããªãã¸ã§ã¯ãï¼å¤æ°ã®å¤ï¼ã«ä½ãã§ãããã¯ãªãã¸ã§ã¯ããã®ãã®ã決å®ãããã§ã¯ãªãã§ããããã ãªã³ã¯å ã®Rubyã¹ã¯ãªããä¾ã§è¨ãã°ãtestã®å¼æ°ã«ä¸ãããããªãã¸ã§ã¯ãã«soundã¨ããã¡ã½ãããå¨ãããããã°ãããã«å¿ããæ»ãå¤ãè¿ãã¨ãããã¨ã§ãã > ããªãã¸ã§ã¯ããããã¤ã³ã¿ãã§ã¼ã¹ã®ãã¹ã¦ã®ã¡ã½ãããæã£ã¦ãããªãã°ãï¼ä»¥ä¸ç¥ï¼ã ã«ã¤ãã¦ã¯ä»¥ä¸ã®ãããªã¹ã¯ãªããã§ã¯å¦ä½ã§ãã def test(foo) puts foo.sound end class Duck def sound 'quack' end end class Cat def sound 'myaa' end end dog = String.new("pochi") def dog.sound 'bow' end tes
ã¤ã³ã¹ã¿ã³ã¹ã®åå¨ã¨ç¡é¢ä¿ã«ã¯ã©ã¹å ±éã®ãã£ã¼ã«ããæããã¦ã Ex1.str = "hoge"; Ex2.str = "moga"; ã®ãããªæ¸ãæ¹ãããã訳ã§ã¯ãªãã Ex1 ex1 = new Ex1(); ex1.str = "hoge"; ã®ããã«å¸¸ã«ã¤ã³ã¹ã¿ã³ã¹ãä»ãã使ãæ¹ã§ã åãã¯ã©ã¹ã«å±ããã©ã®ã¤ã³ã¹ã¿ã³ã¹ã«ãå ±éãããããã ããããã®ã¯ã©ã¹ã§å®£è¨ããã®ã¯é¢åãªã®ã§ã ã§ããã°ã¹ã¼ãã¼ã¯ã©ã¹ã§å¦çãä¸å çã«è¨è¿°ãããã¨ãããã¨ãªãã ç´æ¥ãã£ã¼ã«ãã«ã¢ã¯ã»ã¹ããããæ¹ã§ã¯ãªããã 以ä¸ã®ããã«ã¹ã¼ãã¼ã¯ã©ã¹ã«ã¤ã³ã¹ã¿ã³ã¹ã¡ã½ããã®ã¢ã¯ã»ããµãå®ç¾©ãã¦ã Classã¯ã©ã¹ããã¼ã«ãã¦ã¯ã©ã¹å¤æ°ã®Mapã«æ ¼ç´ãã¦ããæ¹æ³ãããã public abstract class AbstractStatic { private static java.util.HashMap<
.NETã§ç°¡åãªä¾ãè¦ã¦ã¿ã¾ãããã public Person : INotifyPropertyChanged { string firstName, lastName; public event NotifyPropertyChangedEventHandler PropertyChanged; protected void OnPropertyChanged(string propertyName) { if ( this.PropertyChanged != null ) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } public string FirstName { get { return this.firstName; } set { this.firstName
Facade ãã¿ã¼ã³ããã㯠Façade ãã¿ã¼ã³ï¼ãã¡ãµã¼ãã»ãã¿ã¼ã³ï¼ã¨ã¯ãGoFï¼Gang of Four; 4人ã®ã®ã£ã³ã°ãã¡ï¼ã«ãã£ã¦å®ç¾©ããããã³ã³ãã¥ã¼ã¿ã½ããã¦ã§ã¢ã®ãã¶ã¤ã³ãã¿ã¼ã³ã®1ã¤ã§ãããFacadeï¼ãã¡ãµã¼ãï¼ã¨ã¯ã建ç©ã®æ£é¢ããæå³ãããç°ãªããµãã·ã¹ãã ãåç´ãªæä½ã ããæã£ãFacadeã¯ã©ã¹ã§çµã³ããµãã·ã¹ãã éã®ç¬ç«æ§ãé«ããäºãç®çã¨ããã Facadeãã¿ã¼ã³ã®ä¾ã¨ãã¦ããµãã·ã¹ãã ã¨ãã¦ã®ã³ã³ãã¤ã©ã¼ãèãããã·ã¹ãã ã¨ãã¦ã®ã³ã³ãã¤ã©ã¼ã¯åå¥è§£æå¨ãæ§æ解æå¨ãªã©ããæ§æããã¦ããããããã®æ§æè¦ç´ ã¯ãæ°ããªã³ã³ãã¤ã©ã¼ããã®ä»ã½ããã¦ã§ã¢ãä½æããä¸ã§ãµãã·ã¹ãã ã¨ãã¦å©ç¨ãããã¨ãåºæ¥ããããããä¸è¬ã¦ã¼ã¶ã¼ã«ã¨ã£ã¦ã³ã³ãã¤ã©ã¼ã¯ã½ã¼ã¹ã³ã¼ãããããã°ã©ã ãçæããããã®ãã®ã§ãããã½ã¼ã¹ã³ã¼ããã³ã³ãã¤ã«ã§ããæ©è½ãããã°ååã§ããã
ã¯ããã« Visual Basicãç¬èªã®ã¯ã©ã¹ãä½æãã¦ä½¿ããããã«ãOfficeã«æè¼ããã¦ããVBAã§ãç¬èªã®ã¯ã©ã¹ãããã¸ã§ã¯ãã«çµã¿è¾¼ããã¨ãã§ãã¾ããä½æããã¯ã©ã¹ã¯ãåOfficeã¢ããªã±ã¼ã·ã§ã³ã§ãã¤ã³ãã¼ãããã¨ã¯ã¹ãã¼ãããã§ãããããæ±ç¨æ§ã®ããã¯ã©ã¹ã1ã¤ä½æããã°ä»ã®ã¢ããªã±ã¼ã·ã§ã³ã®VBAã§ãå©ç¨ã§ããããã«ãªãã¾ãã ããã§ãæ¬ç¨¿ã§ã¯Excel 2003ã§å©ç¨ã§ããã¯ã©ã¹ãä½æããªãããVBAã§ã¯ã©ã¹ãä½ãæ¹æ³ãç´¹ä»ãã¾ãã 対象èªè Excel VBAã使ã£ã¦ãã¯ãï¼ããã°ã©ã ï¼ãä½ã£ããã¨ã®ãã人ãVisual Basicã使ãã人ã対象ã§ãã å¿ è¦ãªç°å¢ Excel 2000ã2002ã2003ã使ç¨ã§ããç°å¢ã ã¯ã©ã¹ã¯ä¾¿å© VBAã§ã¯ã©ã¹ãä½æããã¡ãªããã¯ãè¤éãªå¦çã1ã¤ã®ãªãã¸ã§ã¯ãã«ã¾ã¨ããããããã£ãã¡ã½ãããéãã¦ãã®æ©è½ãå¼ã³åºãããã
ãã¦ããããããããªã¢ã¼ãã£ãºã ãã®ã話ã§ãã ããªã¢ã¼ãã£ãºã ãªãã¦ãèãããã¨ããªããããªåèªã§ãã é£ãããã§ããã ããªã¢ã¼ãã£ãºã ï¼polymorphismï¼ã®âpolyâã¯ãããªã´ã³ã®âããªâã§ãã ç´è¨³ããã¨ããå¤å½¢ãå¤å½¢æ§ããªã©ã®è¨èã«è¨³ããã¾ãã ãªãã¸ã§ã¯ãæåããã°ã©ãã³ã°ã®ç¨èªã§ã¯ããå¤æ æ§ãã¨å¼ã°ããããã§ãã å¤æ æ§ã¨ããã®ãé£ããåèªã§ãã ã§ãã¾ããã¯ããããå°éç¨èªãããã人ã¯ãã¾ããã èãããã¨ãªãé²ãã¦ããã¾ãããã ç®æ¬¡ ç®çã¯ï¼ Object åã¨ããªã¢ã¼ãã£ãºã Implements ã¹ãã¼ãã¡ã³ã ä¸éã¾ã¨ã æ½è±¡ã¯ã©ã¹ Implements ã¨ã¤ã³ã¿ã¼ãã§ã¤ã¹ Implements ã¨ããªã¢ã¼ãã£ãºã ã¾ã¨ã ç®çã¯ï¼ âå¤âã¨ããæåããå¯ããã«ãããªã¢ã¼ãã£ãºã ã¯ãè¤æ°ã®ã¯ã©ã¹ãå©ç¨ããããã¸ã§ã¯ãã«ããã¦æå¹ãªæè¡ã§ããæ¯è¼çè¦æ¨¡ã®å¤§
Constructor for VBA class module ã«ã¤ã㦠ç®ç VBA ã®ã¯ã©ã¹ ã¢ã¸ã¥ã¼ã«ã«ããã¦ãå¼æ°ã渡ããã¨ã®ã§ããæ¬ä¼¼ã³ã³ã¹ãã©ã¯ã¿ãæä¾ãã¾ãã 使ãæ¹ å¯¾è±¡ã®ããã¸ã§ã¯ãã«ä»¥ä¸ã®äºã¤ã®ã¢ã¸ã¥ã¼ã«ãä½æãã¾ãï¼ä»ã®ã¢ã¸ã¥ã¼ã«ã¯ãã¹ãç¨ãªã®ã§ãä¸è¦ã§ãï¼ã IConstructor (ã¯ã©ã¹ ã¢ã¸ã¥ã¼ã«) modConstructor (æ¨æºã¢ã¸ã¥ã¼ã«) 対象ã®ã¯ã©ã¹ã¢ã¸ã¥ã¼ã«ã®ãããã¼ã«ã以ä¸ã®ã¹ãã¼ãã¡ã³ããè²¼ãä»ãã¾ãã Implements IConstructor VBE ã® [ãªãã¸ã§ã¯ã] ããã¯ã¹ãããIConstructorããé¸æããæ¿å ¥ãããã³ã³ã¹ãã©ã¯ã¿ç¨ããã·ã¼ã¸ã£å ã«åæåç¨ã®å¦çãè¨è¿°ãã¾ãã å¼ã³åºãå´ã¯ã以ä¸ã®ããã«è¨è¿°ãã¾ãã Set var = Constructor(New MyClass, "Doe, John", #5
null ã¯ãªãã¸ã§ã¯ãã§ãªã â null ã¯åç §å¤ (reference value) ãªã®ã§ == != ã«ããæ¯è¼ã¯ã§ããã ããã null ã¯ãªãã¸ã§ã¯ãã§ã¯ãªãããã®ããï¼ãã¡ãã¡ if (obj == null) ã¨æ¡ä»¶å¤å®ãããªããã°ãªããªãã ããã¯ï¼ããããï¼ããªã¢ã«ãã£ãã¯ãªã¡ã½ããã«ãã㦠ï¼ã¯ã©ã¹ã®éãã«ãããã£ã¹ããããããã«ï¼instanceof ã«ããå ´ååãããããããªãã®ã§ï¼ ã³ã¼ãã®ç¾ãããæãªãâã·ã³ãã«ã§ãªããªãâä¿å®ãå°é£ã«ãªãã¨ããæ»å£ºã«è½ã¡ã¦ããèªå ã¨ãªãã ç´ç²ãªãªãã¸ã§ã¯ãæåããã°ã©ãã³ã°ã®è¦³ç¹ããã¯ï¼ Null ã¯ã©ã¹ã«å¯ä¸ã®ãªãã¸ã§ã¯ã null ãç¨æããã¦ãã ã¨ããã°ããã£ãã ããã ããã¤ãã®ãªãã¸ã§ã¯ãæåè¨èªãæ¯è¼ããã¨ï¼ãã®æ¹æ³ãæãç¾ããæããããã Java ã§ãåçãªãã¨ãã§ããªããã¨ã¯ãªãããã¨ãã° stat
ãã®è¨äºã«ã¯è¤æ°ã®åé¡ãããã¾ããæ¹åããã¼ããã¼ã¸ã§ã®è°è«ã«ãååãã ããã åºå ¸ãã¾ã£ãã示ããã¦ããªããä¸ååã§ããå 容ã«é¢ããæç®ãæ å ±æºãå¿ è¦ã§ããï¼2021å¹´12æï¼ è注ã«ããåºå ¸ãåèæç®ã®åç §ãä¸ååã§ããè注ã追å ãã¦ãã ãããï¼2021å¹´12æï¼ ã»ã¨ãã©ã¾ãã¯å®å ¨ã«ä¸ã¤ã®åºå ¸ã«é ¼ã£ã¦ãã¾ããï¼2021å¹´12æï¼ ç¬èªç 究ãå«ã¾ãã¦ããããããããã¾ããï¼2021å¹´12æï¼ åºå ¸æ¤ç´¢?: "ãªã¹ã³ãã®ç½®æåå" â ãã¥ã¼ã¹Â · æ¸ç±Â · ã¹ã«ã©ã¼Â · CiNii · J-STAGE · NDL · dlib.jp · ã¸ã£ãã³ãµã¼ã · TWL ãªã¹ã³ãã®ç½®æååã®æ¦å¿µã¯ããã¼ãã©ã»ãªã¹ã³ãã«ããåãã¦å°å ¥ãããã2010å¹´ã«æ®å½±ãããåçã ãªã¹ã³ãã®ç½®æååï¼ããããµã®ã¡ãããããããè±: Liskov substitution principleï¼ã¯ããªãã¸ã§
ã¯ããã« ã½ããã¦ã§ã¢ã»ãã¿ã¼ã³ã¨ããè¨èãèãããã¨ãããã ããããã½ããã¦ã§ã¢ã»ãã¿ã¼ã³ã®ä¸ã§ã¯ãã¶ã¤ã³ã»ãã¿ã¼ã³ãæåã§ããããã§ã«å®éã®éçºç¾å ´ã§é©ç¨ããã¦ããæ¹ãå¤ãã¨æãããã ãã¶ã¤ã³ã»ãã¿ã¼ã³ä»¥å¤ã«ãå¤ãã®ã½ããã¦ã§ã¢ã»ãã¿ã¼ã³ãåå¨ãã¦ããã®ã ããæ®å¿µãªããããã¶ã¤ã³ã»ãã¿ã¼ã³ä»¥å¤ã®ãã¿ã¼ã³ã«ã¤ãã¦ã¯ãã¾ãããç¥ããªãã¨ããæ¹ãå¤ãã®ã§ã¯ãªãã ãããã ã½ããã¦ã§ã¢ã»ãã¿ã¼ã³ã«é¢ããç¥èã¯ãæã ã½ããã¦ã§ã¢éçºè ã«ã¨ã£ã¦ãä»å¾ã¾ãã¾ãéè¦ã«ãªã£ã¦ããã§ãããã æ¬é£è¼ã§ã¯ãã½ããã¦ã§ã¢ã»ãã¿ã¼ã³ã«ã¤ãã¦å¦ã³ããèªè ãããã¶ã¤ã³ã»ãã¿ã¼ã³ã¯ç¥ã£ã¦ããããã©ä»ã®ãã¿ã¼ã³ã«ã¤ãã¦ã¯ãã¾ãç¥ããªãã¨ããèªè ã対象ã«ããã¾ãã¾ãªã½ããã¦ã§ã¢ã»ãã¿ã¼ã³ã«ã¤ãã¦è§£èª¬ãã¦ããäºå®ã ã ã½ããã¦ã§ã¢ã»ãã¿ã¼ã³ã¨ã¯ ãããããã½ããã¦ã§ã¢ã»ãã¿ã¼ã³ã¨ã¯ä½ã ããããã²ã¨è¨ã§ããã°ãã½ããã¦ã§ã¢
1999/09/03 æ´æ° ç³äº å ãã¦ï¼ãã®ã»ã¯ã·ã§ã³ã§ã¯ãã¶ã¤ã³ãã¿ã¼ã³ãçµ±ä¸çã«ç解ããããã«ï¼ã Open-Closed Principle (OCP) ã ã¨ããè¨è¨ã«ã¼ã«ã«åºã¥ãã¦ãã¿ã¼ã³ãçºãã¦ã¿ããã¨ã«ãã¾ãï¼ã¾ã OCP ã®æå³ã¨è§£èª¬ãè¡ãï¼ãã®å¾ãã¶ã¤ã³ãã¿ã¼ã³ã OCP ã®è¦³ç¹ããè¦ã¦ã¿ã¾ãï¼å®ã¯ï¼ãã¶ã¤ã³ãã¿ã¼ã³ã®ãã¡ã®å¤ã㯠OCP ãæºããããã«ç¨æããããã®ã¨èãããã¨ãã§ããã®ã§ãï¼ãã®ã»ã¯ã·ã§ã³ã§ã¯ï¼ OCP ãç解ãï¼æ°ãããã¶ã¤ã³ãã¿ã¼ã³ã®ä¸ããã©ãããå ´åã«ã©ã®ãã¿ã¼ã³ã使ãã®ãä¸çªå¹æçãªã®ããèãã¾ãï¼ GoF ã®ãã¶ã¤ã³ãã¿ã¼ã³ã¯ï¼å ¨é¨ã§ 23 åãã®ãã¿ã¼ã³ãããã¾ãï¼ãã®ãã¶ã¤ã³ãã¿ã¼ã³ã¯ï¼å¤ãã®å±é¢ã§ç¹°ãè¿ãç¾ããè¨è¨ãæ½åºãããã®ã§ãããï¼ãªãã¸ã§ã¯ãæåã®ã¨ãã»ã³ã¹ãéãããã®ã ã¨è¨ããã§ãããï¼ãªãã¸ã§ã¯ãæåã«ã¯ï¼ã«ãã»ã«åï¼ç¶
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}