tag:blogger.com,1999:blog-274357204559150666.post5997020399765185583..comments2023-10-07T00:35:44.914-07:00Comments on Inversion of Coupling Control: Inversion of (Coupling) ControlDaniel Sagenschneiderhttp://www.blogger.com/profile/13630220451589425944noreply@blogger.comBlogger8125tag:blogger.com,1999:blog-274357204559150666.post-13785145414649057572020-07-06T22:10:58.070-07:002020-07-06T22:10:58.070-07:00The interface is the coupling I'm talking abou...The interface is the coupling I'm talking about.<br /><br />The most simple example is synchronous methods:<br /><br /> Result doSomething()<br /><br />Now what happens if I want to make an asynchronous call within doSomething()? Without blocking the main thread (which is inefficient), I have to start refactoring the coupling of the interface to be a callback for the Result.<br /><br />This is just one example. What if I want to change down stream flow calls. What if I require to call REST API end points through different exceptions to DB calls. It would all change the interface.<br /><br />All of the above is "coupling" that you get from abstraction (template method interfaces). Separation of layers only makes this problem worse, as the layers enforce even more rigid coupling. For example, you have synchronous methods all the way down your layers, but now want to take advantage of asynchronous DB drivers? Refactoring the synchronous method coupling is a "huge" undertaking - potentially even a full rewrite.<br /><br />With the above Inversion of Coupling Control, you just swap the calling code method out and you're done. Lot less coupling leading to lot less refactoring.<br /><br />I actually find it "unusual" that for all the attempts of loosely coupled architectures, we still use tightly coupled methods. Very "unusual" :pDaniel Sagenschneiderhttps://www.blogger.com/profile/13630220451589425944noreply@blogger.comtag:blogger.com,1999:blog-274357204559150666.post-16051552360128167062020-02-03T12:13:32.072-08:002020-02-03T12:13:32.072-08:00If you're coding against abstraction (interfac...If you're coding against abstraction (interface) instead of implementation (class) AND you separated your layers, then you can achieve same results as described on top. No need for all this "unusual" code.Sergey Karpushinhttps://www.blogger.com/profile/15292316062998336787noreply@blogger.comtag:blogger.com,1999:blog-274357204559150666.post-35990301914824692982019-12-08T19:52:03.171-08:002019-12-08T19:52:03.171-08:00What is the OO Matrix? https://sagenschneider.blo...What is the OO Matrix? https://sagenschneider.blogspot.com/2019/08/what-is-oo-matrix.htmlDaniel Sagenschneiderhttps://www.blogger.com/profile/13630220451589425944noreply@blogger.comtag:blogger.com,1999:blog-274357204559150666.post-50625224669081460672019-12-08T19:50:42.591-08:002019-12-08T19:50:42.591-08:00To my understanding, RXJava follow functional prog...To my understanding, RXJava follow functional programming in using Monads (and the like) for composition (coupling logic together). This is all founded on top of the function. The function suffers the same coupling as the method.<br /><br />One thing RXJava typical indicates is that you must go fully Reactive. Basically, you can only write your app in Reactive or synchronous Servlet. Mixing requires you to understand each deeply (in particular the threading models) to make them work together.<br /><br />Or use the the above concepts and check out https://sagenschneider.blogspot.com/2019/04/oo-functional-imperative-reactive.htmlDaniel Sagenschneiderhttps://www.blogger.com/profile/13630220451589425944noreply@blogger.comtag:blogger.com,1999:blog-274357204559150666.post-83556102454318878452019-12-08T19:45:59.582-08:002019-12-08T19:45:59.582-08:00No worries Mike. Happy others are starting to see...No worries Mike. Happy others are starting to see the OO Matrix for what it is :) Always open to assisting :)Daniel Sagenschneiderhttps://www.blogger.com/profile/13630220451589425944noreply@blogger.comtag:blogger.com,1999:blog-274357204559150666.post-20587644773434106482019-11-10T00:14:22.950-08:002019-11-10T00:14:22.950-08:00I'm a simple developer and to me this looks ra...I'm a simple developer and to me this looks rather complex. I do understand what you are trying to convey. Do reactive libraries, like RXJava, try to solve the same problem (at least partially)? I have not yet had a look at your OfficeFloor solution, but I definitely will. I'm curious how you tackled these couplings.Ruudhttps://www.blogger.com/profile/12666324550060997738noreply@blogger.comtag:blogger.com,1999:blog-274357204559150666.post-32207369457550493842019-09-30T01:30:58.170-07:002019-09-30T01:30:58.170-07:00damn man, you just laid out what I have been wrest...damn man, you just laid out what I have been wrestling with for 20 years... i feel kinda "floored" lol. the ignored 80% of coupling "layers" on the problems we deal with on a daily basis. it totally is a red/blue pill kind of realization. I forked it and will grok what I can, be prepared for stupid questions. :0)Mikehttps://www.blogger.com/profile/13035306410438764689noreply@blogger.comtag:blogger.com,1999:blog-274357204559150666.post-32474814253293934322019-02-28T05:37:11.874-08:002019-02-28T05:37:11.874-08:00I love this article. What a great read. Thanks for...I love this article. What a great read. Thanks for sharing Daniel.Matt Brownhttps://www.blogger.com/profile/18283267981008370001noreply@blogger.com