{"id":15732,"date":"2019-10-09T15:59:20","date_gmt":"2019-10-09T20:59:20","guid":{"rendered":"https:\/\/thecapeblog.com\/?p=15732"},"modified":"2019-10-09T15:59:20","modified_gmt":"2019-10-09T20:59:20","slug":"spaghetti-code-king","status":"publish","type":"post","link":"https:\/\/thecapeblog.com\/?p=15732","title":{"rendered":"Spaghetti Code King"},"content":{"rendered":"\n<p>From Scott Hannen:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p> For example, suppose one class depends on\u00a0<code>ISomething<\/code>, but the implementation of\u00a0<code>ISomething<\/code>\u00a0is a class that has three more dependencies. And some of those dependencies have dependencies, and so on. The result is that each individual class is simpler in isolation (exactly what we want) but creating an instance of a class is now more complex. A constructor call might look something like this:<br><code>    IHouse house = <strong>new<\/strong> <strong>FloorPlan23House<\/strong>( <strong>new<\/strong> <strong>ElectricalSystem<\/strong>( <strong>new<\/strong> <strong>GeModel3000WiringPanel<\/strong>(),  <strong>new<\/strong> <strong>SolarPowerSource<\/strong>(<strong>new<\/strong> <strong>acmeSolarPanelArray<\/strong>(New <strong>Sun<\/strong>()), <strong>new<\/strong> <strong>MassiveBattery<\/strong>())),  <strong>new<\/strong> <strong>Kitchen<\/strong>(<strong>new<\/strong> <strong>MarbleCounterTop<\/strong>(<strong>new<\/strong> <strong>HomeDepotSink<\/strong>().... <\/code><br>This could become incomprehensible if you\u2019re working with a large number of classes. <\/p><\/blockquote>\n\n\n\n<p>Yes!  Exactly!  The labyrinthine codebase from Chestertown, in a nutshell, or should I say, nuthouse.<\/p>\n\n\n\n<p>Well, F* me.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From Scott Hannen: For example, suppose one class depends on\u00a0ISomething, but the implementation of\u00a0ISomething\u00a0is a class that has three more dependencies. And some of those dependencies have dependencies, and so on. The result is that each individual class is simpler &hellip; <a href=\"https:\/\/thecapeblog.com\/?p=15732\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-15732","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/thecapeblog.com\/index.php?rest_route=\/wp\/v2\/posts\/15732","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecapeblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecapeblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecapeblog.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thecapeblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=15732"}],"version-history":[{"count":1,"href":"https:\/\/thecapeblog.com\/index.php?rest_route=\/wp\/v2\/posts\/15732\/revisions"}],"predecessor-version":[{"id":15733,"href":"https:\/\/thecapeblog.com\/index.php?rest_route=\/wp\/v2\/posts\/15732\/revisions\/15733"}],"wp:attachment":[{"href":"https:\/\/thecapeblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=15732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecapeblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=15732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecapeblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=15732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}