<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alexander Skvortsov on Medium]]></title>
        <description><![CDATA[Stories by Alexander Skvortsov on Medium]]></description>
        <link>https://medium.com/@alexander.skvortsov?source=rss-edaebfd2f2b9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Alexander Skvortsov on Medium</title>
            <link>https://medium.com/@alexander.skvortsov?source=rss-edaebfd2f2b9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 04:29:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alexander.skvortsov/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[EventBus Trap on Mobile apps]]></title>
            <link>https://medium.com/@alexander.skvortsov/eventbus-trap-on-mobile-apps-ac5071627a3c?source=rss-edaebfd2f2b9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac5071627a3c</guid>
            <category><![CDATA[solid-principles]]></category>
            <category><![CDATA[patterns]]></category>
            <category><![CDATA[dependency-management]]></category>
            <category><![CDATA[antipattern]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Alexander Skvortsov]]></dc:creator>
            <pubDate>Tue, 12 Jul 2022 21:48:54 GMT</pubDate>
            <atom:updated>2022-09-06T11:25:07.818Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6i7yPm9w1lCnBKnE" /><figcaption>Photo by <a href="https://unsplash.com/@lucialua84?utm_source=medium&amp;utm_medium=referral">Lucia Lua Ramirez</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><a href="https://dzone.com/articles/design-patterns-event-bus">EventBus</a> is an old and well known pattern which defines how to organize communication between different program components. There is nothing bad in this pattern and there are situations when it is very valid and useful.</p><h3><strong>But,</strong></h3><p>As any other tool it has a limited set of tasks where it reasonably shines and obviously … <strong><em>there are tasks where its usage should be avoided. </em></strong>Any Mobile application with codebase bigger than a few hundred lines is a great example of such inappropriate tasks for EventBus.</p><p>On my career I have been working with some applications whose architecture was unfortunately based on EventBus. All those apps had similar issues and symptoms. Eventually we had to find another way of doing things and refactor a lot of code in order to stop using EventBus.</p><p>Why did we had to do this? What makes an EventBus at Mobile so inefficient?</p><p>At first glance the idea of EventBus looks great. A signal can be sent from any place in the code to be processed in any other place. It seems so powerful! No need to deal with interfaces representing different modules — just get a reference to one thing in the constructor and “BOOM!” you have access to the entire app. And this is exactly what makes EventBus a bad choice.</p><h3>Too powerful</h3><p>Boundaries are our friends, they protect us (developers) from doing wrong things. EventBus is too powerful, it basically has no boundaries which makes it very easy to break SOLID rules.</p><h3>Too loose coupling.</h3><p>Modern development practices (like “<a href="https://dev.to/tamerlang/understanding-solid-principles-dependency-inversion-1b0f#:~:text=The%20Dependency%20Inversion%20Principle%20(DIP,Details%20should%20depend%20upon%20abstractions.">D</a>” of SOLID”) says we should keep coupling of components loose. EventBus is doing exactly this … but too much. Components do not physically depend on each other. We can remove an entire component from the codebase and the compiler will not find any issues, or opposite — we can drag some functionality for long time not realizing that it is not actually being used.</p><h3>Implicit dependencies.</h3><p>Even though there are no physical dependencies between components there are still logical dependencies —<em> component A</em> sends a signal assuming that <em>component B</em> will pick it up and do what it was asked for. It’s very tempting just to send a signal through EventBus at any place in the codebase not caring that much what it represents, instead of dancing with all those interfaces, layers and levels of abstractions (which SOLID/CleanCode governs). It is very easy add one more logical dependency just by sending another signal. This approach is not scalable. When the app grows then logical dependencies grow exponentially and at some moment the dependency tree (and it has to be “tree”-like graph, no loops) becomes a full-mesh graph (everyone depends on everyone) which makes the entire codebase rigid and unmaintainable.</p><h3>Requirements are not clear.</h3><p>The one needs to investigate the entire component’s implementation in order to spot the requirements which makes codebase reading hard and time consuming. Any debugging becomes a nightmare. Not having all the requirements under hand makes it harder to write Unit Tests.</p><h3>Conclusion.</h3><p>EventBus is too powerful and violates SOLID principles. It should not be used on global level in the any application’s codebase. Even though it makes things easier in very beginning, when the app grows you will find yourself in a trap. It is still “ok” to use EventBus at small scale — for example for simplistic prototypes or on feature level until the feature overgrow it and then most probably it will have to be rewritten.</p><p>All points here are about vanilla EventBus approach. To be fair I have to mention also some successful reincarnations of EventBus. For example — Redux. The Storage of Redux despite being an actual storage for the current State also acts as a global EventBus. Redux applies additional rules on top of EventBus which mitigates some it’s issues, like it has Reducers which are supposed to be “pure” functions doing one thing. But also EventBus nature affects Redux making it not scalable enough. Reduxe’s Actions and Reducers are global and at some moment its number can be tremendous which makes the entire implementation unmanageable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac5071627a3c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>