<?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 Vivek Dogra on Medium]]></title>
        <description><![CDATA[Stories by Vivek Dogra on Medium]]></description>
        <link>https://medium.com/@vivekdogra02?source=rss-840a8f2c1a19------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5nzq1ycJHDZx08cVxZLrfw.png</url>
            <title>Stories by Vivek Dogra on Medium</title>
            <link>https://medium.com/@vivekdogra02?source=rss-840a8f2c1a19------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 10:55:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vivekdogra02/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[We Spent 3 Weeks Overengineering an AI Feature No One Had Validated Yet]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/bitsrc/we-spent-3-weeks-overengineering-an-ai-feature-no-one-had-validated-yet-2df3505f2110?source=rss-840a8f2c1a19------2"><img src="https://cdn-images-1.medium.com/max/1376/1*vLv8PxJGaAO8uw5xR-LjmA.png" width="1376"></a></p><p class="medium-feed-snippet">The uncomfortable truth about MCP, architecture, and the fear of looking junior</p><p class="medium-feed-link"><a href="https://medium.com/bitsrc/we-spent-3-weeks-overengineering-an-ai-feature-no-one-had-validated-yet-2df3505f2110?source=rss-840a8f2c1a19------2">Continue reading on Bits and Pieces »</a></p></div>]]></description>
            <link>https://medium.com/bitsrc/we-spent-3-weeks-overengineering-an-ai-feature-no-one-had-validated-yet-2df3505f2110?source=rss-840a8f2c1a19------2</link>
            <guid isPermaLink="false">https://medium.com/p/2df3505f2110</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Vivek Dogra]]></dc:creator>
            <pubDate>Fri, 27 Feb 2026 15:18:35 GMT</pubDate>
            <atom:updated>2026-02-27T15:18:35.544Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[        .]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/bitsrc/-405362cbc7c9?source=rss-840a8f2c1a19------2"><img src="https://cdn-images-1.medium.com/max/984/1*smkBxW1dClq9MIum_jz84A.png" width="984"></a></p><p class="medium-feed-snippet">For a long time, I had a simple mental model:</p><p class="medium-feed-link"><a href="https://medium.com/bitsrc/-405362cbc7c9?source=rss-840a8f2c1a19------2">Continue reading on Bits and Pieces »</a></p></div>]]></description>
            <link>https://medium.com/bitsrc/-405362cbc7c9?source=rss-840a8f2c1a19------2</link>
            <guid isPermaLink="false">https://medium.com/p/405362cbc7c9</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[rxjs]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Vivek Dogra]]></dc:creator>
            <pubDate>Mon, 23 Feb 2026 14:32:06 GMT</pubDate>
            <atom:updated>2026-02-23T14:32:06.484Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Semantic Search Beyond Keyword Matching]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/front-end-weekly/semantic-search-beyond-keyword-matching-864d1d106c76?source=rss-840a8f2c1a19------2"><img src="https://cdn-images-1.medium.com/max/898/1*IjX7rWo5GT8s3zxzHyKDig.png" width="898"></a></p><p class="medium-feed-snippet">Most of us think we understand semantic search.</p><p class="medium-feed-link"><a href="https://medium.com/front-end-weekly/semantic-search-beyond-keyword-matching-864d1d106c76?source=rss-840a8f2c1a19------2">Continue reading on Frontend Weekly »</a></p></div>]]></description>
            <link>https://medium.com/front-end-weekly/semantic-search-beyond-keyword-matching-864d1d106c76?source=rss-840a8f2c1a19------2</link>
            <guid isPermaLink="false">https://medium.com/p/864d1d106c76</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Vivek Dogra]]></dc:creator>
            <pubDate>Mon, 23 Feb 2026 14:30:45 GMT</pubDate>
            <atom:updated>2026-02-23T14:30:45.657Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[AI: Semantic Search Beyond Keyword Matching]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://vivekdogra02.medium.com/ai-semantic-search-beyond-keyword-matching-b790d4d7bdd1?source=rss-840a8f2c1a19------2"><img src="https://cdn-images-1.medium.com/max/600/1*IjX7rWo5GT8s3zxzHyKDig.png" width="600"></a></p><p class="medium-feed-snippet">Most of us think we understand semantic search.</p><p class="medium-feed-link"><a href="https://vivekdogra02.medium.com/ai-semantic-search-beyond-keyword-matching-b790d4d7bdd1?source=rss-840a8f2c1a19------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://vivekdogra02.medium.com/ai-semantic-search-beyond-keyword-matching-b790d4d7bdd1?source=rss-840a8f2c1a19------2</link>
            <guid isPermaLink="false">https://medium.com/p/b790d4d7bdd1</guid>
            <category><![CDATA[productivity]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Vivek Dogra]]></dc:creator>
            <pubDate>Mon, 09 Feb 2026 20:23:18 GMT</pubDate>
            <atom:updated>2026-02-09T20:23:18.215Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Mastering Node.js: A Comprehensive Guide to 100 Basic to Advanced Questions for Every Developer ]]></title>
            <link>https://javascript.plainenglish.io/mastering-node-js-a-comprehensive-guide-to-100-basic-to-advanced-questions-for-every-developer-f9185ccf90a0?source=rss-840a8f2c1a19------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9185ccf90a0</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Vivek Dogra]]></dc:creator>
            <pubDate>Tue, 28 Nov 2023 13:23:36 GMT</pubDate>
            <atom:updated>2023-11-30T01:49:21.328Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1znATvc9n01uh7vC" /><figcaption>Photo by <a href="https://unsplash.com/@purzlbaum?utm_source=medium&amp;utm_medium=referral">Claudio Schwarz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Today, I am going to share NodeJS Question, from Basic to Advanced, please share your thoughts and add more to it, if you have any —</p><h3>Node.js Basics:</h3><ol><li>What is Node.js?</li><li>Explain the architecture of Node.js.</li><li>How does Node.js handle concurrent requests?</li><li>What is the role of the event loop in Node.js?</li><li>Describe the use of the V8 engine in Node.js.</li><li>How can you install a package using npm?</li><li>Explain the purpose of the package.json file.</li><li>Differentiate between process.nextTick() and setImmediate().</li><li>What is the purpose of the Buffer class in Node.js?</li><li>How can you handle environment variables in Node.js?</li></ol><h3>Modules and Dependency Management:</h3><ol><li>What is a module in Node.js?</li><li>How do you create a custom module in Node.js?</li><li>Explain the difference between require and import in Node.js.</li><li>Describe the CommonJS module system.</li><li>What is the purpose of the module.exports object?</li><li>How do you handle circular dependencies in Node.js?</li><li>Explain the significance of the node_modules folder.</li><li>What are the differences between npm install and npm ci?</li><li>How can you update dependencies to their latest versions using npm?</li><li>What is the purpose of the package-lock.json file?</li></ol><h3>Asynchronous Programming:</h3><ol><li>Explain the concept of callback functions in Node.js.</li><li>What is the Event Emitter class in Node.js, and how is it used?</li><li>Describe the purpose of the Promise object in Node.js.</li><li>How do you handle errors in asynchronous code in Node.js?</li><li>Compare and contrast callbacks and Promises.</li><li>What is the purpose of the async and await keywords in Node.js?</li><li>Explain the role of the setTimeout function in asynchronous programming.</li><li>How does Node.js handle blocking and non-blocking code?</li><li>Describe the use of the process.nextTick() function.</li></ol><h3>Web Development with Node.js:</h3><ol><li>How can you create a simple HTTP server in Node.js?</li><li>Explain the difference between res.send and res.end in Express.js.</li><li>What is middleware in Express.js?</li><li>How do you handle form data in an Express.js application?</li><li>Explain the purpose of the Express.js Router.</li><li>What is the purpose of the app.use function in Express.js?</li><li>How can you implement routing in an Express.js application?</li><li>Describe the role of the body-parser middleware.</li><li>What is RESTful API, and how can you implement it in Node.js?</li><li>How do you handle file uploads in an Express.js application?</li></ol><h3>Security in Node.js:</h3><ol><li>Explain the concept of Cross-Origin Resource Sharing (CORS).</li><li>How can you prevent SQL injection in a Node.js application?</li><li>What is the purpose of the Helmet middleware in Express.js?</li><li>Describe how to handle authentication in Node.js.</li><li>How can you protect against common security vulnerabilities in Node.js?</li><li>Explain the significance of the Same-Origin Policy.</li><li>How do you implement HTTPS in a Node.js application?</li><li>Describe the purpose of the crypto module in Node.js.</li></ol><h3>Testing in Node.js:</h3><ol><li>What is unit testing, and how can you perform it in Node.js?</li><li>Explain the purpose of the assert module in Node.js.</li><li>How do you use Mocha for testing in Node.js?</li><li>What is Chai, and how is it used in testing?</li><li>Describe the difference between unit testing and integration testing.</li><li>How can you mock dependencies in Node.js tests?</li><li>What is the purpose of the supertest library?</li><li>How do you test asynchronous code in Node.js?</li><li>Explain the significance of code coverage in testing.</li></ol><h3>Database and Data Handling:</h3><ol><li>How do you connect Node.js to a MongoDB database?</li><li>Describe the role of an Object-Relational Mapping (ORM) in Node.js.</li><li>What is the purpose of the sequelize library in Node.js?</li><li>How can you use the mongoose library for schema validation in MongoDB?</li><li>Explain the difference between SQL and NoSQL databases.</li><li>How do you perform CRUD operations in Node.js with a database?</li><li>Describe the purpose of connection pooling in database connections.</li><li>What is a transaction, and how can you implement it in Node.js?</li></ol><h3>Performance Optimization:</h3><ol><li>How can you improve the performance of a Node.js application?</li><li>Explain the purpose of the cluster module in Node.js.</li><li>Describe how to implement caching in a Node.js application.</li><li>What is the significance of the --inspect flag in Node.js?</li><li>How do you profile and debug a Node.js application?</li><li>Explain the concept of garbage collection in Node.js.</li></ol><h3>Real-time Applications:</h3><ol><li>How can you implement WebSockets in a Node.js application?</li><li>Describe the purpose of the Socket.io library.</li><li>How do you handle real-time updates in a Node.js application?</li><li>Explain the concept of server-sent events (SSE) in Node.js.</li><li>What is the significance of long polling in real-time applications?</li></ol><h3>Deployment and DevOps:</h3><ol><li>How do you deploy a Node.js application to a production server?</li><li>Explain the purpose of process managers like PM2 in Node.js.</li><li>What is Docker, and how can you use it with Node.js?</li><li>Describe the use of environment variables in a production Node.js application.</li><li>How do you monitor the performance of a deployed Node.js application?</li></ol><h3>Miscellaneous:</h3><ol><li>Explain the difference between process.argv and process.env in Node.js.</li><li>How can you use the child_process module in Node.js?</li><li>Describe the purpose of the os module in Node.js.</li><li>What is the role of the url module in Node.js?</li><li>How do you handle file operations in Node.js?</li><li>Explain the purpose of the events module in Node.js.</li><li>Describe the use of the fs module for file system operations.</li><li>How can you implement authentication using JSON Web Tokens (JWT) in Node.js?</li><li>What is the purpose of the stream module in Node.js?</li><li>How do you handle cross-platform issues in a Node.js application?</li></ol><h3>Advanced Concepts:</h3><ol><li>Explain the concept of microservices and how it can be implemented in Node.js.</li><li>How do you handle memory leaks in a long-running Node.js application?</li><li>Describe the purpose of the async_hooks module in Node.js.</li><li>How can you implement serverless architecture using Node.js?</li><li>Explain the concept of GraphQL and how it differs from REST.</li><li>How do you implement server-side rendering (SSR) in a Node.js application?</li><li>Describe the use of WebAssembly in Node.js.</li><li>How can you use the worker_threads module for multi-threading in Node.js?</li><li>What is the purpose of the N-API in Node.js?</li><li>Explain the concept of the Node.js event loop phases.</li></ol><h4><strong>Thanks for your time, will be back with more interesting content.</strong></h4><p>“🌟 Embark on a journey of knowledge and creativity with me!</p><p>Join my circle to stay updated on insightful content that fuels inspiration. Let’s explore, learn, and write our stories together! 🚀✍️ #FollowForIdeas #CreateAndConnect”</p><h3>Thanks for reading</h3><ul><li>👏 Please clap for the story and follow me 👉</li><li>📰 <a href="https://medium.com/@vivekdogra02">View more content</a></li><li>🔔 Follow me: <a href="https://www.linkedin.com/in/vivek-dogra-7404a530/">LinkedIn </a>| <a href="https://twitter.com/VivekDo07905087">Twitter </a>| <a href="https://github.com/vivekdogra02">Github</a></li></ul><p>#NodeJS #JavaScript #Programming #WebDevelopment</p><h3><a href="https://plainenglish.io/">PlainEnglish.io</a> 🚀</h3><p><em>Thank you for being a part of the In Plain English community! Before you go:</em></p><ul><li><em>Be sure to </em><strong><em>clap</em></strong><em> and </em><strong><em>follow</em></strong><em> the writer</em><strong>️</strong></li><li><em>Learn how you can also </em><a href="https://plainenglish.io/blog/how-to-write-for-in-plain-english"><strong><em>write for In Plain English</em></strong></a><em>️</em></li><li><em>Follow us: </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>X</em></strong></a><strong><em> | </em></strong><a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><strong><em> | </em></strong><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><strong><em> | </em></strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong><em>Discord</em></strong></a><strong><em> | </em></strong><a href="https://newsletter.plainenglish.io/"><strong><em>Newsletter</em></strong></a></li><li><em>Visit our other platforms: </em><a href="https://stackademic.com/"><strong><em>Stackademic</em></strong></a><strong><em> | </em></strong><a href="https://cofeed.app/"><strong><em>CoFeed</em></strong></a><strong><em> | </em></strong><a href="https://venturemagazine.net/"><strong><em>Venture</em></strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9185ccf90a0" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/mastering-node-js-a-comprehensive-guide-to-100-basic-to-advanced-questions-for-every-developer-f9185ccf90a0">Mastering Node.js: A Comprehensive Guide to 100 Basic to Advanced Questions for Every Developer 🚀</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Atomic Design Unleashed: Building Consistency Through Design Systems]]></title>
            <link>https://javascript.plainenglish.io/atomic-design-unleashed-building-consistency-through-design-systems-b74ab5bc5479?source=rss-840a8f2c1a19------2</link>
            <guid isPermaLink="false">https://medium.com/p/b74ab5bc5479</guid>
            <category><![CDATA[design-thinking]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Vivek Dogra]]></dc:creator>
            <pubDate>Mon, 21 Aug 2023 14:07:41 GMT</pubDate>
            <atom:updated>2023-08-22T03:07:39.667Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zkTQLHErzn56h-f_" /><figcaption>Photo by <a href="https://unsplash.com/@clarktibbs?utm_source=medium&amp;utm_medium=referral">Clark Tibbs</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Hi Folks, Today we are going to learn and explore about what are design systems, what is your role as an engineer to know about design systems, is it really useful to use a design systems or it is mere a proof of concept to be used? and also how it will be beneficial for a team to have a design system across various projects while developing application.</p><h3>What is a Design System?</h3><p>A design system is a comprehensive collection of guidelines, components, patterns, and assets that are used to create consistent and cohesive user interfaces across a product or organization. It serves as a single source of truth for design and UI-related decisions, making it easier to maintain a unified and polished look and feel across different parts of an application.</p><h4>That is it ?</h4><p><strong>Really</strong>, Let me break down for you, A design system is nothing but a collection of style guidelines, components(Atoms), assets, combination of components(Molecules) ex: Header section, navbar etc. which consists of different types of components(atoms). It is something like a LEGO bricks which constitutes to a whole new structure when being joined together.</p><p>So, think about design systems as a magic recipe book for making websites and apps. Inside, there are secret ingredients called “design tokens” that give colors, fonts, and spaces their special flavors. These ingredients help designers and builders speak the same language, so everything they create looks like they belong together.</p><p>Imagine a box of building blocks. Design systems give you those blocks, but they’re not just ordinary blocks — they’re smart blocks. They know how to make buttons, menus, and other cool things that people use on screens. This means that instead of starting from scratch every time, we can use these smart blocks to build things faster and better.</p><p>So, there is concept of Atomic Design system, when we talk about design system, it is the basic and more foundational one to understand the design system as a whole.</p><h3>Atomic Design System(Methodology)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sUD_2b__PTbp5H7aLlkGSA.png" /></figure><blockquote>Atoms, molecules, organisms, templates, and pages</blockquote><p>Welcome to the Atomic design system, a dynamic toolkit that empowers designers and developers to build interfaces that are not just visually appealing, but also functionally robust. Think of it as a LEGO set for creating stunning user experiences! 🚀</p><h4><strong>Atoms</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CAIdZZKHPY1TZQs5" /><figcaption>Photo by <a href="https://unsplash.com/@theshubhamdhage?utm_source=medium&amp;utm_medium=referral">Shubham Dhage</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The elemental building blocks of your interface. These atoms are like the tiny particles that form the foundation of everything, from simple buttons to intricate navigation bars. <strong><em>They’re your UI’s DNA</em></strong>, defining colors, typography, and spacing that ensure consistency across the board. Imagine them as the primary hues on your painter’s palette, ready to splash vibrancy onto your canvas.</p><p>But atoms alone don’t tell the whole story.</p><h4><strong>Molecules</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cWi7X12zB6Ye2pCs" /><figcaption>Photo by <a href="https://unsplash.com/@vlisidis?utm_source=medium&amp;utm_medium=referral">Terry Vlisidis</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Atoms come together to form ‘molecules’ — charming clusters of atoms that fulfill specific functions. <strong>Think of a search bar:</strong> it’s not just a button or an input field, it’s a fusion of both that serves a distinct purpose. Molecules are the quirky puzzle pieces that snap together seamlessly, forming the framework for your user interface landscape.</p><h4><strong>Organisms</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FXxaUxgdfvleHXo7" /><figcaption>Photo by <a href="https://unsplash.com/@cdc?utm_source=medium&amp;utm_medium=referral">CDC</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Zoom out a bit more, and you encounter ‘organisms’ — dynamic ecosystems composed of molecules and atoms working in harmony. <strong>Consider a navigation menu:</strong> it’s more than just a collection of buttons; it’s a thoughtful arrangement of components that guide users on their digital journey. Organisms are like mini worlds where UI elements collaborate to create delightful user experiences.</p><h4><strong>Templates</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RcrcR_cGsPzACKd9" /><figcaption>Photo by <a href="https://unsplash.com/@tim_arterbury?utm_source=medium&amp;utm_medium=referral">Tim Arterbury</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Crafting Consistent Layouts with Purpose. Templates are the blueprints that guide the arrangement of <strong>organisms</strong>, <strong>molecules</strong>, and <strong>atoms </strong>across various sections of your application. Think of them as the architectural plans for your digital spaces. Templates establish the structural framework, ensuring that your user interface maintains a consistent and visually pleasing layout.</p><p>Just as architects design floor plans for different rooms in a building, templates define the structure of your application’s different screens or sections. They dictate where specific elements should go, such as headers, sidebars, content sections, and footers. By adhering to template guidelines, you ensure a seamless transition between different areas of your app, creating a sense of familiarity for users.</p><p>Templates also play a crucial role in responsiveness. With the prevalence of various devices and screen sizes, templates help you design interfaces that adapt gracefully to different contexts.</p><h4>Pages</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xN3x3LgMKSB4fLPu" /><figcaption>Photo by <a href="https://unsplash.com/@otutunaru?utm_source=medium&amp;utm_medium=referral">Olga Tutunaru</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Pages are where the magic happens — they’re the dynamic culmination of templates populated with real content and data. Just as a movie’s script comes to life on the big screen, your design system’s components come together on pages to tell a compelling digital story.</p><p>Pages showcase how various elements interact with each other in real-world scenarios. They demonstrate how different organisms, molecules, and atoms collaborate to create meaningful user journeys. Imagine a product page on an e-commerce site: it’s not just about displaying images and text; it’s about crafting an experience that entices users to explore, engage, and ultimately make a purchase.</p><p>The beauty of the Atomic design system shines through on pages. By assembling pre-designed components into coherent layouts, you save time and effort in the development process. Consistency and harmony reign supreme, as the building blocks you’ve meticulously designed and tested fit together seamlessly.</p><blockquote>In essence, <strong>templates and pages </strong>complete the narrative of your Atomic design system. Templates establish the guidelines that ensure cohesion and adaptability, while pages breathe life into your design vision, showing how your UI components come together to deliver exceptional user experiences. This approach empowers you to create interfaces that not only dazzle the eye but also guide users through delightful journeys in the digital realm.</blockquote><h4>Benefits of Design Systems:</h4><ol><li>Consistency: Design systems ensure that UI elements and patterns remain consistent throughout the application, reducing confusion for users and making the design process more efficient for developers.</li><li>Efficiency: By providing reusable components, design systems speed up development time. Developers can focus more on implementing functionality rather than reinventing the wheel for common UI elements.</li><li>Scalability: As an application grows, a well-structured design system can accommodate changes and new features without sacrificing design integrity.</li><li>Collaboration: Design systems foster collaboration between designers and developers. Both parties work with the same set of components and guidelines, reducing miscommunication and promoting teamwork.</li><li>Accessibility: Design systems can enforce accessibility standards, ensuring that UI components are usable by a wider range of users.</li></ol><h4>Design System Components:</h4><ol><li><strong>Design Tokens:</strong> These are design-specific variables that define things like colors, typography, spacing, and more. They provide a consistent foundation for design decisions.</li><li><strong>UI Components:</strong> Reusable building blocks that make up the interface. Examples include buttons, forms, navigation bars, and modals.</li><li><strong>Guidelines and Documentation:</strong> Clear documentation helps designers and developers understand how to use each component, the intended behavior, and when to use it.</li><li><strong>Patterns and Best Practices:</strong> Design systems often provide guidance on how to combine components to create larger UI patterns. This ensures a cohesive and consistent user experience.</li></ol><h3>What is your role as an engineer to know about design systems</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jjR2mdXwzqOZsPND" /><figcaption>Photo by <a href="https://unsplash.com/@thisisengineering?utm_source=medium&amp;utm_medium=referral">ThisisEngineering RAEng</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>As a developer/engineer, while crafting an application or a project, you should be well aware of the building blocks you are using while creating the project. As an engineer, understanding design systems plays a crucial role in ensuring the successful development and maintenance of user interfaces.</p><p>While your primary focus might be on the technical implementation, your awareness and involvement in design systems contribute to a more holistic and efficient product development process.</p><p>Here’s how your role intersects with design systems:</p><ol><li><strong>Consistent Implementation</strong>: Design systems provide guidelines and specifications for UI elements. By understanding these guidelines, you can implement UI components consistently, ensuring that the design vision is faithfully translated into code.</li><li><strong>Reusability</strong>: Design systems promote the reuse of UI components. As an engineer, you’ll be responsible for creating and maintaining these reusable components, which not only saves time but also ensures uniformity across the application.</li><li><strong>Efficient Development</strong>: By using pre-designed components and following established patterns, you can streamline your development process. This allows you to focus more on the logic and functionality of the application rather than spending time on designing individual UI elements.</li><li><strong>Collaboration with Designers</strong>: Understanding design principles helps you communicate effectively with designers. You can discuss technical constraints, propose solutions, and ensure that the components can be implemented within the given specifications.</li><li><strong>Component Libraries:</strong> Engineers often build and maintain libraries of UI components. These libraries are integral to design systems as they house the building blocks of the user interface. Familiarity with design systems aids in creating well-structured and cohesive component libraries.</li><li><strong>Adaptation and Flexibility:</strong> Design systems can evolve over time. As an engineer, your understanding of the design system’s principles allows you to adapt to changes and updates while maintaining the intended user experience.</li><li><strong>User-Centered Development:</strong> Design systems emphasize user-centered design. By understanding the design system’s user-centric approach, you can ensure that the UI components you implement align with the needs and expectations of the users.</li><li><strong>Testing and QA:</strong> Your knowledge of design systems can help you conduct more accurate testing, ensuring that the implemented components align with the expected behavior and design standards.</li><li><strong>Accessibility: </strong>Design systems often include accessibility guidelines. As an engineer, you’ll need to ensure that the components you build adhere to these guidelines, making the application usable for a wider audience.</li><li><strong>Problem Solving: </strong>Design systems might not cover every scenario. In cases where a specific component or interaction isn’t defined, your understanding of the design system principles can help you make informed decisions that maintain consistency.</li></ol><p>In essence, your role as an engineer in understanding design systems extends beyond coding; it involves collaborating with designers, translating design into code, maintaining consistency, and contributing to the overall user experience of the product.</p><p>To understand more on design systems, I would highly recommend to check this site, it contains the whole sole knowledge of the design systems, why we should always considered design systems while crafting or architecting any application, it resolves the purpose of having the design systems while building application from small scale to enterprise level application or project.</p><h4>Link — <a href="https://atomicdesign.bradfrost.com/table-of-contents/">https://atomicdesign.bradfrost.com/table-of-contents/</a></h4><p>Please check out this one, it will be very helpful to understand the concept and start using it.</p><p>Thanks for your time, will be back with more interesting content.</p><p>“🌟 Embark on a journey of knowledge and creativity with me!</p><p>Join my circle to stay updated on insightful content that fuels inspiration. Let’s explore, learn, and write our stories together! 🚀✍️ #FollowForIdeas #CreateAndConnect”</p><h3>Thanks for reading</h3><ul><li>👏 Please clap for the story and follow me 👉</li><li>📰 <a href="https://medium.com/@vivekdogra02">View more content</a></li><li>🔔 Follow me: <a href="https://www.linkedin.com/in/vivek-dogra-7404a530/">LinkedIn </a>| <a href="https://twitter.com/VivekDo07905087">Twitter </a>| <a href="https://github.com/vivekdogra02">Github</a></li></ul><h3>In Plain English</h3><p><em>Thank you for being a part of our community! Before you go:</em></p><ul><li><em>Be sure to </em><strong><em>clap</em></strong><em> and </em><strong><em>follow</em></strong><em> the writer! 👏</em></li><li><em>You can find even more content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><strong><em> 🚀</em></strong></li><li><em>Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. 🗞️</em></li><li><em>Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a>, <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a>, and <a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><strong><em>.</em></strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b74ab5bc5479" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/atomic-design-unleashed-building-consistency-through-design-systems-b74ab5bc5479">Atomic Design Unleashed: Building Consistency Through Design Systems</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Future-Proof Your JavaScript Code]]></title>
            <link>https://javascript.plainenglish.io/future-proof-your-javascript-code-9471e9b3676f?source=rss-840a8f2c1a19------2</link>
            <guid isPermaLink="false">https://medium.com/p/9471e9b3676f</guid>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[javascript-tips]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Vivek Dogra]]></dc:creator>
            <pubDate>Tue, 30 May 2023 18:07:23 GMT</pubDate>
            <atom:updated>2023-05-31T04:39:52.334Z</atom:updated>
            <content:encoded><![CDATA[<h3>Future-Proof Your JavaScript Code: The Game-Changing Immutability Revolution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a2X20MBG5FswCc_5rOlNNQ.jpeg" /></figure><p>In this article, we will explore a set of new array methods that offer a fresh approach to achieving immutability.</p><p>The methods under discussion are with, toSorted, toReversed, and toSpliced.</p><p>Immutability ensures that the original array remains unchanged, and modifications are made on a new copy. While there were existing techniques for achieving immutability, such as utilizing the spread operator, these new array methods present more convenient alternatives.</p><p>These methods offer improved code readability and performance benefits, making them advantageous for developers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*op_Qx8-AxhGN6dUA4tPUHg.png" /></figure><ol><li><strong>with() Method</strong></li></ol><p>The with() method of <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a> instances is the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#copying_methods_and_mutating_methods">copying</a> version of using the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_accessors#bracket_notation">bracket notation</a> to change the value of a given index. It returns a new array with the element at the given index replaced with the given value.</p><p>array.with(index, value) — will return a new array with the element at index replaced with value.</p><pre>const arr = [1, 2, 3, 4, 5];<br>console.log(arr.with(2, 6)); // [1, 2, 6, 4, 5]<br>console.log(arr); // [1, 2, 3, 4, 5]</pre><p><strong>2. toSpliced()</strong></p><p>splice() — is method that will work on your original array, rather that on their copy.</p><p>For eg: — in below example, splice has replaced the start and end index with the new value i.e. ““mango””</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*2AnL-qmbdPRG1rvd3h7FLg.png" /></figure><p>what toSpliced() will do, it will not update the original array, rather than work on its copy and original array remains intact. It returns a new array instead of modifying the original array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*smEHKVMB8SQ0jxV3Gr2awQ.png" /></figure><p><strong>3. toSorted()</strong></p><p>Normally, we do sort by adding <strong>sort() </strong>after any array, and it will sort the original array, there is a change in original array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*4jrJQ_vwLzo4w2vBnAgYBQ.png" /></figure><p>To remain intact with original array, you need to introduced spread operator and create a separate copy of that like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*LYz9Tb9QyuNZrqt_3BsW2Q.png" /></figure><p>To remove this step, javascript has a new array method, there is no need to use the spread operator ie. toSorted()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*Liz66Yxyu3FdJ-w1dNGqUA.png" /></figure><p><strong>4. toReversed()</strong></p><p>This method is working same as <strong>array.reverse(),</strong> but rather than changing original array, it will create a new copy and original array remains intact.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*wXWsCUJj31vGJP2NmqZtFA.png" /></figure><p>Before using, any of these methods, please check their browser compatibility as many of them is not supported in Firefox, so make use if required. <a href="https://caniuse.com/?search=array.with">https://caniuse.com/?search=array.with</a></p><p>Also please make sure to check <a href="https://developer.mozilla.org/en-US/">MDN Website </a>to check for upcoming features in Javascript.</p><h3>Thanks for reading</h3><ul><li>👏 Please clap for the story and follow me 👉</li><li>📰 <a href="https://medium.com/@vivekdogra02">View more content</a></li><li>🔔 Follow me: <a href="https://www.linkedin.com/in/vivek-dogra-7404a530/">LinkedIn </a>| <a href="https://twitter.com/VivekDo07905087">Twitter </a>| <a href="https://github.com/vivekdogra02">Github</a></li></ul><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>.</em></p><p><em>Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>, </em><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><em>, and </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><strong><em>.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9471e9b3676f" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/future-proof-your-javascript-code-9471e9b3676f">Future-Proof Your JavaScript Code</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Angular —Adapter Pattern: Simplify Data Integration(Kanban Board)]]></title>
            <link>https://javascript.plainenglish.io/angular-adapter-pattern-simplify-data-integration-kanban-board-84f520313a3d?source=rss-840a8f2c1a19------2</link>
            <guid isPermaLink="false">https://medium.com/p/84f520313a3d</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Vivek Dogra]]></dc:creator>
            <pubDate>Fri, 19 May 2023 11:18:43 GMT</pubDate>
            <atom:updated>2023-05-21T04:53:21.113Z</atom:updated>
            <content:encoded><![CDATA[<h3>Simplifying Integration and Enhancing Flexibility</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FUgSi8RZKjq5rAGbKzATqw.jpeg" /></figure><h3>Introduction</h3><p>A common requirement in modern web development is the integration of data from multiple sources. However, working with various data formats and APIs can be complex, and code can be tightly coupled to specific data sources. To overcome this problem, the adapter pattern provides a solution by acting as a bridge between incompatible interfaces. In this article, we’ll showcase the adapter pattern, using the Kanban board as an example. Will also provide code examples and practical use cases to illustrate the benefits.</p><h3>Understanding the Adapter Pattern:</h3><p>The Adapter pattern is a structural design pattern that allows objects with incompatible interfaces to work together. It acts as an intermediary between two incompatible classes, translating requests from one to the other. This pattern provides a way to reuse existing code and promotes loose coupling between components.</p><p><strong>The main components of the Adapter pattern are:</strong></p><ul><li><strong>Target</strong>: The interface that the client interacts with.</li><li><strong>Adaptee</strong>: The existing interface that needs to be adapted.</li><li><strong>Adapter</strong>: The bridge between the Target and the Adaptee that implements the Target interface and internally uses the Adaptee to perform the desired operations.</li></ul><h3>Real world use cases:</h3><p>To better understand the practical use of the adapter pattern, let’s look at a real world scenario. Imagine building a project management application with Angular and deciding to implement a Kanban board to visualize tasks and progress.</p><p>Kanban boards integrate with various task management systems such as Jira, Trello, and Asana, each with its own API and data structure. Without the adapter pattern, you would have to write custom code for each task management system to tightly couple your application to these external services.</p><p>However, the adapter pattern allows you to create an adapter for each project task management system by abstracting the details of the underlying API and data structures. This allows you to switch between different task management systems without changing the core logic of your application.</p><h3>Implementing the Adapter Pattern in Angular:</h3><p>Now let’s dive into the implementation of the Adapter pattern in an Angular application. We’ll focus on integrating a Kanban board with two different task management systems: Jira and Trello.</p><ol><li><strong>Define the Kanban Board Component:</strong><br>First, let’s create the Kanban board component, which will be responsible for rendering the tasks and their corresponding status columns. Here’s a simplified example of the KanbanBoardComponent in Angular:</li></ol><pre>import { Component, OnInit } from &#39;@angular/core&#39;;<br>import { Task } from &#39;./task.interface&#39;;<br>import { TaskManagementAdapter } from &#39;./task-management-adapter&#39;;<br><br>@Component({<br>  selector: &#39;app-kanban-board&#39;,<br>  template: `<br>    &lt;div class=&quot;kanban-board&quot;&gt;<br>      &lt;div class=&quot;column&quot; *ngFor=&quot;let statusColumn of statusColumns&quot;&gt;<br>        &lt;h2&gt;{{ statusColumn }}&lt;/h2&gt;<br>        &lt;div class=&quot;task&quot; *ngFor=&quot;let task of getTasksByStatus(statusColumn)&quot;&gt;<br>          {{ task.title }}<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  `,<br>  styleUrls: [&#39;./kanban-board.component.css&#39;]<br>})<br>export class KanbanBoardComponent implements OnInit {<br>  statusColumns: string[] = [&#39;To Do&#39;, &#39;In Progress&#39;, &#39;Done&#39;];<br>  tasks: Task[] = [];<br>  taskManagementAdapter: TaskManagementAdapter;<br><br>  constructor(private adapter: TaskManagementAdapter) {<br>    this.taskManagementAdapter = adapter;<br>  }<br><br>  ngOnInit(): void {<br>    this.loadTasks();<br>  }<br><br>  loadTasks(): void {<br>    this.tasks = this.taskManagementAdapter.getTasks();<br>  }<br><br>  getTasksByStatus(status: string): Task[] {<br>    return this.tasks.filter(task =&gt; task.status === status);<br>  }<br>}</pre><p><strong>2. Create the Task Interface and Adapters:</strong><br>Next, let’s define the Task interface, which represents a task on the Kanban board. We’ll also create adapters for Jira and Trello, implementing the <strong>TaskManagementAdapter </strong>interface. Here’s an example:</p><pre>export interface Task {<br>  id: number;<br>  title: string;<br>  status<br><br>: string;<br>}<br><br>export interface TaskManagementAdapter {<br>  getTasks(): Task[];<br>}<br><br>export class JiraAdapter implements TaskManagementAdapter {<br>  getTasks(): Task[] {<br>    // Implement Jira-specific logic to fetch tasks<br>    // and map them to the Task interface<br>  }<br>}<br><br>export class TrelloAdapter implements TaskManagementAdapter {<br>  getTasks(): Task[] {<br>    // Implement Trello-specific logic to fetch tasks<br>    // and map them to the Task interface<br>  }<br>}</pre><p><strong>3. Implement the Adapters:</strong><br>Now, it’s time to implement the <strong>JiraAdapter</strong> and <strong>TrelloAdapter</strong>. These adapters encapsulate the logic of interacting with the respective task management systems’ APIs and converting the data into the Task interface format. Here’s a simplified example:</p><pre>export class JiraAdapter implements TaskManagementAdapter {<br>  getTasks(): Task[] {<br>    // Use Jira API to fetch tasks<br>    // Convert and map the fetched data to the Task interface format<br>    return jiraAPI.getTasks().map(task =&gt; ({<br>      id: task.id,<br>      title: task.name,<br>      status: task.status<br>    }));<br>  }<br>}<br><br>export class TrelloAdapter implements TaskManagementAdapter {<br>  getTasks(): Task[] {<br>    // Use Trello API to fetch tasks<br>    // Convert and map the fetched data to the Task interface format<br>    return trelloAPI.getTasks().map(task =&gt; ({<br>      id: task.id,<br>      title: task.title,<br>      status: task.status<br>    }));<br>  }<br>}</pre><p><strong>4. Wiring Everything Together:</strong><br>Finally, we need to provide the appropriate adapter to the KanbanBoardComponent. In your Angular module, you can configure the dependency injection to provide the desired adapter. Here’s an example using the JiraAdapter:</p><pre>// app.module.ts<br>import { NgModule } from &#39;@angular/core&#39;;<br>import { BrowserModule } from &#39;@angular/platform-browser&#39;;<br><br>import { AppComponent } from &#39;./app.component&#39;;<br>import { KanbanBoardComponent } from &#39;./kanban-board/kanban-board.component&#39;;<br>import { TaskManagementSystemAdapter } from &#39;./adapters/task-management-system.adapter&#39;;<br>import { JiraAdapter } from &#39;./adapters/jira.adapter&#39;;<br>import { TrelloAdapter } from &#39;./adapters/trello.adapter&#39;;<br><br>@NgModule({<br>  declarations: [<br>    AppComponent,<br>    KanbanBoardComponent<br>  ],<br>  imports: [<br>    BrowserModule<br>  ],<br>  providers: [<br>    { provide: TaskManagementSystemAdapter, useClass: JiraAdapter }, // Using JiraAdapter<br>    { provide: TaskManagementSystemAdapter, useClass: TrelloAdapter } // Using TrelloAdapter<br>  ],<br>  bootstrap: [AppComponent]<br>})<br>export class AppModule { }</pre><p><strong>Explanation</strong></p><p>In the above code, both the <strong>JiraAdapter </strong>and the <strong>TrelloAdapter </strong>are provided as implementations for the <strong>TaskManagementSystemAdapter </strong>token. By doing this, Angular’s dependency injection will be able to inject the appropriate adapter based on the context.</p><p>Now, when the <strong>KanbanBoardComponent </strong>is instantiated, Angular will inject both the <strong>JiraAdapter </strong>and the <strong>TrelloAdapter </strong>as separate instances of the <strong>TaskManagementSystemAdapter</strong>. You can then use these adapters based on your specific requirements within the <strong>KanbanBoardComponent</strong>.</p><p>This approach allows you to integrate and work with multiple task management systems simultaneously within your K<strong>anban board application</strong>. You can handle different tasks and operations with each <strong>adapter</strong>, providing a comprehensive solution that caters to diverse needs.</p><pre>// kanban-board.component.ts<br>import { Component, OnInit } from &#39;@angular/core&#39;;<br>import { TaskManagementSystemAdapter } from &#39;../adapters/task-management-system.adapter&#39;;<br><br>@Component({<br>  selector: &#39;app-kanban-board&#39;,<br>  templateUrl: &#39;./kanban-board.component.html&#39;,<br>  styleUrls: [&#39;./kanban-board.component.css&#39;]<br>})<br>export class KanbanBoardComponent implements OnInit {<br>  tasks: string[] = [];<br><br>  constructor(<br>    private jiraAdapter: TaskManagementSystemAdapter,<br>    private trelloAdapter: TaskManagementSystemAdapter<br>  ) {}<br><br>  ngOnInit() {<br>    this.loadTasks();<br>  }<br><br>  loadTasks() {<br>    // Use the JiraAdapter to fetch tasks from Jira<br>    const jiraTasks = this.jiraAdapter.getTasks();<br>    this.tasks.push(...jiraTasks);<br><br>    // Use the TrelloAdapter to fetch tasks from Trello<br>    const trelloTasks = this.trelloAdapter.getTasks();<br>    this.tasks.push(...trelloTasks);<br>  }<br><br>  addTask(task: string) {<br>    // Use the JiraAdapter to create a new task in Jira<br>    this.jiraAdapter.createTask(task);<br><br>    // Use the TrelloAdapter to create a new task in Trello<br>    this.trelloAdapter.createTask(task);<br>  }<br><br>  removeTask(index: number) {<br>    this.tasks.splice(index, 1);<br>  }<br>}</pre><p><strong>Explanation</strong></p><p>In the above code, the <strong>KanbanBoardComponent </strong>has two dependencies injected: <strong>jiraAdapter </strong>of type <strong>TaskManagementSystemAdapter </strong>and <strong>trelloAdapter </strong>of type <strong>TaskManagementSystemAdapter</strong>. These dependencies are provided by the <strong>AppModule</strong>, where we configured the dependency injection to use both the <strong>JiraAdapter</strong> and the <strong>TrelloAdapter</strong>.</p><p>The <strong>addTask </strong>method allows you to create a new task. Using the <strong>jiraAdapter </strong>and <strong>trelloAdapter</strong>, we can call the <strong>createTask </strong>method on each adapter to <strong>create the task in both Jira and Trello simultaneously.</strong></p><p>The <strong>removeTask </strong>method removes a task from the tasks array when it is completed or deleted, as per your implementation.</p><blockquote><strong>By using both adapters in the KanbanBoardComponent</strong>, you can seamlessly integrate and work with multiple task management systems, such as Jira and Trello, within the same Kanban board application. This provides the flexibility to manage tasks across different platforms without writing separate code for each system.</blockquote><p>Furthermore, the Adapter pattern promotes a modular and extensible architecture. We can extend our application to support additional task management systems simply by creating new adapters that adhere to the TaskManagementAdapter interface. This flexibility is especially beneficial in scenarios where we may need to integrate multiple external systems or switch between different providers over time.</p><h3>Conclusion</h3><p>By applying the <strong>Adapter pattern in our Angular application</strong>, we have successfully decoupled the <strong>Kanban board component</strong> from s<strong>pecific task management systems</strong>. The adapters act as intermediaries, enabling seamless integration with different APIs and data structures. This approach promotes code reusability, flexibility, and maintainability.</p><p><strong>The Adapter pattern </strong>is a powerful tool in Angular development when dealing with disparate data sources. Whether you’re integrating with external APIs, databases, or other systems, the Adapter pattern provides an elegant solution to manage the complexities of data integration.</p><p>Start incorporating this pattern into your angular projects and experience the benefits firsthand. Happy coding!</p><h3>Thanks for reading</h3><ul><li>👏 Please clap for the story and follow me 👉</li><li>📰 <a href="https://medium.com/@vivekdogra02">View more content</a></li><li>🔔 Follow me: <a href="https://www.linkedin.com/in/vivek-dogra-7404a530/">LinkedIn </a>| <a href="https://twitter.com/VivekDo07905087">Twitter </a>| <a href="https://github.com/vivekdogra02">Github</a></li></ul><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>.</em></p><p><em>Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>, </em><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><em>, and </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><strong><em>.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84f520313a3d" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/angular-adapter-pattern-simplify-data-integration-kanban-board-84f520313a3d">Angular —Adapter Pattern: Simplify Data Integration(Kanban Board)</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[14 Tips for Enhancing Angular Performance]]></title>
            <link>https://javascript.plainenglish.io/14-tips-for-enhancing-angular-performance-6140747731af?source=rss-840a8f2c1a19------2</link>
            <guid isPermaLink="false">https://medium.com/p/6140747731af</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Vivek Dogra]]></dc:creator>
            <pubDate>Fri, 19 May 2023 06:41:55 GMT</pubDate>
            <atom:updated>2023-05-21T04:52:02.782Z</atom:updated>
            <content:encoded><![CDATA[<h4>Practical Techniques to Boost Angular Application Performance</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8j4H_U1U4Jkx32GIVBqBUA.jpeg" /></figure><p><strong>Introduction:<br></strong>Angular is a powerful framework for building <strong>powerful</strong> web applications, and <strong>optimization</strong> is <strong>key</strong> <strong>to</strong> <strong>providing</strong> a <strong>great</strong> user experience. In this <strong>post,</strong> <strong>we’ll</strong> <strong>go</strong> <strong>over</strong> some practical tips to <strong>improve</strong> Angular performance. Each tip is accompanied by code examples to illustrate the implementation.</p><ol><li><strong>Lazy Loading Modules:<br></strong>Lazy loading helps reduce the initial load time by loading modules on-demand. Use the `<strong>loadChildren</strong>` property in the route configuration to specify which modules should be lazily loaded.</li></ol><pre>const routes: Routes = [<br> { path: &#39;lazy&#39;, loadChildren: () =&gt; import(&#39;./lazy/lazy.module&#39;).then(m =&gt; m.LazyModule) },<br>];</pre><p><strong>2. Ahead-of-Time (AOT) Compilation:</strong><br>Enable AOT compilation to generate optimized and smaller bundles. AOT compilation reduces the bundle size and improves the application’s startup time.</p><p><strong>3. Change Detection Strategy:</strong><br>Optimize change detection by using `OnPush` strategy for components that don’t require frequent updates. This strategy reduces unnecessary checks and improves overall performance.</p><pre>@Component({<br> selector: &#39;app-example&#39;,<br> templateUrl: &#39;./example.component.html&#39;,<br> changeDetection: ChangeDetectionStrategy.OnPush,<br>})<br>export class ExampleComponent { }</pre><p><strong>4. TrackBy Function in ngFor:</strong><br>When using `ngFor` directive, provide a `trackBy` function to track item changes efficiently. This reduces the re-rendering of elements that haven’t changed.</p><pre>&lt;ul&gt;<br> &lt;li *ngFor=&quot;let item of items; trackBy: trackByFn&quot;&gt;{{ item }}&lt;/li&gt;<br>&lt;/ul&gt;<br><br>Typescript<br><br>trackByFn(index: number, item: any): any {<br> return item.id; // Replace with a unique identifier for each item<br>}</pre><p><strong>5. Unsubscribe when not in use:</strong><br>Manually unsubscribe from subscriptions to prevent memory leaks. Use `<strong>takeUntil</strong>` operator and a subject to manage subscriptions and unsubscribe when the component is destroyed.</p><pre>private destroy$ = new Subject();<br>ngOnInit(): void {<br> someObservable$<br> .pipe(takeUntil(this.destroy$))<br> .subscribe((data) =&gt; {<br> // Handle the data<br> });<br>}<br>ngOnDestroy(): void {<br> this.destroy$.next();<br> this.destroy$.complete();<br>}</pre><p><strong>6. ChangeDetectionRef.markForCheck():</strong><br>Use `<strong>markForCheck</strong>()` method from `<strong>ChangeDetectionRef</strong>` to selectively trigger change detection only when necessary. This can improve performance in specific scenarios.</p><pre>constructor(private cdr: ChangeDetectorRef) { }<br>updateData(): void {<br> // Update data here<br> this.cdr.markForCheck();<br>}</pre><p><strong>7. NgZone Optimization:</strong><br>Leverage the `NgZone` service to optimize the execution of code that doesn’t require Angular’s change detection. Use the `<strong>runOutsideAngular</strong>` method to execute code outside Angular’s zone.</p><pre>constructor(private ngZone: NgZone) { }<br>performHeavyTask(): void {<br> this.ngZone.runOutsideAngular(() =&gt; {<br> // Perform heavy task here<br> });<br>}</pre><p><strong>8. Avoid Excessive DOM Manipulation:</strong><br>Minimize direct DOM manipulation and use Angular’s data binding and directives instead. Excessive DOM manipulation can impact performance negatively.</p><p><strong>9. Use Angular Pipes Wisely:</strong></p><p>Angular pipes can impact performance if used improperly. While pipes offer great flexibility and convenience, it’s important to use them judiciously to ensure optimal performance.</p><p>Angular provides two types of pipes: pure and impure. Pure pipes are memoized, meaning they only recalculate when the input value changes. This reduces unnecessary computations and improves performance. Always strive to use pure pipes whenever possible.</p><blockquote>Avoid performing heavy computations within pipes, especially if the computation is not necessary for every change detection cycle. Complex calculations can introduce performance bottlenecks, so consider moving such computations to the component class or leveraging caching techniques to optimize performance.</blockquote><pre>@Pipe({<br>  name: &#39;instantPipe&#39;,<br>  pure: true<br>})<br>export class InstantPipe implements PipeTransform {<br>  transform(value: any): any {<br>    // Transformation logic here<br>  }<br>}</pre><p><strong>10. Debounce Input Events:</strong><br>Use the `debounceTime` operator to reduce the frequency of input event handling. This prevents excessive updates and reduces unnecessary processing.</p><pre>searchInput.valueChanges<br> .pipe(debounceTime(300))<br> .subscribe((value) =&gt; {<br> // Handle the search value<br> });</pre><p><strong>11. Optimize HTTP Requests:</strong></p><p>Reduce the number of HTTP requests by combining multiple requests or using caching strategies. Leverage features like HTTP interceptors to handle common functionality across requests.</p><p>Example:</p><pre>// Combine multiple HTTP requests<br>forkJoin([http.get(&#39;data1&#39;), http.get(&#39;data2&#39;)]).subscribe(([data1, data2]) =&gt; {<br>  // Handle the responses<br>});<br><br>// Implement caching using an interceptor<br>@Injectable()<br>export class CachingInterceptor implements HttpInterceptor {<br>  // ...<br>}</pre><p><strong>12. Use Angular Reactive Forms:</strong></p><p>Reactive Forms offer better performance than template-driven forms, especially when dealing with complex form scenarios. They provide more control and allow for fine-grained validation and data handling.</p><pre>import { FormGroup, FormControl, Validators } from &#39;@angular/forms&#39;;<br><br>const form = new FormGroup({<br>  name: new FormControl(&#39;&#39;, Validators.required),<br>  // ...<br>});</pre><p><strong>13. Angular Universal for Server-Side Rendering (SSR):</strong></p><p>Implement <strong>Angular Universal</strong> for server-side rendering. SSR improves initial load times, enables search engine optimization, and provides a better user experience, especially for low-bandwidth or high-latency environments.</p><p><strong>14. Use Angular Performance Tools:</strong></p><p>Angular offers various performance tools, such as Angular <strong>DevTools </strong>and <strong>Augury</strong>, which provide insights into performance bottlenecks and help identify areas for optimization.</p><p><strong>Conclusion</strong>:<br>By implementing these performance optimization tips, you can significantly enhance the speed and responsiveness of your Angular applications. Remember to analyze and profile your application to identify specific areas for improvement and measure the impact of these optimizations. Building performant Angular applications not only improves the user experience but also ensures scalability and efficiency.</p><p>Start incorporating these into your angular projects and experience the benefits firsthand. Happy coding!</p><h3>Thanks for reading</h3><ul><li>👏 Please clap for the story and follow me 👉</li><li>📰 <a href="https://medium.com/@vivekdogra02">View more content</a></li><li>🔔 Follow me: <a href="https://www.linkedin.com/in/vivek-dogra-7404a530/">LinkedIn </a>| <a href="https://twitter.com/VivekDo07905087">Twitter </a>| <a href="https://github.com/vivekdogra02">Github</a></li></ul><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>.</em></p><p><em>Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>, </em><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><em>, and </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><strong><em>.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6140747731af" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/14-tips-for-enhancing-angular-performance-6140747731af">14 Tips for Enhancing Angular Performance</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React: Abstract Design Pattern-DRY & Single Shared Responsibility]]></title>
            <link>https://javascript.plainenglish.io/react-abstract-design-pattern-dry-single-shared-responsibility-9fbef42a6e56?source=rss-840a8f2c1a19------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fbef42a6e56</guid>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Vivek Dogra]]></dc:creator>
            <pubDate>Sun, 14 May 2023 05:54:34 GMT</pubDate>
            <atom:updated>2023-05-14T23:51:41.683Z</atom:updated>
            <content:encoded><![CDATA[<h3>React: Abstract Design Pattern-DRY &amp; Single Shared Responsibility(Part-2)</h3><h4>Understanding the Abstract Method pattern in React and exploring how it can be implemented in your applications.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KGprQ-67EafNQzDbPEEnjw.jpeg" /></figure><p>This is in continuation with the last article on<strong> React — Abstract Design pattern</strong>. This article is basically on the potential areas where performance issues could arise.<a href="https://vivekdogra02.medium.com/react-abstract-design-pattern-dry-single-shared-responsibility-part-1-c63dfac5eb8c"> Link to last article</a></p><h4>In continuation with the last post code, there are a few potential areas where performance issues could arise,</h4><ol><li><strong>Rendering large datasets</strong>: If the <strong>transactions </strong>array contains a large number of items, rendering them all at once can impact performance. To mitigate this, consider implementing pagination or virtualization techniques to load and render only the visible portion of the dataset.</li><li><strong>Dynamic function creation</strong>: The <strong>getFormatAmount </strong>function dynamically creates the <strong>formatAmount </strong>function based on the transaction type. While this approach provides flexibility, it can impact performance if the function creation process becomes complex or computationally expensive. Ensure that the function creation logic remains simple and efficient to avoid any performance bottlenecks.</li><li><strong>Complex transaction processing</strong>: If the processing or manipulation of transaction data within the <strong>TransactionItem </strong>component becomes computationally intensive, it may lead to performance issues. Analyze the operations performed on each transaction and optimize them as necessary. Consider leveraging memoization or caching techniques to avoid unnecessary calculations or redundant operations.</li><li><strong>Inefficient rendering updates:</strong> If there are frequent updates to the <strong>transactions </strong>array or individual transactions, it can trigger unnecessary re-renders. To optimize this, ensure that the <strong>transactions </strong>array and its items are immutably updated to prevent unintended re-renders. Additionally, consider implementing more granular component updates using React&#39;s <strong>shouldComponentUpdate </strong>or <strong>React.memo</strong> to prevent unnecessary rendering of components that have not changed.</li></ol><p>It’s important to profile and analyze the performance of your application using tools like<strong> React DevTools, Chrome DevTools, or other performance monitoring tools</strong>. By identifying and addressing specific performance bottlenecks, you can optimize the code and improve the overall performance of your financial app.</p><h4>To avoid potential performance issues in the provided code, here are some suggestions:</h4><ol><li><strong>Implement pagination or virtualization:</strong> If the <strong>transactions </strong>array contains a large number of items, consider implementing pagination or virtualization techniques. Instead of rendering all transactions at once, load and render only a subset of transactions based on the current viewport or user interaction. This approach improves initial load time and reduces rendering overhead.</li><li><strong>Optimize the dynamic function creation</strong>: The <strong>getFormatAmount </strong>function dynamically creates the <strong>formatAmount </strong>function based on the transaction type. To optimize performance, ensure that the function creation logic remains lightweight and efficient. Avoid complex computations or heavy operations within the function creation process. If possible, precompute or memoize the format functions to avoid repetitive calculations.</li><li><strong>Streamline transaction processing: </strong>Analyze the operations performed on each transaction within the <strong>TransactionItem </strong>component. Look for opportunities to optimize data processing and manipulation. Use efficient algorithms and data structures to minimize computational overhead. Consider memoization techniques to cache expensive calculations or avoid redundant operations.</li><li><strong>Use immutability and granular updates</strong>: Ensure that the <strong>transactions </strong>array and its items are updated in an immutable manner. Avoid mutating the original array directly, as it can lead to unnecessary re-renders. Instead, create new arrays or objects when making updates. Additionally, utilize React&#39;s <strong>shouldComponentUpdate </strong>lifecycle method or the <strong>React.memo</strong> higher-order component to prevent unnecessary re-renders of components that have not changed.</li><li><strong>Profile and optimize</strong>: Utilize <strong>performance profiling tools</strong> such as React DevTools or Chrome DevTools to identify performance bottlenecks. Measure the rendering times, identify components with excessive re-renders, and analyze the performance of critical code sections. Optimize the identified areas by refactoring, simplifying computations, or implementing caching strategies.</li></ol><p>By implementing these suggestions, you can improve the performance of your application, ensuring efficient rendering and minimizing unnecessary computations.<strong> Regular performance testing and profiling </strong>will help you identify specific areas for optimization and ensure your financial app performs optimally.</p><p><strong>Here’s an updated version of the code with optimizations to address the performance concerns:</strong></p><pre>import React, { useMemo } from &#39;react&#39;;<br>const FinancialApp = ({ transactions }) =&gt; {<br>  // Pagination or virtualization logic here<br>  const getFormatAmount = useMemo(() =&gt; {<br>    const formatAmount = (amount) =&gt; `$${amount}`;<br>    return (type) =&gt; {<br>      switch (type) {<br>        case &#39;expense&#39;:<br>          return (amount) =&gt; `- $${amount}`;<br>        case &#39;income&#39;:<br>          return (amount) =&gt; `+ $${amount}`;<br>        case &#39;transfer&#39;:<br>          return (amount) =&gt; `$${amount}`;<br>        default:<br>          return formatAmount;<br>      }<br>    };<br>  }, []);<br>  return (<br>    &lt;div&gt;<br>      {/* Rendering logic with pagination or virtualization */}<br>      {visibleTransactions.map((transaction, index) =&gt; (<br>        &lt;div key={transaction.id}&gt;<br>          &lt;TransactionItem transaction={transaction} formatAmount={getFormatAmount(transaction.type)} /&gt;<br>        &lt;/div&gt;<br>      ))}<br>    &lt;/div&gt;<br>  );<br>};<br>const TransactionItem = ({ transaction, formatAmount }) =&gt; {<br>  // Transaction item rendering logic here<br>  return (<br>    &lt;div&gt;<br>      &lt;span&gt;{transaction.description}&lt;/span&gt;<br>      &lt;span&gt;{formatAmount(transaction.amount)}&lt;/span&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><p><strong>In the updated code:</strong></p><ol><li>The <strong>getFormatAmount </strong>function is <strong>memoized </strong>using the <strong>useMemo </strong>hook. This ensures that the function is only created once and doesn&#39;t get re-computed on subsequent renders unless the dependencies change. It improves performance by avoiding unnecessary function re-creation.</li><li><strong>The rendering logic includes placeholders for pagination or virtualization techniques. </strong>Based on your specific requirements, you can implement the necessary logic to render a subset of transactions based on the current viewport or user interactions. This approach improves performance by reducing the number of rendered items.</li><li>The <strong>TransactionItem </strong>component receives the <strong>formatAmount </strong>function as a prop. This allows the component to access the appropriate format function without dynamically creating it on each render. It reduces redundancy and optimizes rendering by avoiding unnecessary function calls.</li></ol><p>Remember to adapt the code to your specific needs, including the implementation of <strong>pagination or virtualization</strong> logic. These optimizations provide a starting point for improving performance, but the exact implementation will depend on your application’s requirements and complexity.</p><h3>Here are some additional customization options for the Pagination component, each with its own code example:</h3><ol><li><strong>Custom Styling:</strong></li></ol><pre>const Pagination = ({ currentPage, totalPages, onPageChange }) =&gt; {<br>  const pages = [...Array(totalPages).keys()].map((page) =&gt; page + 1);<br><br>  return (<br>    &lt;div className=&quot;pagination-container&quot;&gt;<br>      {pages.map((page) =&gt; (<br>        &lt;button<br>          key={page}<br>          onClick={() =&gt; onPageChange(page)}<br>          className={currentPage === page ? &#39;active&#39; : &#39;&#39;}<br>        &gt;<br>          {page}<br>        &lt;/button&gt;<br>      ))}<br>    &lt;/div&gt;<br>  );<br>};</pre><p>In this example, we add a custom CSS class &#39;pagination-container&#39; to the parent div element. You can then define the styling for the pagination component using CSS to match your desired look and feel.</p><p><strong>2. Previous and Next Buttons:</strong></p><pre>const Pagination = ({ currentPage, totalPages, onPageChange }) =&gt; {<br>  const pages = [...Array(totalPages).keys()].map((page) =&gt; page + 1);<br><br>  return (<br>    &lt;div&gt;<br>      &lt;button onClick={() =&gt; onPageChange(currentPage - 1)} disabled={currentPage === 1}&gt;<br>        Previous<br>      &lt;/button&gt;<br><br>      {pages.map((page) =&gt; (<br>        &lt;button<br>          key={page}<br>          onClick={() =&gt; onPageChange(page)}<br>          className={currentPage === page ? &#39;active&#39; : &#39;&#39;}<br>        &gt;<br>          {page}<br>        &lt;/button&gt;<br>      ))}<br><br>      &lt;button onClick={() =&gt; onPageChange(currentPage + 1)} disabled={currentPage === totalPages}&gt;<br>        Next<br>      &lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><p>In this example, we add previous and next buttons to allow the user to navigate to the previous and next pages, respectively. The buttons are disabled when the user is on the first or last page to prevent unnecessary navigation.</p><p><strong>3. Compact View:</strong></p><pre>const Pagination = ({ currentPage, totalPages, onPageChange }) =&gt; {<br>  const pages = [...Array(totalPages).keys()].map((page) =&gt; page + 1);<br><br>  return (<br>    &lt;div&gt;<br>      {pages.map((page) =&gt; (<br>        &lt;button<br>          key={page}<br>          onClick={() =&gt; onPageChange(page)}<br>          className={currentPage === page ? &#39;active&#39; : &#39;&#39;}<br>        &gt;<br>          {page}<br>        &lt;/button&gt;<br>      ))}<br><br>      &lt;span&gt;Page {currentPage} of {totalPages}&lt;/span&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><p>In this example, we remove the previous and next buttons and instead display the current page number and total number of pages. This provides a more compact view of the pagination component.</p><p><strong>4. Custom Labels:</strong></p><pre>const Pagination = ({ currentPage, totalPages, onPageChange }) =&gt; {<br>  const pages = [...Array(totalPages).keys()].map((page) =&gt; page + 1);<br><br>  return (<br>    &lt;div&gt;<br>      {pages.map((page) =&gt; (<br>        &lt;button<br>          key={page}<br>          onClick={() =&gt; onPageChange(page)}<br>          className={currentPage === page ? &#39;active&#39; : &#39;&#39;}<br>        &gt;<br>          {page}<br>        &lt;/button&gt;<br>      ))}<br><br>      &lt;button onClick={() =&gt; onPageChange(currentPage + 1)} disabled={currentPage === totalPages}&gt;<br>        Next Page<br>      &lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><p>In this example, we customize the label of the next button to display “Next Page” instead of just “Next”. This provides a more descriptive and user-friendly label for navigation.</p><p><strong>5. Page Size Selection:</strong></p><pre>const Pagination = ({ currentPage, totalPages, onPageChange, pageSizeOptions, pageSize, onPageSizeChange }) =&gt; {<br>  const pages = [...Array(totalPages).keys()].map((page) =&gt; page + 1);<br><br>  return (<br>    &lt;div&gt;<br>      {pages.map((page) =&gt; (<br>        &lt;button<br>          key={page}<br>          onClick={() =&gt; onPageChange(page)}<br>          className={currentPage === page ? &#39;active&#39; : &#39;&#39;}<br>        &gt;<br>          {page}<br>        &lt;/button&gt;<br>      ))}<br><br>      &lt;select value={pageSize} onChange={(e) =&gt; onPageSizeChange(e.target.value)}&gt;<br>        {pageSizeOptions.map((option) =&gt; (<br>          &lt;option key={option} value={option}&gt;<br>            {option}<br>          &lt;/option&gt;<br>        ))}<br>      &lt;/select&gt;<br>    &lt;/div&gt;<br>  );<br>};</pre><p>In this example, we introduce a page size selection feature. It includes a dropdown select element where the user can choose the number of items to display per page. The pageSizeOptions array contains the available page size options, and the pageSize state represents the currently selected page size. The onPageSizeChange function is called when the user selects a new page size.</p><p><strong>6. Custom Page Range:</strong></p><pre>const Pagination = ({ currentPage, totalPages, onPageChange, pageRange }) =&gt; {<br>  const startPage = currentPage - Math.floor(pageRange / 2);<br>  const endPage = currentPage + Math.floor(pageRange / 2);<br>  const pages = [...Array(totalPages).keys()].map((page) =&gt; page + 1).slice(startPage, endPage + 1);<br><br>  return (<br>    &lt;div&gt;<br>      {pages.map((page) =&gt; (<br>        &lt;button<br>          key={page}<br>          onClick={() =&gt; onPageChange(page)}<br>          className={currentPage === page ? &#39;active&#39; : &#39;&#39;}<br>        &gt;<br>          {page}<br>        &lt;/button&gt;<br>      ))}<br>    &lt;/div&gt;<br>  );<br>};</pre><p>In this example, we introduce a custom page range feature. The pageRange represents the number of consecutive page buttons to display around the current page. The startPage and endPage variables calculate the range of pages to be shown based on the current page and the page range. The pages array is then sliced to obtain the desired range of page numbers.</p><p>Feel free to mix and match these customization options or come up with your own variations based on your application’s specific needs. The goal is to tailor the Pagination component to fit your desired functionality and design.</p><p><strong>By leveraging the abstract method pattern in React, </strong>we can build a robust and modular financial app that effectively manages various types of transactions and ensures clean, reusable code.</p><h3>Conclusion:</h3><p>By implementing the Abstract Method pattern in React using a functional approach, we can achieve code reuse, remove redundancy, and avoid code smells. The abstract component provides a common structure and behavior, while child components extend it to define specific rendering and logic. This approach promotes a cleaner and more maintainable codebase, making it easier to scale and modify our applications.</p><p>Remember, the Abstract Method pattern is just one of many patterns that can be leveraged in React development. It’s important to evaluate its suitability based on the specific needs and complexity of your application. By applying design patterns thoughtfully, we can enhance code quality and build.</p><p><strong>I Hope you liked it, By leveraging this pattern,</strong> you can build applications that are easier to manage and evolve over time. Understanding and applying design patterns in React empowers developers to write clean, efficient, and robust code.</p><p>Start incorporating the Abstract Design pattern into your React projects and experience the benefits firsthand. Happy coding!</p><h3>Thanks for reading</h3><ul><li>👏 Please clap for the story and follow me 👉</li><li>📰 <a href="https://medium.com/@vivekdogra02">View more content</a></li><li>🔔 Follow me: <a href="https://www.linkedin.com/in/vivek-dogra-7404a530/">LinkedIn </a>| <a href="https://twitter.com/VivekDo07905087">Twitter </a>| <a href="https://github.com/vivekdogra02">Github</a></li></ul><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>.</em></p><p><em>Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>, </em><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><em>, and </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><strong><em>.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fbef42a6e56" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/react-abstract-design-pattern-dry-single-shared-responsibility-9fbef42a6e56">React: Abstract Design Pattern-DRY &amp; Single Shared Responsibility</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>