<?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 Zaw Hlaing Bwar on Medium]]></title>
        <description><![CDATA[Stories by Zaw Hlaing Bwar on Medium]]></description>
        <link>https://medium.com/@zawhlaingbwar?source=rss-e35bdb60d819------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*ff8V4SEN2PZQJ9L9.</url>
            <title>Stories by Zaw Hlaing Bwar on Medium</title>
            <link>https://medium.com/@zawhlaingbwar?source=rss-e35bdb60d819------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 18:08:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@zawhlaingbwar/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[The Twelve-Factor App]]></title>
            <link>https://medium.com/@zawhlaingbwar/the-twelve-factor-app-2c1a1e64b314?source=rss-e35bdb60d819------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c1a1e64b314</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[12-factor-app]]></category>
            <dc:creator><![CDATA[Zaw Hlaing Bwar]]></dc:creator>
            <pubDate>Mon, 25 Dec 2023 07:34:31 GMT</pubDate>
            <atom:updated>2023-12-25T09:58:15.156Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>What is 12 factor app</strong>:</h3><p>In the realm of software development, it is crucial to build applications that are scalable, maintainable, and easily deployable. To achieve this, developers often follow industry best practices and guidelines. One such set of principles is known as the Twelve-Factor App methodology.</p><p>Its focus on building robust, scalable, and maintainable applications has profoundly influenced how modern software is conceived and constructed. I try to follow Sandi Metzs rules for developers when I am writing code. This is where the twelve-factor app methodology comes into play.</p><p>The Twelve-Factor App methodology provides a comprehensive guide for building modern software-as-a-service (SaaS) applications. It was developed by Heroku co-founder Adam Wiggins and has gained significant popularity among developers worldwide.</p><p>The Twelve-Factor App methodology is a methodology for building software-as-a-service applications. The approach was developed by Adam Wiggins, the co-founder of Heroku, a platform-as-a-service which is now part of <a href="http://salesforce.com/">Salesforce.com</a>.</p><p>Each of the twelve factors addresses a specific aspect of software development, from codebase management to deployment strategies and operational practices. By adhering to these factors, developers can create applications that are resilient, portable, and efficient. The twelve-factor methodology is a set of twelve best practices to develop applications developed to run as a service. This modular approach enables developers to build applications that are more flexible, scalable, and resilient.</p><p>This article aims to delve into each factor individually, providing detailed explanations and practical examples along the way. To enhance understanding, diagrams or images will be used as reference points throughout the text. By exploring these factors in depth, readers will gain valuable insights into how they contribute to successful software development projects.</p><p>In this article, we will explore them in more detail and highlight the main advantages. As a software development professional, understanding the nuances of these environments is vital to ensure the success of your projects. So let’s embark on this journey through the twelve factors and discover how they can positively impact our software development endeavors.</p><p>I. <strong>Codebase</strong>:</p><p>The codebase factor emphasizes the importance of maintaining a single codebase. It means that the entire application code should be stored in a version control system like Git. This ensures that everyone working on the project has access to the same codebase and can collaborate effectively. A single codebase allows for efficient collaboration, version control, and easy tracking of changes made to the application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*fHBwCsaHaUgrTvzHpqQIFg.png" /></figure><p>II. <strong>Dependencies</strong>:</p><p>Dependencies refer to any external libraries, frameworks, or services that the application relies on. It is crucial to define and manage dependencies properly to ensure consistent and reliable application behavior. Using a package manager like npm or Maven can help manage dependencies efficiently. Proper dependency management ensures that the application has access to the required resources and functions seamlessly.</p><p>III. <strong>Config</strong>:</p><p>The config factor emphasizes the separation of configuration from code. Configuration should be stored in environment variables or external configuration files rather than hardcoding values in the code. This allows for easy configuration changes without modifying the codebase. Storing configurations separately from the codebase enables flexibility and easy customization of the application without the need for code modifications.</p><p>IV. <strong>Backing services</strong>:</p><p>Backing services include databases, message queues, caching systems, etc., that the application relies on. The application should treat these services as attached resources and connect to them via environment variables or configuration files. This decouples the application from the specific service provider and allows for easier service substitution. Treating backing services as attached resources ensures that the application can seamlessly switch between different service providers without requiring changes to the core application logic.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*txIaxQ9m5Rzllj9cap28AA.png" /></figure><p>V. <strong>Build, release, run</strong>:</p><p>This factor emphasizes the separation of build, release, and run stages. The build stage compiles the code and packages it into a deployable artifact. The release stage combines the code with the desired configuration to create a deployable release. The run stage executes the application with a specific release. Separating these stages allows for easier management of the deployment process. By separating these stages, developers can easily manage the build process, track the release versions, and execute the application with the desired configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*akjyKYNoC0s-878D4YQAAw.png" /></figure><p>VI. <strong>Processes</strong>:</p><p>Applications should be executed as one or more stateless processes. This means that the application should not store any state locally. Instead, any required state should be stored in shared databases or external services. Stateless processes enable easy scaling and deployment of the application. By storing the application state externally, developers can easily scale the application horizontally by adding more instances without worrying about data inconsistencies or conflicts.</p><p>VII. <strong>Port binding</strong>:</p><p>The application should be self-contained and should not rely on specific port numbers. It should be able to adapt to the port assigned by the execution environment. This allows for easier deployment and scaling of the application. By allowing the application to adapt to the assigned port, developers can easily deploy the application to different environments without the need for manual port configuration.</p><p>VIII. <strong>Concurrency</strong>:</p><p>The application should be able to scale horizontally by adding more concurrent processes. This means that the application should not rely on process-level concurrency mechanisms. Instead, it should utilize language-level concurrency or external services for handling concurrent requests. By utilizing language-level concurrency or external services, developers can ensure efficient handling of concurrent requests without relying on the limitations of process-level concurrency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*dlpS9AJj81dFQg4ULoFpJQ.png" /></figure><p>IX. <strong>Disposability</strong>:</p><p>Applications should be designed to start up quickly and shut down gracefully. This allows for easy scaling and deployment of the application. It also enables effective handling of system failures and crash recovery. By designing applications that start up quickly and shut down gracefully, developers can ensure seamless deployment and efficient handling of system failures, resulting in improved overall application stability.</p><p>X. <strong>Dev/prod parity</strong>:</p><p>The development, staging, and production environments should be as similar as possible. This minimizes the risk of issues occurring in production due to differences between environments. Tools like containers and virtualization can be used to achieve dev/prod parity. By maintaining dev/prod parity, developers can reduce the chances of environment-related issues and ensure that the application behaves consistently across different environments.</p><p>XI. <strong>Logs</strong>:</p><p>Applications should treat logs as event streams and should not concern themselves with log storage. Instead, they should write logs to stdout or stderr, and let the execution environment handle log collection and storage. This simplifies the application’s responsibility and allows for easier log analysis and debugging. By treating logs as event streams and relying on the execution environment for log storage, developers can focus on the application logic while still having access to logs for analysis and debugging purposes.</p><p>XII. <strong>Admin processes</strong>:</p><p>Administrative tasks, such as database migrations or one-time scripts, should be run as separate processes. They should not be bundled with the application code, as this can lead to versioning and deployment issues. Running admin processes as standalone tasks ensures proper isolation and manageability. By running admin processes as separate tasks, developers can ensure proper isolation and manageability of administrative tasks, reducing the chances of versioning and deployment conflicts.</p><p><strong>Conclusion</strong>:</p><p>By following the 12 Factors of Software Development, developers can create applications that are scalable, maintainable, and resilient. These factors provide a framework for building modern, cloud-native applications that can adapt to changing requirements and environments. Incorporating these best practices into your software development process can help improve the overall quality and success of your applications.</p><p>For more detailed information, please refer to the <a href="https://12factor.net/">12 Factor App website</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c1a1e64b314" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Reducing react app’s load time using Suspense, lazy]]></title>
            <link>https://medium.com/@zawhlaingbwar/reducing-react-apps-load-time-using-suspense-lazy-9dc93ea883c7?source=rss-e35bdb60d819------2</link>
            <guid isPermaLink="false">https://medium.com/p/9dc93ea883c7</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[single-page-applications]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[lazy]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Zaw Hlaing Bwar]]></dc:creator>
            <pubDate>Tue, 08 Oct 2019 09:30:05 GMT</pubDate>
            <atom:updated>2019-10-08T09:30:05.265Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aLg1-G2UAlaKpBopRnmCRg.png" /></figure><p>The problem every front-end developers faced using SPA(Single page applications) is the initial loading time. Because the app have to download all the required files right at the start which result in high loading time depending on the bundle size.</p><p>Today I am showing an example to reduce the initial loading time and bundle size by Code-Splitting in React.</p><p>First we will create an react app by create-react-app</p><pre>npx create-react-app react-code-split-test<br>cd react-code-split-test<br>npm start</pre><p>And then install the react router to create routes</p><p>npm i react-router-dom --save</p><p>After that create two new folders in src folder, pages and components.<br>pages →Where we put all the js files for all routes.<br>components → Where we put all the components.</p><figure><img alt="new folders" src="https://cdn-images-1.medium.com/max/1024/1*B8n-6DsnG7vRrFGKPOskOg.png" /></figure><p>Create new files in pages folder, in this example I will create 4 files.<br>PageOne, PageTwo, PageThree, PageFour</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9cD-_Y7OEbjeDlxEEjGrGQ.png" /></figure><p>After creating pages, go back to App.js and specify the routes</p><pre>import { BrowserRouter as Router,Switch, Route, Redirect } from &#39;react-router-dom&#39;;</pre><p>Now the App.js should look like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n7BkXsgaqD7CGSqvWxhlqw.png" /></figure><p>Add some components for Navigation and loading in components folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hdA_y_DFfDpmsy4Ot1WTWw.png" /></figure><p>npm run start and the app should look like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NkNt-GeTriCCSznYWM4rjg.png" /></figure><p>Then, stop the app and try npm run build <br>You can see the bundle js files as follow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B1pvog7zdRWYXd7mxHRyQw.png" /></figure><p>Since, this is an example project and doesn’t include large libraries, the bundle size is small already. But we will try to reduce more by Code-Splitting.</p><p>Now, go to the App.js and let’s modify</p><pre>import React, { Suspense, lazy } from &#39;react&#39;;</pre><p>We are going to use Suspense and Lazy</p><p>Comment out the old imports and use React.Lazy for dynamic import.</p><pre>const PageOne = lazy(() =&gt; import(&#39;./pages/PageOne&#39;));</pre><pre>const PageTwo = lazy(() =&gt; import(&#39;./pages/PageTwo&#39;));</pre><pre>const PageThree = lazy(() =&gt; import(&#39;./pages/PageThree&#39;));</pre><pre>const PageFour = lazy(() =&gt; import(&#39;./pages/PageFour&#39;));</pre><p>Use Suspense under Router component, and your App.js should looks like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LJ_llhczHXxQs_q4GOvuzg.png" /></figure><p>You can try npm run start and the app should load faster.</p><p>You may notice that the Loading component in fallback props show while you changing routes for the first time.</p><p>React.Lazy dynamically import the files, only if you go to the specific route.</p><p>Now, try npm run build and you can see that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rCyXNHrfipD9q2bYRZ8oFg.png" /></figure><p>There are multiple chunk files built according your dynamic imports and that make app run faster in production.</p><p>You can check the source code of this example <a href="https://github.com/zaw-hlaing-bwar/reactLazy">https://github.com/zaw-hlaing-bwar/reactLazy</a></p><p>Thank you for your attention and I would like to say Sorry if I made any mistake above.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9dc93ea883c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>