<?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 Pabodya Nethsarani on Medium]]></title>
        <description><![CDATA[Stories by Pabodya Nethsarani on Medium]]></description>
        <link>https://medium.com/@mwpnethsarani?source=rss-6fc65d8dc22f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Jk_5ssH58XcRGYuf1LcsuQ.jpeg</url>
            <title>Stories by Pabodya Nethsarani on Medium</title>
            <link>https://medium.com/@mwpnethsarani?source=rss-6fc65d8dc22f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 05:54:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mwpnethsarani/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[Choosing the Right Programming Language and Framework]]></title>
            <link>https://medium.com/@mwpnethsarani/choosing-the-right-programming-language-and-framework-34d6b0717538?source=rss-6fc65d8dc22f------2</link>
            <guid isPermaLink="false">https://medium.com/p/34d6b0717538</guid>
            <dc:creator><![CDATA[Pabodya Nethsarani]]></dc:creator>
            <pubDate>Wed, 07 Jan 2026 16:10:51 GMT</pubDate>
            <atom:updated>2026-01-07T16:10:51.707Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*RiEwUPnH0SR2iQ3P-KDw9g.png" /></figure><h3>Example — A Kitchen-Based Guide with Go &amp; Gin</h3><h3>Introduction</h3><p>One of the <strong>biggest problems I see in the software industry</strong> is not a lack of frameworks or languages it’s <strong>choosing the wrong one for the project</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*CYPxCUX2As7jZXOhSR_eig.avif" /></figure><p>Many developers jump into projects using:</p><ul><li>trending languages</li><li>popular frameworks</li><li>tools they personally like</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*lpURbZTwYtmuWiia92vmoQ.png" /></figure><p>But later they struggle with</p><p><strong>performance,</strong></p><p><strong>scalability,</strong></p><p><strong>maintainability, or</strong></p><p><strong>complexity</strong>.</p><p>I like to explain this problem using a <strong>cooking analogy</strong>.</p><h3>Programming Languages Are Like Kitchen Tools</h3><p>Imagine a kitchen.</p><ul><li>A <strong>knife</strong> is perfect for cutting vegetables</li><li>A <strong>spoon</strong> is great for mixing</li><li>A <strong>blender</strong> is best for making smoothies</li></ul><p>You <em>can</em> try to cut vegetables with a spoon but it will be <strong>slow, painful, and inefficient</strong>.</p><p><strong>Programming languages are the same.</strong></p><p>The problem is <strong>not the tool</strong>, but <strong>choosing the wrong tool for the job</strong>.</p><h3>Problem 1: How Do We Choose the Right Programming Language?</h3><p>Before choosing a language, we must ask <strong>project-based questions</strong>, not personal preference questions.</p><h3>Key Questions to Ask</h3><p>Question Why it Matters What kind of system am I building?Web app, API, data processing, real-time system Performance-critical?Low latency, high throughput Team experience?Learning curve matters Scalability needed?Future growth Ecosystem &amp; tooling?Libraries, community</p><h3>When Should We Choose Go (Golang)?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*jTlby0QHUxpK26TxSZXL6A.png" /></figure><p>Go is like a <strong>sharp chef’s knife</strong>:</p><ul><li>simple</li><li>fast</li><li>reliable</li><li>efficient</li></ul><h3>Use Go When ?</h3><ul><li>Building <strong>back end APIs</strong></li><li>Creating <strong>micro services</strong></li><li>Need <strong>high concurrency</strong> (many users at once)</li><li>Want <strong>fast performance</strong></li><li>Cloud-native / container-based systems</li><li>Infrastructure tools (Docker, Kubernetes are written in Go!)</li></ul><h3>Example Use Cases</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q1dGcKma-ueuoCYgkuZaOg.jpeg" /></figure><ul><li>REST APIs</li><li>Authentication services</li><li>Payment services</li><li>Real-time dashboards</li><li>Dev Ops tools</li></ul><h3>Pros and Cons of Go</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fqPsJFerdCrX_9ZXYjPYDQ.jpeg" /></figure><h3>Pros</h3><ul><li><strong>Very fast performance</strong></li><li><strong>Built-in concurrency (go routines)</strong></li><li><strong>Simple syntax</strong></li><li><strong>Strong standard library</strong></li><li><strong>Easy deployment (single binary)</strong></li><li>Excellent for <strong>micro services</strong></li></ul><h3>Cons</h3><ul><li>Not ideal for <strong>UI-heavy frontend</strong></li><li>Fewer libraries than JavaScript ecosystem</li><li>Verbose error handling</li><li>Not great for rapid prototyping compared to scripting languages</li></ul><h3>When NOT to Use Go ?</h3><p>Do <strong>not</strong> use Go if:</p><ul><li>You need complex front end UI (React, Angular needed)</li><li>You want rapid experimentation / scripting</li><li>Heavy machine learning workloads (Python is better)</li><li>Small throwaway scripts</li></ul><p>Again: <strong>wrong tool = hard cooking</strong></p><h3>Problem 2 - Okay, We Chose Go — Now Which Framework?</h3><p>Choosing a <strong>framework</strong> is like choosing a <strong>cooking style or workflow</strong>.</p><p>Even with the same knife:</p><ul><li>a fast-food kitchen works differently</li><li>a fine-dining kitchen works differently</li></ul><h3>Popular Go Frameworks and When to Use Them</h3><h3>Gin — The Fast Commercial Kitchen</h3><p><strong>Gin</strong> is one of the most popular Go web frameworks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*n3ilwBDSH-ZIV6Fue6Pcmg.jpeg" /></figure><h4>Use Gin When:</h4><ul><li>Building REST APIs</li><li>Micro services</li><li>High performance is required</li><li>You want middle ware support</li><li>Industry-standard choice</li></ul><h4>Pros:</h4><ul><li>Very fast</li><li>Simple routing</li><li>Middle ware support</li><li>Large community</li></ul><h4>Cons:</h4><ul><li>Opinionated structure</li><li>Less flexibility than standard net/http</li></ul><p><strong>Best for: production APIs &amp; micro services</strong></p><h3>Echo Clean &amp; Developer Friendly</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*EB8vVvwTREw7HWXAwSvj5w.png" /></figure><h4>Use Echo When:</h4><ul><li>You want clean APIs</li><li>Need built-in validation</li><li>Developer productivity matters</li></ul><h4>Pros:</h4><ul><li>Clean syntax</li><li>Good middleware</li><li>Fast</li></ul><h4>Cons:</h4><ul><li>Slightly less popular than Gin</li></ul><h3>Fiber Express.js Style</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*ss_l4sQYHsqYAo3DMfMNow.jpeg" /></figure><p>Inspired by <strong>Node.js Express</strong></p><h4>Use Fiber When:</h4><ul><li>Coming from Node.js</li><li>Want ultra-fast performance</li><li>Comfortable with Express-style coding</li></ul><h4>Pros:</h4><ul><li>Very fast</li><li>Familiar syntax for JS devs</li></ul><h4>Cons:</h4><ul><li>Uses fasthttp (not standard net/http)</li><li>Some compatibility issues</li></ul><h3>Chi — Minimalist &amp; Flexible</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/292/1*5nqtxRoPF5q7W5rrNPf5cg.jpeg" /></figure><h4>Use Chi When:</h4><ul><li>You want full control</li><li>Minimal abstraction</li><li>Clean architecture</li></ul><h4>Pros:</h4><ul><li>Lightweight</li><li>net/http based</li><li>Great for clean architecture</li></ul><h4>Cons:</h4><ul><li>More boilerplate</li><li>Less “out of the box”</li></ul><h3>net/http (Standard Library) — Raw Ingredients</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/284/1*7Acq4iCdzK8wcNNuweHxoQ.png" /></figure><h4>Use When:</h4><ul><li>Learning Go deeply</li><li>Very small services</li><li>Maximum control</li></ul><h4>Pros:</h4><ul><li>Zero dependency</li><li>Full control</li></ul><h4>Cons:</h4><ul><li>More code</li><li>Slower development</li></ul><h3>How to Choose the Right Go Framework?</h3><p>Ask these:</p><p>QuestionRecommendationProduction REST API?GinComing from Node.js?FiberClean architecture focus?ChiLearning Go basics?net/httpDeveloper productivity?Echo</p><h3>Final Thought: Tools Don’t Make the Chef</h3><p>A good developer:</p><ul><li>Understands <strong>the problem</strong></li><li>Selects <strong>the right language</strong></li><li>Chooses <strong>the right framework</strong></li><li>Not the trend</li></ul><p>#golang #microservices #cloudcomputing <br>#backend #softwarearchitecture <br>#systemdesign #devops</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34d6b0717538" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Node.js Handles Multiple Requests Using a Single Thread ?]]></title>
            <link>https://medium.com/@mwpnethsarani/how-node-js-handles-multiple-requests-using-a-single-thread-06c4f68ffcb9?source=rss-6fc65d8dc22f------2</link>
            <guid isPermaLink="false">https://medium.com/p/06c4f68ffcb9</guid>
            <dc:creator><![CDATA[Pabodya Nethsarani]]></dc:creator>
            <pubDate>Tue, 07 Oct 2025 07:44:35 GMT</pubDate>
            <atom:updated>2025-10-07T07:44:35.537Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Node.js Handles Multiple Requests Using a Single Thread ?</h3><h3>What is Thread ?</h3><p>The smallest unit of CPU execution. It executes code instructions inside a process. A process can have <strong>multiple threads</strong> (multi-threading).</p><ol><li>Single-threaded — Only <strong>one thread</strong> handles all tasks sequentially.</li><li>Multi-threaded — Multiple threads run <strong>in parallel</strong>, each handling tasks independently.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*0nWxbQbpVUTSFyECMOVOUw.png" /><figcaption>threads</figcaption></figure><p>example -:</p><ul><li>Browser has multiple threads: one for JavaScript, one for rendering, etc.</li><li>Node.js: one main JavaScript thread + background threads.</li></ul><h3>What is Process ?</h3><p>An <strong>instance of a program</strong> running in memory.It contains all the resources (memory, file handles, threads).</p><h3>Actually Node.js is Single Thread ?</h3><p>Node.js <strong>runs JavaScript code</strong> in a <strong>single main thread. </strong>But internally, it’s <strong>not entirely single-threaded</strong> because:</p><p>It uses <strong>multiple background threads</strong> in the <strong>libuv thread pool</strong> to handle things like file system operations, DNS lookups, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*4VI7aRuT3lcUx9E0cuZmWQ.png" /><figcaption>Libuv + event loop</figcaption></figure><ol><li><strong>main Thread</strong> -&gt; runs JavaScript (event loop).</li><li><strong>libuv thread pool -&gt;</strong> runs background tasks (I/O operations).</li></ol><h3>How Node Handles Many Requests Using One Thread?</h3><p>This is the magic of the <strong>Event Loop</strong> and <strong>Non-Blocking I/O</strong>.</p><p>Actually, this can be easily identified using the following scenario : -</p><p>Imagine a busy restaurant with one head chef who takes orders and plates dishes. The chef doesn’t do everything alone, they delegate tasks :- vegetables go to a sous-chef, dough goes in the oven, and servers notify when tables are ready.</p><p>While the helpers work, the chef continues taking new orders. When a task is done, the chef finishes the dish.</p><p>In Node.js, the head chef represents the main thread or event loop, and the sous-chefs and appliances represent the libuv thread pool and OS asynchronous I/O, allowing Node to handle multiple tasks efficiently without waiting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RpE50MRv6-kTcE8qRYQGjQ.png" /><figcaption>Node request handling</figcaption></figure><ol><li>Node receives many client requests.</li><li>The <strong>Event Loop</strong> runs inside the main thread.</li><li>For each request:</li></ol><ul><li>If it’s <strong>CPU-light and I/O-heavy</strong> (like reading a file, querying a DB, waiting for a network response).</li><li>Node <strong>delegates</strong> that operation to the <strong>libuv thread pool</strong> or OS kernel.</li><li>The main thread continues to handle other requests.</li><li>When the operation finishes, it <strong>returns a callback/promise</strong>, and the <strong>event loop</strong> executes it.</li></ul><h3>What is the Event Loop?</h3><p>** The <strong>Event Loop</strong> is the <strong>heart</strong> of Node.js. Event Loop keeps spinning endlessly handling asynchronous tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EkJ5tyy0EZcNx46xNE3uHA.png" /><figcaption>Event loop cycle</figcaption></figure><p>It continuously checks:</p><ul><li>Are there any callbacks, timers, or promises to run?</li><li>Any I/O completed that needs its callback executed?</li></ul><p>It has <strong>phases</strong>:</p><ol><li><strong>Timers Phase</strong> → executes</li><li><strong>I/O Callbacks Phase</strong></li><li><strong>Idle, Prepare</strong></li><li><strong>Poll Phase</strong> → waits for new I/O events</li><li><strong>Check Phase</strong> → executes</li><li><strong>Close Callbacks Phase</strong></li></ol><h3>What is Event Multiplexer?</h3><p>An <strong>Event Multiplexer</strong> is a system-level mechanism used by <strong>libuv</strong> to <strong>watch multiple I/O sources</strong> simultaneously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*FP3vTovp00MI06WLuoRQOA.gif" /><figcaption>multiplexer</figcaption></figure><h3>What is libuv?</h3><p><strong>libuv</strong> is a C library that powers Node.js’s asynchronous behavior.</p><p>It handles:</p><ul><li>Event loop implementation</li><li>Thread pool</li><li>File system operations</li><li>TCP/UDP sockets</li><li>Timers</li><li>Cross-platform compatibility (Windows, Linux, macOS)</li></ul><h3>Further Explanation Using Code Examples</h3><ol><li>Normal JavaScript Code (Single Thread)</li></ol><p>Input -&gt;</p><pre>console.log(&quot;Start&quot;);<br><br>for (let i = 0; i &lt; 3; i++) {<br>  console.log(&quot;Processing:&quot;, i);<br>}<br><br>console.log(&quot;End&quot;);</pre><p>Output -&gt;</p><pre>Start<br>Processing: 0<br>Processing: 1<br>Processing: 2<br>End</pre><p>Explain -&gt;</p><ul><li>Everything runs <strong>synchronously</strong> on the <strong>main thread</strong> , no background work here.</li></ul><p>2. Asynchronous I/O Operation</p><p>Input -&gt;</p><pre>const fs = require(&#39;fs&#39;);<br><br>console.log(&quot;Start&quot;);<br><br>fs.readFile(&quot;test.txt&quot;, &quot;utf8&quot;, (err, data) =&gt; {<br>  console.log(&quot;File content:&quot;, data);<br>});<br><br>console.log(&quot;End&quot;);</pre><p>Output -&gt;</p><pre>Start<br>End<br>File content: Hello Node.js</pre><p>Explain -&gt;</p><h4>Step 1: fs.readFile() is called</h4><ul><li>Node.js passes this task to <strong>libuv</strong>.</li><li>libuv sends it to a <strong>thread in the thread pool</strong> (not the main thread).</li></ul><h4>Step 2: While waiting for the file to be read</h4><ul><li>The <strong>main thread</strong> continues executing .</li></ul><h4>Step 3: File reading completes</h4><ul><li>The background thread signals <strong>libuv</strong> → “I’m done.”</li><li>libuv queues the callback into the <strong>Event Loop</strong>.</li><li>The <strong>main thread</strong> picks it up and executes the callback later.</li></ul><p>** This is <strong>non-blocking I/O</strong> — the main thread is never paused waiting for slow file I/O.</p><p>3. Multiple I/O Requests at Once</p><p>Input -&gt;</p><pre>const fs = require(&#39;fs&#39;);<br><br>console.log(&quot;Start&quot;);<br><br>fs.readFile(&quot;one.txt&quot;, &quot;utf8&quot;, () =&gt; console.log(&quot;one.txt read done&quot;));<br>fs.readFile(&quot;two.txt&quot;, &quot;utf8&quot;, () =&gt; console.log(&quot;two.txt read done&quot;));<br>fs.readFile(&quot;three.txt&quot;, &quot;utf8&quot;, () =&gt; console.log(&quot;three.txt read done&quot;));<br><br>console.log(&quot;End&quot;);</pre><p>Output -&gt;</p><pre>Start<br>End<br>one.txt read done<br>two.txt read done<br>three.txt read done</pre><p>Explain -&gt;</p><ol><li><strong>Main thread:</strong> schedules three file reads.</li><li><strong>libuv:</strong> sends them to the <strong>thread pool</strong> (which, by default, has 4 threads).</li><li>Each thread works <strong>in parallel</strong> reading files.</li><li>When done, they signal back to the main thread through the <strong>event loop.</strong></li></ol><p>** The <strong>main thread</strong> doesn’t wait , it just registers callbacks and moves on.</p><p>4 . Blocking vs Non-Blocking</p><ol><li>Blocking</li></ol><p>Input -&gt;</p><pre>const fs = require(&#39;fs&#39;);<br><br>console.log(&quot;Start&quot;);<br><br>const data = fs.readFileSync(&quot;bigfile.txt&quot;, &quot;utf8&quot;); // blocks thread<br>console.log(&quot;File read complete&quot;);<br><br>console.log(&quot;End&quot;);</pre><p>Output -&gt;</p><pre>Start<br>File read complete<br>End</pre><p>Explain -&gt;</p><p>** The fs.readFileSync blocks the <strong>main thread</strong> , no other code can run during this time.</p><p>2 . Non — Blocking</p><p>Input -&gt;</p><pre>const fs = require(&#39;fs&#39;);<br><br>console.log(&quot;Start&quot;);<br><br>fs.readFile(&quot;bigfile.txt&quot;, &quot;utf8&quot;, () =&gt; {<br>  console.log(&quot;File read complete&quot;);<br>});<br><br>console.log(&quot;End&quot;);</pre><p>Output -&gt;</p><pre>Start<br>End<br>File read complete</pre><p>Explain -&gt;</p><p>** main thread continues execution while file reading happens in a <strong>background thread</strong>.</p><p>5. Using Crypto (libuv Thread Pool)</p><p>Input -&gt;</p><pre>const crypto = require(&#39;crypto&#39;);<br><br>console.log(&quot;Start&quot;);<br><br>for (let i = 0; i &lt; 3; i++) {<br>  crypto.pbkdf2(&quot;password&quot;, &quot;salt&quot;, 100000, 64, &quot;sha512&quot;, () =&gt; {<br>    console.log(`Hash ${i} done`);<br>  });<br>}<br><br>console.log(&quot;End&quot;);</pre><p>Output -&gt;</p><pre>Start<br>End<br>Hash 1 done<br>Hash 0 done<br>Hash 2 done</pre><p>Explain -&gt;</p><ul><li>The crypto.pbkdf2() function is <strong>CPU-intensive</strong>.</li><li>Node.js <strong>offloads</strong> it to the <strong>libuv thread pool</strong> (not the main thread).</li><li>Each hashing runs <strong>in parallel</strong> using separate threads from the pool.</li><li>The callbacks are queued to the <strong>event loop</strong> when each thread finishes.</li></ul><h3>Is Node Non-Blocking? Is It 100% Sure?</h3><p>Yes, <strong>Node.js is non-blocking by design. but with exceptions.</strong></p><ul><li><strong>Non-blocking I/O</strong>: File reads, DB queries, network calls → handled asynchronously.</li><li><strong>Blocking operations</strong>: If you do heavy CPU work (e.g. image processing, loops, encryption) in JS, it <strong>blocks</strong> the event loop.</li></ul><h3><strong>What are the </strong>Drawbacks <strong>and </strong>Benefits <strong>Using Node ?</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*wb6EmNFCu-irv5FHDkyNrg.png" /></figure><p>Thank you for reading this section!</p><p><strong><em>This topic how Node.js handles multiple requests on a single thread is one of the most discussed and debated in the industry. Understanding the event loop, non-blocking I/O, and libuv is essential for writing efficient, scalable applications. It often sparks conversations about best practices, performance, and when to use Node.js versus other technologies. If you found this explanation helpful, feel free to share your thoughts, questions, or experiences discussions like these are what keep the developer community learning and growing!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=06c4f68ffcb9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Do You Know About Dependency Injection, Loose Coupling, and Layered Architecture in Spring Boot?]]></title>
            <link>https://medium.com/@mwpnethsarani/do-you-know-about-dependency-injection-loose-coupling-and-layered-architecture-in-spring-boot-76633ee3ca88?source=rss-6fc65d8dc22f------2</link>
            <guid isPermaLink="false">https://medium.com/p/76633ee3ca88</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ideas]]></category>
            <category><![CDATA[concepts-for-beginners]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Pabodya Nethsarani]]></dc:creator>
            <pubDate>Wed, 04 Jun 2025 09:25:14 GMT</pubDate>
            <atom:updated>2025-06-04T09:25:14.963Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/224/1*qV3Kh7vmVM2pa1_DRs4daQ.jpeg" /><figcaption>Do you know ??</figcaption></figure><h3>Do You Know About Dependency Injection? What Is It?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*cQZWCIfrM0pnS9CYghwKlw.png" /><figcaption>Dependency</figcaption></figure><p><strong>Dependency Injection (DI)</strong> is a design pattern where <strong>dependencies (objects)</strong> are provided to a class <strong>from the outside</strong>, rather than the class creating them itself.<br>In Spring Boot, Dependency Injection is handled automatically using annotations like @Autowired, @Component, @Service, and @Repository.</p><h4>Without Dependency Injection (Tightly Coupled)</h4><pre>CustomerService customerService = new CustomerService();</pre><h4>With Dependency Injection (Tightly Coupled)</h4><pre>@Autowired<br>private CustomerService customerService;</pre><h3>What Is Loosely Coupled and Tightly Coupled? Which Is Better?</h3><h4>Loosely Coupled</h4><p><em>Classes depend on </em><strong><em>abstractions (interfaces)</em></strong><em> rather than concrete implementations. Easier to change, test, and maintain.</em></p><h4>Tightly Coupled</h4><p><em>One class is directly dependent on another specific class. Any change in one affects the other.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/674/1*Cq8BdOVJ9___kdFXIJg5Xw.png" /><figcaption>different between loosely coupling and tightly coupling</figcaption></figure><p><strong>Loose Coupling is better</strong> — it’s flexible, scalable, and follows good software design principles (e.g., SOLID).</p><h3>What Is Layered Architecture?</h3><p>Layered architecture separates your application into layers, each with a specific responsibility. In <strong>Spring Boot</strong>, we commonly use 3 layers-&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*EpU2ZXRoRlm9GcI6VJFhKg.png" /><figcaption>simple layered for example</figcaption></figure><p>Each layer talks <strong>only to the one directly below it</strong>, making the app easier to manage and test.</p><h3>How to Use Loose Coupling in Spring Boot Layered Architecture?</h3><p>Ex — build the customer management System<br><em>example code</em></p><ol><li>Customer Entity(table structures)</li></ol><pre>@Entity<br>public class Customer {<br>    @Id<br>    @GeneratedValue(strategy = GenerationType.IDENTITY)<br>    private Long id;<br>    private String name;<br>    private String email;<br>    // Getters and Setters<br>}</pre><p>2. Repository</p><pre>@Repository<br>public interface CustomerRepository extends JpaRepository&lt;Customer, Long&gt;<br>{<br>}</pre><p>3. Service Interface (Abstraction = Loose Coupling)</p><pre>public interface CustomerService {<br>    Customer getCustomerById(Long id);<br>}</pre><p>4. Service Implementation</p><pre>@Service<br>public class CustomerServiceImpl implements CustomerService {<br><br>    @Autowired<br>    private CustomerRepository customerRepository;<br><br>    @Override<br>    public Customer getCustomerById(Long id) {<br>        return customerRepository.findById(id)<br>                .orElseThrow(() -&gt; new RuntimeException(&quot;Customer not found&quot;));<br>    }<br>}</pre><p>5. Controller</p><pre>@RestController<br>@RequestMapping(&quot;/customers&quot;)<br>public class CustomerController {<br><br>    private final CustomerService customerService;<br><br>    @Autowired<br>    public CustomerController(CustomerService customerService) {<br>        this.customerService = customerService;<br>    }<br><br>    @GetMapping(&quot;/{id}&quot;)<br>    public ResponseEntity&lt;Customer&gt; getCustomer(@PathVariable Long id) {<br>        return ResponseEntity.ok(customerService.getCustomerById(id));<br>    }<br>}</pre><p>In a Spring Boot project, we aim to keep components loosely coupled to ensure flexibility and maintainability. Instead of directly depending on a specific class, like a concrete service implementation, the controller interacts with an interface in this case, customerService. This approach allows the actual implementation, such as customerServiceIMPL, to be changed, extended, or replaced without modifying the controller. Spring Boot manages this connection through Dependency Injection, where it automatically provides the appropriate implementation at runtime. This separation of concerns makes the system more adaptable to change, easier to test, and better aligned with clean architecture principles — which is why dependency injection and loose coupling are essential practices in any well-structured Spring Boot application.</p><h3>What are the Benefits of Dependency Injection &amp; Loose Coupling ?</h3><ul><li><strong>Flexibility &amp; Replaceability</strong><br> You can easily switch or upgrade service implementations without changing the dependent classes like controllers.</li><li><strong>Better Testability</strong><br> You can inject mock implementations during unit testing, making it easy to isolate and test components.</li><li><strong>Improved Maintainability</strong><br> Code is easier to maintain because each component has a single responsibility and minimal knowledge of other parts.</li><li><strong>Scalability</strong><br> As your application grows, loosely coupled components allow for cleaner expansion without major rewrites.</li><li><strong>Reusability</strong><br> Interfaces and implementations can be reused in different parts of the application or in other projects.</li><li><strong>Cleaner Architecture</strong><br> Follows principles like SOLID and clean architecture by separating concerns between layers (controller, service, repository).</li><li><strong>Spring Boot Integration</strong><br> Spring Boot’s powerful DI container makes this practice seamless — it wires everything automatically, reducing boilerplate code.</li></ul><p>#SpringBoot</p><p>#DependencyInjection</p><p>#LooseCoupling</p><p>#SoftwareArchitecture</p><p>#CleanCode</p><p>#SOLIDPrinciples</p><p>#JavaDevelopment</p><p>#BackendDevelopment</p><p>#DesignPatterns</p><p>#SpringFramework</p><p>#MaintainableCode</p><p>#Testability</p><p>#ScalableArchitecture</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76633ee3ca88" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are SOLID Principles?]]></title>
            <link>https://medium.com/@mwpnethsarani/what-are-solid-principles-0c76824ffdc7?source=rss-6fc65d8dc22f------2</link>
            <guid isPermaLink="false">https://medium.com/p/0c76824ffdc7</guid>
            <category><![CDATA[comment]]></category>
            <category><![CDATA[principles]]></category>
            <category><![CDATA[solid]]></category>
            <category><![CDATA[share]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Pabodya Nethsarani]]></dc:creator>
            <pubDate>Fri, 30 May 2025 19:01:51 GMT</pubDate>
            <atom:updated>2025-05-30T19:01:51.519Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*yEm7v_vC1g-v9GifpenIyw.jpeg" /><figcaption>solid principles</figcaption></figure><p><strong>SOLID</strong> is an acronym that represents <strong>five design principles</strong> intended to make software designs more understandable, flexible, and maintainable. These principles are especially useful in <strong>object-oriented programming</strong>.</p><p>S =&gt; <strong>Single Responsibility Principle — </strong>One class = one purpose.</p><p>O =&gt; <strong>Open/Closed Principle — </strong>Open for extension, closed for modification.</p><p>L =&gt; <strong>Liskov Substitution Principle — </strong>Sub classes should behave like their parents.</p><p>I =&gt; <strong>Interface Segregation Principle — </strong>Don’t force things to use what they don’t need.</p><p>D =&gt; <strong>Dependency Inversion Principle — </strong>Depend on abstractions, not concrete classes.</p><h3>Why Do We Use Them?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*eX5dgd__7T6WmTekgpHVCQ.jpeg" /></figure><ul><li>Makes code <strong>easier to read</strong></li><li>Easier to <strong>test and maintain</strong></li><li>Encourages <strong>modular and reusable</strong> design</li><li>Supports <strong>scalability</strong> and reduces bugs</li></ul><h3>How to Use Them in Projects?</h3><h4>1. Single Responsibility Principle (SRP)</h4><p><em>Each class should have only one reason to change.</em></p><p>Bad</p><pre>class User {<br>    void saveToDB() {}<br>    void generateReport() {}<br>}</pre><p>Good</p><pre>class User {}<br>class UserRepository { void save(User u) {} }<br>class ReportGenerator { void generate(User u) {} }</pre><h4>2. Open/Closed Principle (OCP)</h4><p><em>Classes should be open for extension but closed for modification.</em></p><p>Good</p><pre>abstract class PaymentMethod {<br>    abstract void pay();<br>}<br><br>class CreditCard extends PaymentMethod {<br>    void pay() { /* credit card logic */ }<br>}<br><br>class PayPal extends PaymentMethod {<br>    void pay() { /* PayPal logic */ }<br>}</pre><h4>3. Liskov Substitution Principle (LSP)</h4><p><em>You should be able to replace a parent class with its subclass without breaking the program.</em></p><p>Good</p><pre>class Animal {<br>    void speak() {}<br>}<br><br>class Dog extends Animal {<br>    void speak() { System.out.println(&quot;Bark&quot;); }<br>}</pre><h4>4. Interface Segregation Principle (ISP)</h4><p><em>Clients should not be forced to depend on methods they do not use.</em></p><p>Bad</p><pre>interface Worker {<br>    void code();<br>    void test();<br>}</pre><p>Good</p><pre>interface Developer {<br>    void code();<br>}<br><br>interface Tester {<br>    void test();<br>}</pre><h4>5. Dependency Inversion Principle (DIP)</h4><p><em>Depend on abstractions, not on concrete implementations.</em></p><p>Bad</p><pre>class AppointmentService {<br>    EmailSender email = new EmailSender(); // tightly coupled<br>}</pre><p>Good</p><pre>interface NotificationSender {<br>    void send(String message);<br>}<br><br>class EmailSender implements NotificationSender {<br>    public void send(String message) {}<br>}<br><br>class AppointmentService {<br>    private NotificationSender sender;<br>    <br>    public AppointmentService(NotificationSender sender) {<br>        this.sender = sender;<br>    }<br>}</pre><p><em>Thank you for taking the time to read and explore these concepts with me. Understanding and applying principles like OOP and SOLID not only enhances our technical skills but also empowers us to build better, scalable, and maintainable software. I’m excited to continue learning and improving, and I truly appreciate your support and guidance along this journey.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0c76824ffdc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What are OOP Concepts?]]></title>
            <link>https://medium.com/@mwpnethsarani/what-are-oop-concepts-a1f73fa7dde5?source=rss-6fc65d8dc22f------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1f73fa7dde5</guid>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[concept]]></category>
            <category><![CDATA[oop-concepts]]></category>
            <dc:creator><![CDATA[Pabodya Nethsarani]]></dc:creator>
            <pubDate>Fri, 30 May 2025 18:32:51 GMT</pubDate>
            <atom:updated>2025-05-30T18:32:51.999Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9rwT6-zTGZMQo-nAKAS7SA.png" /><figcaption>oop concepts</figcaption></figure><p>OOP (Object-Oriented Programming) is a programming paradigm based on the concept of <strong>“objects”</strong> — entities that contain <strong>data (attributes)</strong> and <strong>behavior (methods/functions)</strong>.</p><p>The <strong>4 core principles</strong> of OOP are:</p><ol><li><strong>Encapsulation — </strong>Hiding internal details and exposing only what is necessary.</li><li><strong>Abstraction</strong> — Defining a blueprint while hiding complexity from the user.</li><li><strong>Inheritance</strong> — Reusing properties and behaviors from parent classes.</li><li><strong>Polymorphism</strong> — Performing different actions based on the same method call.</li></ol><h3>Is OOP Useful in Projects?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*p0W37-X4hAsLSsNLS8eeOQ.jpeg" /></figure><p><strong>Yes — absolutely!</strong><br> OOP makes your projects:</p><ul><li><strong>Modular</strong> (easier to organize),</li><li><strong>Reusable</strong> (less code duplication),</li><li><strong>Maintainable</strong> (easier to fix and update),</li><li><strong>Scalable</strong> (better for large and growing systems).</li></ul><p>Whether you’re building a <strong>Spring Boot API</strong>, a <strong>C++ game</strong>, a <strong>PHP web app</strong>, or any modular software, OOP gives your code structure and strength.</p><h3>How OOP is Used in Real Projects (By Language)?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*yQYPdn5n_NyE7F9zyvz1bA.jpeg" /><figcaption>discussion</figcaption></figure><h4>1.Spring Boot (Java)</h4><p>Spring Boot <em>heavily relies</em> on OOP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*gxXLMIuJDHCH7fwIgEP1cg.png" /></figure><ul><li><strong>Encapsulation</strong> — You define fields in classes (e.g., User, Order) and access them via getters/setters.</li></ul><pre>public class User {<br>    private String name;<br>    public String getName() { return name; }<br>    public void setName(String name) { this.name = name; }<br>}</pre><ul><li><strong>Inheritance</strong> — Common service or controller logic can be inherited.</li></ul><pre>class Vehicle {<br>    void move() { System.out.println(&quot;Moving&quot;); }<br>}<br>class Car extends Vehicle {<br>    void horn() { System.out.println(&quot;Beep&quot;); }<br>}</pre><ul><li><strong>Abstraction</strong> — Using interfaces like JpaRepository.</li></ul><pre>interface Animal {<br>    void makeSound();<br>}<br>class Dog implements Animal {<br>    public void makeSound() {<br>        System.out.println(&quot;Bark&quot;);<br>    }<br>}</pre><ul><li><strong>Polymorphism</strong> — Using method overriding (e.g., different logic for save() in different services).</li></ul><pre>Vehicle v = new Car();<br>v.move(); // Will call the overridden method in Car if present</pre><h4>2. C++</h4><p>C++ is fully object-oriented:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*8pXo5EoS1bP4eo5ZKdlGLw.png" /></figure><ul><li>Use <strong>classes</strong>, <strong>inheritance</strong>, <strong>constructors</strong>, and <strong>virtual functions</strong>.</li><li>Build systems like <strong>banking</strong>, <strong>games</strong>, or <strong>inventory management</strong> using OOP principles.</li><li><strong>Encapsulation</strong></li></ul><pre>class User {<br>private:<br>    string name;<br>public:<br>    void setName(string n) { name = n; }<br>    string getName() { return name; }<br>};</pre><ul><li><strong>Inheritance</strong></li></ul><pre>class Animal {<br>public:<br>    void eat() { cout &lt;&lt; &quot;Eating&quot;; }<br>};<br>class Dog : public Animal {<br>public:<br>    void bark() { cout &lt;&lt; &quot;Barking&quot;; }<br>};</pre><ul><li><strong>Abstraction</strong></li></ul><pre>class Shape {<br>public:<br>    virtual void draw() = 0; // Pure virtual function<br>};</pre><ul><li><strong>Polymorphism</strong></li></ul><pre>Animal* a = new Dog();<br>a-&gt;eat(); // Runtime polymorphism</pre><h4>3. PHP</h4><p>Modern PHP (especially 7+) supports full OOP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*5kZ1056z2kTju95rkkqulQ.png" /></figure><ul><li>Use <strong>classes</strong> for things like User, Product, Cart.</li><li>Build web applications using <strong>MVC architecture</strong>, where OOP is key.</li><li><strong>Encapsulation</strong></li></ul><pre>class User {<br>    private $name;<br>    public function setName($name) { $this-&gt;name = $name; }<br>    public function getName() { return $this-&gt;name; }<br>}</pre><ul><li><strong>Inheritance</strong></li></ul><pre>class Vehicle {<br>    public function move() { echo &quot;Moving&quot;; }<br>}<br>class Car extends Vehicle {<br>    public function honk() { echo &quot;Beep&quot;; }<br>}</pre><ul><li><strong>Abstraction</strong></li></ul><pre>abstract class Animal {<br>    abstract public function makeSound();<br>}<br>class Cat extends Animal {<br>    public function makeSound() {<br>        echo &quot;Meow&quot;;<br>    }<br>}</pre><ul><li><strong>Polymorphism</strong></li></ul><pre>function makeAnimalSound(Animal $animal) {<br>    $animal-&gt;makeSound();<br>}</pre><p>“<em>Thank you for helping me understand these concepts clearly. I’m excited to apply this knowledge to improve my project development skills. I now feel more confident using OOP principles like encapsulation, abstraction, inheritance, and polymorphism in real-world applications — and I look forward to using them to build better, more structured, and maintainable softwatware”.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1f73fa7dde5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is CMS ?]]></title>
            <link>https://medium.com/@mwpnethsarani/what-is-cms-e53f357d2767?source=rss-6fc65d8dc22f------2</link>
            <guid isPermaLink="false">https://medium.com/p/e53f357d2767</guid>
            <dc:creator><![CDATA[Pabodya Nethsarani]]></dc:creator>
            <pubDate>Fri, 27 Sep 2024 05:56:30 GMT</pubDate>
            <atom:updated>2024-09-27T05:56:30.407Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is CMS ?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QeLRAJh6Gu0k1A3paA7y7Q.png" /></figure><p>A <strong>Content Management System (CMS)</strong> is software that enables users to create, manage, and modify digital content on websites without requiring extensive technical knowledge like coding or programming. CMS platforms are often used to streamline the process of building and maintaining websites by allowing users to manage content such as text, images, videos, and more through an easy-to-use interface.</p><p>What are the features of using CMS ?</p><ul><li><strong>Access Control</strong>: Determines who is allowed to create, edit, delete, or publish content.</li><li><strong>Version Control</strong>: Allows users to track changes and return to previous versions of content.</li><li><strong>Library Management</strong>: Provides a repository of page templates, images, and other assets for reuse.</li><li><strong>Content Repository</strong>: Stores text, media, and other assets in a database or XML repository.</li><li><strong>Publishing Functionality</strong>: Combines content and templates to create web pages.</li><li><strong>Security and Governance</strong>: Ensures content is published with proper approvals and compliance processes.</li><li><strong>Multilingual Support</strong>: Offers content in multiple languages for broader reach (e.g., Sinhala , Tamil).</li><li><strong>Standardized Metadata</strong>: Ensures consistency in how content is described, improving searchability and discovery.</li><li><strong>Technology Integration</strong>: Supports a wide range of technology platforms while consolidating where possible.</li></ul><p>What are the roles of the CMS ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qFAVtIPuiB5O3VqAI847hA.jpeg" /></figure><ul><li><strong>Creator</strong>: Responsible for creating and editing content.</li><li><strong>Editor</strong>: Adjusts content to align with the messaging, localization, and translation needs.</li><li><strong>Publisher</strong>: Approves and releases content for public view.</li><li><strong>Administrator</strong>: Manages user access and permissions.</li><li><strong>Consumer/Viewer</strong>: Reads or views the published content</li></ul><p>What are the CMS types ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*YYyLh9sg8noHZFD1T-QuwA.png" /></figure><ul><li><strong>Web Content Management System (WCMS)</strong>: Focuses on managing content for websites.</li><li><strong>Component Content Management System (CCMS)</strong>: Manages content at the component level, allowing reuse across different platforms.</li><li><strong>Document Management System (DMS)</strong>: Handles document storage, tracking, and management in a paperless environment.</li><li><strong>Enterprise Content Management (ECM)</strong>: Organizes and delivers an organization’s documentation, improving workflow and decision-making.</li><li><strong>Digital Asset Management (DAM)</strong>: Centralized storage for digital content like images, videos, and documents.</li></ul><p>What are the example for CMS ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*bUAOt0cTdk0UdRQT0-ZCCw.jpeg" /></figure><p>What are the benefits of the CMS ?</p><ul><li><strong>Ease of Use</strong>: Non-technical users can easily manage content.</li><li><strong>Collaboration</strong>: Supports team-based content creation and management.</li><li><strong>Scalability</strong>: Allows growth without needing significant changes to the system.</li><li><strong>Consistency</strong>: Ensures uniformity in design, governance, and content presentation.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e53f357d2767" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>