<?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 Mohammad Salari on Medium]]></title>
        <description><![CDATA[Stories by Mohammad Salari on Medium]]></description>
        <link>https://medium.com/@ms.salari?source=rss-da0f8d06b532------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vO1MF0Z9KcCHujn7Bhc2ew.png</url>
            <title>Stories by Mohammad Salari on Medium</title>
            <link>https://medium.com/@ms.salari?source=rss-da0f8d06b532------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 01:40:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ms.salari/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[Mob Programming: A Game-Changer for Legacy Code]]></title>
            <link>https://medium.com/@ms.salari/mob-programming-a-game-changer-for-legacy-code-7b94771ea20d?source=rss-da0f8d06b532------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b94771ea20d</guid>
            <category><![CDATA[mob-programming]]></category>
            <category><![CDATA[legacy-code-challenges]]></category>
            <dc:creator><![CDATA[Mohammad Salari]]></dc:creator>
            <pubDate>Thu, 30 Nov 2023 00:30:29 GMT</pubDate>
            <atom:updated>2023-11-30T00:30:29.465Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VLxi1aFXihQED8l6gPew_g.png" /><figcaption>Tackling Legacy Code Challenges</figcaption></figure><h4>The Legacy Code Conundrum</h4><p>In the fast-paced world of software development, legacy code remains a critical challenge. It’s a complex puzzle of past decisions and architectural layers that many teams face. Addressing this efficiently is key, and mob programming emerges as a powerful strategy, especially for teams dealing with extensive, old codebases. This approach not only simplifies complex code but also enhances team dynamics and project management.</p><h4>The Essence of Mob Programming in Legacy Code Management</h4><p>Mob programming, a collective approach to software development, brings together diverse minds to tackle coding tasks. This method, especially in legacy systems, enables a more thorough understanding and efficient problem-solving, making it a preferred approach for modern development teams.</p><h4>Nurturing Growth in a Collaborative Setting</h4><p>At the core of mob programming, there’s an unspoken understanding that transcends the usual workplace dynamics. In this environment, where collective success is valued above individual spotlight, there’s a subtle shift in how developers, particularly those early in their career, view their role and contributions. As they engage in this group-based approach, the focus naturally shifts away from the traditional race for accolades. Instead, there’s a quiet, almost organic development of skills and expertise. This shift creates a space where the pressure to outshine peers diminishes, fostering a culture where the team’s achievements become the beacon guiding professional advancement. In navigating the complex terrain of legacy systems, this ethos ensures that efforts are channeled towards common goals, subtly steering the team away from isolated endeavors that might disrupt harmony and productivity.</p><h4>Breaking Down Knowledge Barriers in Legacy Systems</h4><p>Legacy systems often suffer from compartmentalized knowledge. Mob programming effectively dismantles these barriers, creating an integrated understanding of the system. This approach ensures a comprehensive grasp of the codebase, crucial for maintaining and evolving legacy software.</p><h4>Refining Communication in Development Teams</h4><p>Effective communication is vital in deciphering complex legacy code. Mob programming elevates this by integrating communication into the development process, making it a continuous and dynamic interaction that benefits the entire team.</p><h4>Future-Proofing Teams with Hands-On Experience</h4><p>The immersive nature of mob programming equips teams with a hands-on understanding of various systems, an invaluable asset in the ever-evolving tech landscape. It fosters a deep, practical knowledge of the codebase, preparing teams for future challenges.</p><h4>Fostering Transparency and Collective Accountability</h4><p>In mob programming, transparency is key. Mistakes are openly addressed and resolved, creating a culture of collective accountability. This is particularly effective in managing and modernizing legacy systems, where understanding the root cause of issues is essential.</p><h4>Smoothing the Learning Curve in Legacy Code Management</h4><p>Legacy systems can present daunting learning curves. Mob programming makes this learning process more collaborative and less intimidating, allowing team members to tackle complex problems together efficiently.</p><h4>Ensuring Continuity of Knowledge in Development Teams</h4><p>One of the significant challenges with legacy code is maintaining continuity of knowledge. Mob programming combats this by fostering a shared knowledge base, ensuring seamless integration for new team members and minimal disruption from departures.</p><h4>Strengthening Security in Software Development</h4><p>In dealing with legacy systems, security is paramount. The collaborative nature of mob programming enhances the codebase’s security, as the team collectively identifies and addresses potential vulnerabilities.</p><h4>Balancing Workloads for Better Work-Life Integration</h4><p>Mob programming promotes a balanced workload among team members, contributing to a healthier work-life balance. This approach reduces burnout risks and improves overall job satisfaction.</p><h4>Empowering Leadership in Collaborative Environments</h4><p>Leaders in a mob programming setup shift from traditional management to facilitation roles. They guide collective efforts, creating an environment where collaboration and mutual respect are the driving forces behind successful project completion.</p><h4>Streamlining Team Transitions in Legacy Code Projects</h4><p>With mob programming, team transitions become more fluid, ensuring efficient knowledge transfer. This is crucial in maintaining legacy systems’ integrity, as it guarantees that team changes don’t lead to knowledge loss or workflow disruptions.</p><h4>Conclusion:</h4><p>Adopting mob programming signifies more than just a new methodology; it marks the beginning of a transformative era in software development. This approach offers a path to revitalizing legacy systems, turning them into well-maintained, dynamic parts of the digital infrastructure. It promises not just enhanced code quality but also a more unified, skilled, and content development team.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b94771ea20d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel 8.x - Clean Architecture]]></title>
            <link>https://medium.com/@ms.salari/laravel-8-x-clean-architecture-523ba1e870a6?source=rss-da0f8d06b532------2</link>
            <guid isPermaLink="false">https://medium.com/p/523ba1e870a6</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[laravel-clean-arch-sample]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <dc:creator><![CDATA[Mohammad Salari]]></dc:creator>
            <pubDate>Tue, 10 Aug 2021 17:55:15 GMT</pubDate>
            <atom:updated>2021-08-11T15:50:25.296Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Clean Architecture</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/772/1*B7LkQDyDqLN3rRSrNYkETA.jpeg" /><figcaption>The Clean Architecture</figcaption></figure><p>You might have heard of “Robert C. Martin (Uncle Bob)” clean architecture.</p><p>If not, you can find pretty good information <a href="https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html">here</a>.</p><h3>What this article is about?</h3><p>My personal experience and my personal ideas on using Clean Architecture along with Laravel FrameWork.</p><h3>The Problem</h3><p>So, I was introduced to the <strong>Clean Architecture</strong> concept which some people call <strong>Onion Architecture.</strong></p><p>However, despite the resemblance, they are not exactly the same thing.</p><p>But just keep in mind in this article we assume they are the same.</p><p>Anyways, we decided to go on with this Clean Architecture for all of our services because of its benefits, like being future proof, better and easy maintenance, and other advantages which you can read for yourself.</p><p>My problem arose when as usual I tried to surf the internet for some references or tutorials to implement the <strong>Clean Architecture for Laravel FrameWork</strong>.</p><p>Honestly, I found some examples but they didn’t seem right to me, so I came up with the idea to create a pure PHP project with Clean Architecture and include “Laravel/framework” inside the composer.json and use it like that, which didn’t go as expected, because things went complicated, and the whole idea of this Architecture and Semantic Structure is to make your life easier.</p><p>So, <a href="https://github.com/eminetto/clean-architecture-php">here</a> is a good example of PHP Clean Architecture.</p><h3>The Idea</h3><p>Finally, I decided to not make it so complicated, I thought to myself, Ok, it’s just some kind of rules, structure, and conventions, why not use Laravel as is, and just bind the structure beside the framework!</p><h3>The Example</h3><p>So, first of all, here is the <a href="https://github.com/sslr/laravel-clean-architecture-example">example repo</a></p><p>If you look closely, it’s just a Laravel standard skeleton, with one extra directory “onion”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*NVP3xtXghF9qvu-J51ij3w.png" /></figure><p>If you look for yourself you will see how everything is defined and is bound.</p><p>What’s important here is how do we call this structure inside the code, that you need to take a look at:</p><blockquote>routes/api.php</blockquote><blockquote>app/Http/Controllers/PostController.php</blockquote><blockquote>app/Http/Controllers/UserController.php</blockquote><p>Also after running the example project there is a postman collection which you can import and see the simple use case.</p><h3>Clarification</h3><p>This article is meant for someone who had the same headaches of finding a clear example of Laravel&#39;s clean architecture.</p><p>So, up until this point for those who are not familiar with the concept and had not tried to use it yet, it might seem a little confusing.</p><p>If you are confused keep reading, otherwise let me know your thoughts.</p><h3>Digging Deep</h3><p>Everything (DB, UI, HTTP, ….) happens in the outer layer, so is Larvel and all of its features like migrations, HTTP, routes, cache, configs, and everything, but we must adhere to the architecture, so how did we do that?</p><p>As you can see in the example, “user” is one of our <strong>Entities</strong>:</p><blockquote>onion/Entity/User.php</blockquote><p>now we need a <strong>usecase</strong> for “user” look at this file:</p><blockquote>onion/UseCase/UserUseCaseInterface.php</blockquote><p>Here we used Dependency Rule (Dependency injection). So every implementation of usecase has to adhere to:</p><blockquote>onion/Driver/UserRepositoryInterface.php</blockquote><blockquote>onion/Entity/User.php</blockquote><p>And the implementation is:</p><blockquote>onion/UseCase/UserService.php</blockquote><p>Ok, now we have our <strong>usecase</strong> and <strong>entity</strong> and <strong>driver</strong> depend on each other, and we kinda built some rules for the future developers, in case they need a new implementation of use case or driver, they have to implement our interface, the same goes for the drivers which we called repositories just in case.</p><p>For the sake of example, we created a controller for each method, and inside the <strong>controller</strong> we use our <strong>usecase, a usecase is bound to a repository (driver), and an Entity.</strong></p><blockquote>The overriding rule that makes this architecture work is <em>The Dependency Rule</em>. This rule says that <em>source code dependencies</em> can only point <strong><em>inwards</em></strong>.</blockquote><p>look what happened here:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cdlofxuyHslnrgBzaCeF-g.png" /></figure><p>We are using our framework and database and everything in the outer layer.</p><p>If you look inside the onion/controller we have to use usecase interface, and inside usecase interface we have to use repository(driver), and inside repository, we have to use the entity, look at the below:</p><pre><em>/**<br> * Display a listing of the resource.<br> *<br> * </em><strong><em>@param </em></strong><em>Request $request<br> * </em><strong><em>@return </em></strong><em>\Illuminate\Http\Response<br> */<br></em>public function index(Request $request)<br>{<br>    return Response((new UserIndexHandler(new UserService(new UserEloquentRepository())))-&gt;handle($request));<br>}</pre><p>As you can see we initiate our onion controller inside laravel controller and we have to adhere to the dependencies.</p><p>That way Laravel framework stays intact and we have our clean architecture right beside it.</p><h3>Conclusion</h3><p>This was only my personal idea which might have some issues, but the idea is just to get rid of all complexity of Laravel and Clean Architecture together.</p><p>Of course, this was the simplest possible example and in a real-world scenario you will face multiple challenges and unexpected issues, but as long as you keep the big picture simple, you can handle complexity in specific narrowed zones.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=523ba1e870a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>