èªæ¸ã¡ã¢
èªæ¸ã¡ã¢ã対象ãã§ãããããã©ãã©èªãã§ãã®ã§ãã¾ãã¾ã¨ã¾ã£ã¦ãªã å ¨è¬çã«ãããã DDD æ¬(ã¨ãªãã¯ã»ã¨ã´ã¡ã³ã¹ã®æ¬)ã®ã¨ãã»ã³ã¹ãæ示ããã¦ããç« ãè°è«ã¯ãããªãã«è±ãå²ãããã ãã©ãçµè«ã¯ã¨ã´ã¡ã³ã¹æ¬èªãã«ãªãããã以ä¸ã¯å人çã«ãã£ã¨â¦
ã¯ã©ã¦ãã«ããã»ãã¥ãªãã£ã®ååã説æããã®æ§æè¦ç´ ã«ã¤ãã¦ã解説ãã¦ããã ã¯ã©ã¦ãçèãæ¹ã«ããã¡ãªãã ã¯ã©ã¦ãã®æä¾ããå¯è½æ§ï¼æ©è½ï¼ãä½ãã¨ããªãæ´»ç¨ã§ããè¨è¨ 12 Factor App Cloud Native 3 ã¤ã® R(å¾è¿°) 12 Factor App + PaaSã§ã®ç¨¼åâ¦
èªæ¸ä¼ã«åå ããã®ã§ãã¾ã¨ãã¦ããã ã 2.1 ãã¸ãã¹ã«ã¼ã«ã®è¦³ç¹ã«ãããå®å ¨æ§ã®åé¡ ä¸æ£ãªãã¼ã¿å ¥åã«ãã£ã¦æ失ãçºçãã¦ã ä¸æ£ãªãã¼ã¿ã«å¯¾ãããµãã·ã¹ãã ã®æ¯ãèããç°ãªã£ã¦ãã 2.2 æµ ãã¢ããªã³ã° æåã«ã¢ããªã³ã°ã§ããã¨æã£ããã¨ã«æ·±â¦
æ¥æ¬ã§ã¢ãããã話é¡ã«ãªã£ã¦ããç´ 3 å¹´ãæ¥æ¬ã§åºçããã¦ãã 1 å¹´åãããçµéããã§ããããããã£ã¨ ãã¢ãããã°ã©ãã³ã° ãã¹ããã©ã¯ãã£ã¹ããèªã¿çµãã£ãã
第åé¨ ã³ã³ãã¼ãã³ãã®åå SOLID åå = ã¬ã³ã¬ãçµã¿åããã¦é¨å±ãä½ã ã³ã³ãã¼ãã³ãã®åå = é¨å±ãçµã¿åããã¦å»ºç©ãä½ã §12 ã³ã³ãã¼ãã³ã ã³ã³ãã¼ãã³ã = ãããã¤ã®åä½ Java : jar Ruby : gem .NET : DLL ã³ã³ãã¼ãã³ãã®æ´å² ã¢ããªã±ã¼â¦
§10 ISP: ã¤ã³ã¿ã¼ãã§ã¼ã¹åé¢ã®åå å¿ è¦ã¨ããªãæ©è½ããã¤ã¢ã¸ã¥ã¼ã«ã«ä¾åããªã ã©ããã¦ãå¿ è¦ãªå ´åã¯ã¤ã³ã¿ã¼ãã§ã¼ã¹ãéã«æã §11 DIP: ä¾åé¢ä¿é転ã®åå ã½ã¼ã¹ã³ã¼ãã®ä¾åé¢ä¿ãå ·è±¡ã§ã¯ãªãæ½è±¡ãåç §ãã¦ããã®ãæãæè» å®å®ããæ½è±¡ã«â¦
§9 LSP: ãªã¹ã³ãã®ç½®æåå 1988å¹´ Barbara Liskov S åã®ãªãã¸ã§ã¯ã o1 ã®åã ã«ã対å¿ãã T åã®ãªãã¸ã§ã¯ã o2 ã 1 ã¤åå¨ãã T ã使ã£ã¦å®ç¾©ãããããã°ã©ã P ã«å¯¾ã㦠o2 ã®ä»£ããã« o1 ã使ã£ã¦ã P ã®æ¯ãèããå¤ãããªãå ´åã S 㯠T ã®â¦
§8 OCP: ãªã¼ãã³ã»ã¯ãã¼ãºãã®åå 1988å¹´ Bertrand Meyer ã½ããã¦ã§ã¢ã®æ§æè¦ç´ ã¯æ¡å¼µã«å¯¾ãã¦ã¯éãã¦ãã¦ãä¿®æ£ã«å¯¾ãã¦ã¯éãã¦ããªããã°ãªããªã(ãã¢ã¸ã£ã¤ã«ã½ããã¦ã§ã¢éçºã®å¥¥ç¾©ã) = ã½ããã¦ã§ã¢ã®æ¯ãèãã¯æ¢åã®ææç©ãå¤æ´ããã«æ¡å¼µâ¦
第ä¸é¨ è¨è¨ã®åå ã¯ãªã¼ã³ãªã³ã¼ããæ¸ãããã®ååãSOLID ååã å¤æ´ã«å¼·ãä¸éã¬ãã«ã®ã½ããã¦ã§ã¢æ§é ç解ããããä¸éã¬ãã«ã®ã½ããã¦ã§ã¢æ§é ã³ã³ãã¼ãã³ãã®åºç¤ã¨ãã¦ãå¤ãã®ã½ããã¦ã§ã¢ã·ã¹ãã ã§å©ç¨ã§ããä¸éã¬ãã«ã®ã½ããã¦ã§ã¢æ§é â¦
§6 é¢æ°åããã°ã©ãã³ã° ããã°ã©ãã³ã°ä»¥åããåå¨ãã(1930年代㮠Alonzo Church ã®ã©ã ãè¨ç®) é¢æ°åè¨èªã®å¤æ°ã¯å¤åããªã 並è¡å¦çã®åé¡ã¯å¯å¤å¤æ°ããªããã°çºçããªã å¤æ°ãå¤æ´ããã³ã³ãã¼ãã³ãã¨ä¸å¤ã®ã³ã³ãã¼ãã³ããåé¢ãã¦ãå¯å¤ã³ã³â¦
§5 ãªãã¸ã§ã¯ãæåããã°ã©ãã³ã° ãªãã¸ã§ã¯ãæåè¨è¨ã¨ã¯ä½ã§ãªãã é¢æ°ã¨ãã¼ã¿ã®çµã¿åãã o.f() vs f(o) - ãªãã¸ã§ã¯ãæåãçã¾ããåãããã£ã¦ã ç¾å®ã®ä¸çãã¢ãã«å - ä½ãè¨ã£ã¦ãããã ãå㯠ã«ãã»ã«å å¢çç·ã®å¤ããã¯ãã¼ã¿ãè¦ãâ¦
第äºé¨ ããã°ã©ãã³ã°ãã©ãã¤ã ãã©ãã¤ã â ããã°ã©ãã³ã°ã®æ¹æ³ 3ã¤ã®ããã°ã©ãã³ã°ãã©ãã¤ã §3 ãã©ãã¤ã ã®æ¦è¦ 3ã¤ã®ããã°ã©ãã³ã°ãã©ãã¤ã æ§é åããã°ã©ãã³ã° ãªãã¸ã§ã¯ãæåããã°ã©ãã³ã° é¢æ°åããã°ã©ãã³ã° ãã©ãã¤ã ã®ãã£ã¦ãâ¦
表é¡ã®éã §2 2ã¤ã®ä¾¡å¤ ããã°ã©ãã¼ãã¹ãã¼ã¯ãã«ãã¼ã«æä¾ãã2ã¤ã®ä¾¡å¤ æ¯ãèã æ§é æ¯ãèã å¤ãã®ããã°ã©ãã¼ã価å¤ã ã¨æãããã§ãããã® æ©è½ä»æ§æ¸ã¨ãè¦æ±ææ¸ã¨ã æ§é = ã¢ã¼ããã¯ãã£ã¼ æ¯ãèã = ã½ããã¦ã§ã¢ãç°¡åã«å¤æ´ã§ããæâ¦
以åããã¡ãã£ã¨ãã¤èªãã§ãããã©ããã®ã¾ã¨ãã¡ã¢ ãã®ã¡ã¢ãã¡ãã£ã¨ãã¤æ´æ°äºå® Clean Architecture 第ä¸é¨ ã¤ã³ãããã¯ã·ã§ã³ æ£ããã½ããã¦ã§ã¢ å°ãªã人æ°ã§ã½ããã¦ã§ã¢ãåããã å°ãªã人æ°ã§ä¿å®ã»éçºã§ãã §1 è¨è¨ã¨ã¢ã¼ããã¯ã㣠è¨è¨â¦
表è¨ã®ã¨ããã§ãã 1ã¶æãããããã£ã¡ããã¾ããã Amazon.co.jpï¼ ãããHaskellãã®ããå¦ã¼ã!: Miran LipovaÄa, ç°ä¸ è±è¡, æ主 å´è¡: æ¬amazon.co.jp å 容çã«ã¯Amazonã®ã«ã¹ã¿ãã¼ã¬ãã¥ã¼ã詳ããã§ãããèªåãªãã«æ¸ãã¨ãããªæãã§ãã Functâ¦
ãã®ãããªãªã¹ãã«å¯¾ããæ¨æºçãªå帰ãã¿ã¼ã³ã§ã¯ãå帰ãæ示çã«æ¸ãããããç³è¾¼ã¿ã使ãã»ããããã§ãããããã®ã»ããèªã¿ãããç解ããããããã§ããfoldrã®å¼ã³åºãã¯èª°ãè¦ã¦ãç³ã¿è¾¼ã¿ã§ãããæ示çãªå帰ãèªãã«ã¯èããæéãå¿ è¦ã§ãã â¦
第åç« å帰ãéè¦ãªçç± åé¡ã大ããªåé¡ããããå°ããªåé¡ã«å解ãã ãã以ä¸åããããªãåºåºé¨ã¾ã§å解ãã åºåºé¨ã§ã¯è§£ãæ示çã«å®ç¾©ãã 大ããªåé¡ã¯é¢æ°ãèªåèªèº«ã«å帰çã«é©ç¨ãããã¨ã§é¨ååé¡ãå帰çã«è§£ãã¦ãã æçµçã«è§£ãé¨åçãªâ¦
表è¨ã®ã¨ããã§ãã ä¸å¿ãç°¡åãªHaskellã®ããã°ã©ã ã¯æ¸ãããããããªããããªæ°ãããããã«ãªãã¾ããã 第ä¸é¨ã®ãããã¯å ·ä½çã«ããã°ã©ã ãæ¸ãã¤ã¤éã¶ãã¨ãã§ããã®ã§ããããªãã«èº«ã«ã¤ãæãããã¾ãããã ãå 容çã«ã¯æ·±å ãã¯ãã¦ããªãã®ã§â¦
第10ç« ã¨ã³ãã£ã㣠å¤æ° åã³ã³ã¹ãã©ã¯ã¿ ãã¼ã¿ã³ã³ã¹ãã©ã¯ã¿ ãã£ã¼ã«ãã©ãã« åã¯ã©ã¹ ã¯ã©ã¹ã¡ã½ãã ã¢ã¸ã¥ã¼ã«å®ç¾© åºæ¬çãªå½¢ module Repository where ç¹å®ã®ã¨ã³ãã£ãã£ã®ã¿ã¨ã¯ã¹ãã¼ããã module Repository (findById, save) where ãã¼â¦
åãªãèªæ¸ã¡ã¢ 代æ°çãã¼ã¿å å®ç¾©ã®ä»æ¹1 - æ§é ä½ã£ã½ã ã©ãã«ãªãã³ã³ã¹ãã©ã¯ã¿ã¼ -- Studentåã®å®ç¾© data Student = Student String String -- ã¤ã³ã¹ã¿ã³ã¹å student = Student "Paul" "Smith" -- ãã¿ã¼ã³ããã printStudent:: Student -> IO()â¦
åãªãèªæ¸ã¡ã¢ ç¡åé¢æ° æ¸ãæ¹ \n -> n * n 使ãæ¹ map (\n -> n * n) [1,2,3,4] é¢æ°åæ æ¸ãæ¹ before lineCount:: String -> Int lineCount s = length $ lines s after lineCount:: String -> Int lineCount = length . lines é¨åé©ç¨ ä¾:5ã®åæ°ãâ¦
ããµã¤ãã®Haskellãã®èªæ¸ã¡ã¢ æ¨æºã®é¢æ°ã¾ã¨ã é¢æ° å åä½æ¦è¦ == a -> a -> Bool 第ä¸å¼æ°ã¨ç¬¬äºå¼æ°ãæ¯è¼ããçµæãè¿ã lines String -> [String] æ¹è¡æåã³ã¼ãã§åºåã£ã¦ãªã¹ãã«å¤æ words String -> [String] åèªã«å解ãã length [a] -> Inâ¦
åãªãèªæ¸ã¡ã¢ æ£è¦å½¢ 第ä¸æ£è¦å½¢(1NF) 第äºæ£è¦å½¢(2NF) 第ä¸æ£è¦å½¢(3NF) ãã¤ã¹ã³ããæ£è¦å½¢(BCNF) 第åæ£è¦å½¢(4NF) 第äºæ£è¦å½¢(5NF) 第å æ£è¦å½¢(6NF) é«ãã¬ãã«ã®æ£è¦å½¢ã¯ãããããä½æ¬¡ã®æ£è¦å½¢ã®è¦ä»¶ãæºãã è¨è¨æã«ç®æãç®å®ã¯BCNFãããã¯5NF 2NFâ¦
ãã£ã¨ã³ããæ¬èªã¿çµãã£ãã 700ãã¼ã¸ã¨ãããµã¤ãºã«éä¸ãã©ãã©èªãã§ãã¾ã£ããããã»ã¨ãã©å 容ãé ã®ãªãã«æ®ã£ã¦ãªããé·ãæ¬ã¯1æ¥100ãã¼ã¸ã¨ãç解ã¯ã©ãã§ãããããã¹ãã¼ããé«ãã¤ã¤èªã¿ãã(ã©ããå¾ã§ã¾ãèªã¿ãªããã®ã§)ã ã¨ãããããè¦â¦