<?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 Ghayda Rafa on Medium]]></title>
        <description><![CDATA[Stories by Ghayda Rafa on Medium]]></description>
        <link>https://medium.com/@ghaydarafa?source=rss-4d7e30798be6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*p2HuDx9d43EtulTx</url>
            <title>Stories by Ghayda Rafa on Medium</title>
            <link>https://medium.com/@ghaydarafa?source=rss-4d7e30798be6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 01:40:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ghaydarafa/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[From Idea to User Validation: Our Journey Building a Tracer Study App]]></title>
            <link>https://medium.com/@ghaydarafa/from-idea-to-user-validation-our-journey-building-a-tracer-study-app-5ef01f6285f7?source=rss-4d7e30798be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ef01f6285f7</guid>
            <dc:creator><![CDATA[Ghayda Rafa]]></dc:creator>
            <pubDate>Fri, 24 May 2024 13:33:53 GMT</pubDate>
            <atom:updated>2024-05-24T15:08:01.062Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KjA5-cY4_6FI9RkJ" /><figcaption>Photo by <a href="https://unsplash.com/@headwayio?utm_source=medium&amp;utm_medium=referral">Headway</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Developing a new product is a journey filled with excitement and uncertainty. As a student team tasked with creating a Tracer Study app for an external institution, we faced a unique challenge: validating our product idea without access to traditional market research methods. We embraced a collaborative approach centered on direct consultation with key stakeholders within the external institution. This article shares our experience, highlighting the steps we took, the lessons we learned, and the importance of stakeholder collaboration in product validation.</p><h3>The Challenge: Validating a Product for an External Audience</h3><p>Unlike internal projects where access to stakeholders might be more readily available, we had to bridge the gap between our academic environment and the external institution’s needs. We needed to validate our Tracer Study app idea without formal market analysis or direct access to the end-users (alumni and head of study program).</p><h4>Our Solution: Direct Stakeholder Consultation</h4><p>We recognized that successful validation lay in communicate with stakeholders within the external institution. We identified individuals directly involved in using and benefiting from the app, including administrators, career services personnel, and potentially alumni representatives. We reached out, scheduling meetings, and interviews to gather their valuable insights.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/630/1*EylLdrzXYT37-6lyyi4D_g.png" /></figure><h4>The Consultation Process</h4><p>Our consultation process involved several key steps:</p><ol><li><strong>Building Rapport</strong>: We focused on building rapport with our stakeholders, demonstrating our commitment to understanding their specific needs and challenges. We actively listened to their concerns, asked thoughtful questions, and showed a genuine interest in their feedback.</li><li><strong>Requirement Gathering</strong>: We engaged in in-depth discussions to uncover the institution’s specific goals for a Tracer Study app. This involved exploring their data collection needs, desired features, and how they envisioned the app enhancing alumni engagement and career services.</li><li><strong>Iterative Feedback</strong>: We presented prototypes and mockups of the app, incorporating feedback from the consultation. This iterative approach is to refine our design and ensure the app aligned with stakeholder expectations.</li><li><strong>Ongoing Communication</strong>: We try to maintained open lines of communication throughout the project, providing regular updates and addressing any concerns. This collaborative approach fostered a sense of partnership and ensured that our app remained relevant to the institution’s evolving needs.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*WTogQYNRjvi7JUu2gb21Cw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*uerNiML18e9y62Qfg8dT3g.png" /></figure><p>In addition to stakeholder consultation, we adopted agile development methodologies, specifically utilizing sprint planning and sprint review sessions. These sessions involved our team, along with our lecturer and teaching assistant, who provided guidance and expertise.</p><p><strong>Sprint Planning:</strong> We collaboratively defined the goals and tasks for each development cycle (sprint), ensuring everyone was aligned on priorities and deadlines.</p><p><strong>Sprint Review:</strong> At the end of each sprint, we demonstrated our progress to stakeholders, gathering feedback and making necessary adjustments to the app’s features and functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*e8MZcyWHvODKU3woyG6pfg.png" /><figcaption>Sprint Review preparation with lecturer</figcaption></figure><h3>Key Takeaways</h3><p>Our approach yielded several invaluable lessons:</p><ul><li><strong>Stakeholder Collaboration is Key:</strong> Building strong relationships with both internal (lecturers, teaching assistants) and external stakeholders is essential for effective product validation.</li><li><strong>Agile Development Provides Structure:</strong> Incorporating sprint planning and review sessions helped us maintain focus, adapt to feedback, and deliver incremental value.</li><li><strong>Focus on User-Centric Design: </strong>By prioritizing the needs and expectations of end-users, we ensured that our app would be both useful and engaging.</li><li><strong>Open Communication is Paramount:</strong> Transparent communication with all parties involved fostered trust, collaboration, and ultimately, a successful product outcome.</li></ul><p>Through our comprehensive approach, we successfully validated our Tracer Study app idea. We had a well-defined product roadmap, a prototype refined through iterative feedback, and strong support from stakeholders. Our collaboration with lecturers and the teaching assistant throughout the agile development process ensured that the app met academic standards and industry best practices.</p><p><strong>Conclusion</strong></p><p>Building a product for an external institution presents unique challenges, but our experience demonstrates that success is achievable through a combination of stakeholder collaboration, agile development, and a user-centric focus. We are confident that our Tracer Study app, once fully developed, will make a positive impact on the institution’s alumni engagement and career services efforts.</p><p><strong>Source</strong></p><ul><li><a href="https://rubygarage.org/blog/product-validation-guide">https://rubygarage.org/blog/product-validation-guide</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ef01f6285f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking Design Consistency with Chakra UI]]></title>
            <link>https://medium.com/@ghaydarafa/unlocking-design-consistency-with-chakra-ui-7e99ffdf3b87?source=rss-4d7e30798be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e99ffdf3b87</guid>
            <dc:creator><![CDATA[Ghayda Rafa]]></dc:creator>
            <pubDate>Fri, 24 May 2024 04:16:42 GMT</pubDate>
            <atom:updated>2024-05-24T04:19:11.088Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of web development, maintaining a consistent user experience across different applications or sections of a large project is crucial. A robust design system serves as the backbone for achieving this goal. Fortunately, Chakra UI, a popular React component library, provides an excellent foundation for constructing a flexible and efficient design system. Let’s delve into the steps involved in crafting a design system using Chakra UI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rA5FKIuLs8NpZPb24EpGEQ.png" /><figcaption><a href="https://v2.chakra-ui.com/">https://v2.chakra-ui.com/</a></figcaption></figure><p><strong>Why Design System Matter?</strong></p><p>A design system is a comprehensive collection of reusable components, design principles, guidelines, and documentation. It fosters consistency, accelerates development, and promotes collaboration among designers and developers. Chakra UI, with its accessible and customizable components, aligns seamlessly with the principles of a design system.</p><p><strong>Define The Design Principles</strong></p><p>When it comes to making design decisions, we focus on a few core principles: typography, color palettes, spacing, visual hierarchy, and interaction patterns. By documenting these principles, we ensure a unified design language across our project.</p><p>In the case of Poltek SSN’s internal project, we initiated discussions with our client to understand their existing brand guidelines. They directed us to the Poltek SSN website as a reference point for establishing design consistency.</p><p>Based on our analysis of the website, we extracted key design elements and principles, which we then incorporated into our design system:</p><p><strong>Typography</strong>: We have to choose fonts that are easy to read and match our brand’s vibe. Consistency in font sizes and styles across different text elements is key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9efg0aAmYbyo-izPDf38dw.png" /></figure><p><strong>Color Palettes:</strong> The color choices need to complement each other and align with our brand guidelines. We derived a color palette inspired by the website’s color scheme, aiming to create a harmonious visual identity while maintaining the institution’s brand colors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*rEVDQeBJffzvUbYuSRfc5A.png" /></figure><p><strong>Visual Hierarchy:</strong> We followed the visual hierarchy established on the website, using headings, font weights, and color contrast to guide the user’s attention and create a clear structure for content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gm0iYFIi-ELZNrURcmgUmg.png" /></figure><p><strong>Interaction Patterns:</strong> Our interactive elements should be intuitive and user-friendly. Consistency in buttons, forms, and navigation components is crucial.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vx8RmxrsIIuCDGR3WIXtrA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-15OalnaOHhUVgABbgsRxw.png" /></figure><p><strong>Chakra UI Figma Library</strong></p><p>Now, let’s talk about a real game-changer for our design team: the Chakra UI Figma library. This tool mirrors Chakra UI’s component structure and styling options directly in Figma, allowing us to create mockups and prototypes that look just like the final implementation. This means fewer discrepancies and a smoother handoff to our developers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*klYEMMpLCWaCzbJsFtrPfw.png" /></figure><p>Using the Chakra UI Figma library helps us establish a shared visual language between our designers and developers from the start. We all work within the same system, reflecting the capabilities and constraints of the Chakra UI component library. This leads to a more efficient design and development process and results in a visually cohesive and consistent final product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IOtCamn98w1AnNj6s_gY0Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IixGRN7VNVvVTYCSX0Mw1g.png" /></figure><p><strong>From Design to Code: Implementing the Chakra UI Design System</strong></p><p>With our clear design principles in place and the Chakra UI Figma library as our guide, we were ready to turn our vision into code. The foundation of any Chakra UI application is the ChakraProvider component. This component wraps our entire application and provides access to our custom theme, global styles, and the Chakra UI component library.</p><pre>import &#39;@/styles/globals.css&#39;;<br>import type { AppProps } from &#39;next/app&#39;;<br>import { ChakraProvider } from &#39;@chakra-ui/react&#39;;<br>import { Footer, Navbar } from &#39;@/components/elements&#39;;<br>import theme from &#39;@/styles/theme&#39;;<br><br>export default function App({ Component, pageProps }: AppProps) {<br>  return (<br>    &lt;ChakraProvider theme={theme}&gt;<br>      &lt;Navbar /&gt;<br>      &lt;Component {...pageProps} /&gt;<br>      &lt;Footer /&gt;<br>    &lt;/ChakraProvider&gt;<br>  );<br>}</pre><p>We dissect our Figma mockups into smaller reusable components. Each component was crafted using Chakra UI’s pre-built elements, which already adhered to our design principles in terms of typography, spacing, and color.</p><p>Example: The Landing Page</p><pre>import { Button, Flex, Text } from &#39;@chakra-ui/react&#39;;<br>import Image from &#39;next/image&#39;;<br>import FormImage from &#39;../../public/assets/images/form.svg&#39;;<br>import { FiLogIn } from &#39;react-icons/fi&#39;;<br>......<br><br>export default function Home() {<br> ......<br>  return (<br>    &lt;Flex px={{ base: 4, md: 16 }} gap={16} justifyItems=&quot;center&quot;&gt;<br>      &lt;section className=&quot;flex w-full min-h-screen&quot;&gt;<br>        &lt;Flex<br>          direction={&#39;column&#39;}<br>          w={{ base: &#39;full&#39;, md: &#39;50%&#39; }}<br>          justify={&#39;center&#39;}<br>          align={{ base: &#39;center&#39;, md: &#39;start&#39; }}<br>          mb={24}<br>        &gt;<br>          &lt;Text fontSize={{ base: 24, md: 32 }}&gt;Selamat datang di&lt;/Text&gt;<br>          &lt;Text<br>            color=&quot;blue.900&quot;<br>            fontWeight=&quot;bold&quot;<br>            fontSize={{ base: 40, md: 64 }}<br>          &gt;<br>            Tracer Study!<br>          &lt;/Text&gt;<br>          {!user &amp;&amp; (<br>            &lt;&gt;<br>              &lt;Text&gt;Untuk memulai, silakan masuk.&lt;/Text&gt;<br>              &lt;Button<br>                mt={4}<br>                variant={&#39;solid&#39;}<br>                bg=&quot;#1A365D&quot;<br>                textColor={&#39;white&#39;}<br>                size={&#39;sm&#39;}<br>                onClick={() =&gt; {<br>                  router.replace(&#39;/login&#39;);<br>                }}<br>                leftIcon={&lt;FiLogIn /&gt;}<br>              &gt;<br>                Masuk<br>              &lt;/Button&gt;<br>            &lt;/&gt;<br>          )}<br>        &lt;/Flex&gt;<br>        &lt;Flex<br>          visibility={{ base: &#39;hidden&#39;, md: &#39;visible&#39; }}<br>          w={{ base: 0, md: &#39;50%&#39; }}<br>        &gt;<br>          &lt;Image src={FormImage} alt=&quot;Form illustration&quot; /&gt;<br>        &lt;/Flex&gt;<br>      &lt;/section&gt;<br>    &lt;/Flex&gt;<br>  );<br>}</pre><p>Notice how we effortlessly applied colors and typography styles without writing any CSS. Chakra UI&#39;s intuitive syntax made it a breeze to maintain consistency with our design principles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JdOHI1qSKYPtDKIgegpAIg.png" /></figure><p>Here are some other pages that we also crafted using Chakra UI:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eZVO7qIw5hQ-ryzxCgQ53g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KL6SsKLmkpBJK05K3RRGoA.png" /></figure><p>By using the power of Chakra UI and following a careful design system, we at Politeknik SSN have changed how we approach web development. Our teamwork, guided by the institution’s brand guidelines and the easy-to-use tools from Chakra UI, has helped us create visually cohesive and user-friendly experiences for various pages.</p><p><strong>Source</strong></p><ul><li><a href="https://www.invisionapp.com/inside-design/guide-to-design-systems/">https://www.invisionapp.com/inside-design/guide-to-design-systems/</a></li><li><a href="https://www.interaction-design.org/literature/topics/visual-hierarchy">https://www.interaction-design.org/literature/topics/visual-hierarchy</a></li><li><a href="https://loop11.medium.com/key-principles-of-visual-hierarchy-in-ux-design-0a31da0431f5">https://loop11.medium.com/key-principles-of-visual-hierarchy-in-ux-design-0a31da0431f5</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e99ffdf3b87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Application Monitoring: A Guide to Sentry, Google Analytics, and New Relic]]></title>
            <link>https://medium.com/@ghaydarafa/mastering-application-monitoring-a-guide-to-sentry-google-analytics-and-new-relic-1510eb2339b2?source=rss-4d7e30798be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1510eb2339b2</guid>
            <dc:creator><![CDATA[Ghayda Rafa]]></dc:creator>
            <pubDate>Sun, 21 Apr 2024 11:23:35 GMT</pubDate>
            <atom:updated>2024-05-20T17:05:35.948Z</atom:updated>
            <content:encoded><![CDATA[<p>Maintaining a successful digital presence in the rapidly evolving world of software development requires constant monitoring and analysis of application performance, user behavior, and errors. In this article, we will look at Sentry, Google Analytics, and New Relic and how they help with thorough application monitoring.</p><h3>Sentry: Error Monitoring Tools</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5Bzj3T62kH5mhvkzZ-Djrg.png" /><figcaption><a href="https://sentry.io/">https://sentry.io</a></figcaption></figure><p>Sentry is a leading platform for error monitoring that empowers developers to track, prioritize, and resolve errors in real-time. Key features include:</p><ul><li><strong>Real-time Error Tracking:</strong> Sentry captures errors as they occur, providing developers with immediate visibility into issues affecting their applications.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nXzIsjWcRHu-qvl64q2E-A.png" /></figure><ul><li><strong>Detailed Error Reports:</strong> Sentry provides rich error reports, including stack traces, request data, and environment information, enabling developers to diagnose and fix issues quickly.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_6akCVbkVPP5m4bGzq8kDQ.png" /></figure><ul><li><strong>Workflow Integration:</strong> Sentry seamlessly integrates with popular development tools like GitHub, GitLab, and Jira, streamlining the error resolution process.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w4X18_Z1o6k3deSw2an54g.png" /></figure><p>Sentry provides comprehensive documentation and guides for setting up error monitoring in various programming languages and platforms. For instance, the documentation for setting up Sentry in Node.js can be found at <a href="https://docs.sentry.io/platforms/javascript/guides/node/">https://docs.sentry.io/platforms/javascript/guides/node/</a>.</p><p>In this guide, developers can find detailed instructions on how to integrate Sentry with their Node.js applications to capture and track errors effectively. The documentation covers topics such as installation, configuration, error handling, and advanced usage of Sentry in Node.js projects.</p><p>With Sentry, teams can proactively identify, diagnose, and resolve errors before they impact end-users, ensuring a seamless and reliable user experience. Additionally, webhook integrations, such as Discord bots, can be used to receive notifications when errors occur.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*STEr7BcSn4fapWhXT3mfgA.png" /><figcaption>Webhooks via Discord</figcaption></figure><h3><strong>Sentry in Our project</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SQjPsee3qWvzPZJl" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qWlYsOiTQB-ijBVK" /></figure><p>We used Sentry to monitor the overall health and stability of our application. The dashboard gave us essential metrics like the failure rate, which shows the percentage of transactions that resulted in errors. By keeping a close watch on this metric, we could proactively find and fix issues before they impacted the user experience.</p><p>Additionally, Sentry’s performance monitoring capabilities allowed us to track the Apdex score, which measures user satisfaction based on the application’s response time.</p><p><strong>Issues Tracking</strong></p><p>Here is some issues that caught by Sentry in our project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dY1x2Oo1p2z-PQdq" /></figure><p>For example, Sentry proved invaluable by detecting a critical “Failed to send email” error. This error, originating from an unhandled exception in the MailService.sendSurveyStartMail function, was traced back to line 19 of mail.service.ts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*tzev7rySJ1nGXPWR" /></figure><p>The detailed error report provided by Sentry included the stack trace, revealing the root cause as a problem with the connection to send the email.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sxPct37M1uMZwox543kNWw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6dmR3rbx1sJzLAQf" /></figure><p>After reviewing the Sentry error report, we noticed that the error message indicated an authentication failure with the protocol server. This led us to investigate the environment variables used to store the protocol credentials. This error is a common mistake in development environments where credentials are often hardcoded or stored in configuration files.</p><p>By providing real-time error tracking and detailed reports, Sentry enabled us to quickly identify and resolve a critical issue that was impacting the application’s functionality. Without Sentry, it might have taken much longer to diagnose and fix the problem, potentially leading to user frustration and lost productivity.</p><p><strong>Profiling</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QM4cXty83b_qzVya" /></figure><p>Sentry’s performance monitoring capabilities are useful for maintaining a high-performing application. Profiling feature can helps developers identify performance bottlenecks and optimize their code.</p><p>Profiling allows you to see detailed performance data for your application’s various components. For example, if an endpoint like GET /prodi (which fetches a list of academic programs) is running slow, Sentry’s profiling tools can help pinpoint the exact cause. By analyzing the performance data, you can determine whether the issue lies in a slow database query, inefficient code logic, or other factors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4AHhWzsRgBpaL2Mq" /></figure><p>With this information, you can make informed decisions to optimize your application. This might involve refactoring code, adding database indexes, or adjusting server configurations. After implementing these changes, Sentry’s transaction tracing feature allows you to visualize the impact, confirming whether the optimizations have improved performance.</p><h3>Google Analytics: Revealing User Insights</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*P0vu6-rruMSqL14g" /><figcaption><a href="https://support.google.com/analytics/answer/9212670?hl=en">https://support.google.com/analytics/answer/9212670?hl=en</a></figcaption></figure><p>Google Analytics is a powerful web analytics platform that offers deep insights into user behavior and website performance. Key features include:</p><ul><li><strong>User Behavior Analysis:</strong> Google Analytics tracks user interactions such as page views, clicks, and conversions, allowing businesses to understand how users engage with their websites.</li><li><strong>Audience Segmentation:</strong> Google Analytics enables segmentation of website visitors based on demographics, interests, and behaviors, facilitating targeted marketing strategies.</li><li><strong>Performance Monitoring:</strong> Google Analytics provides performance metrics such as page load times and site speed, helping businesses optimize website performance for improved user experience.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kiBSR9GNtzsvVVuWeJ09UQ.png" /></figure><p>By leveraging Google Analytics, organizations can make data-driven decisions to enhance user engagement, conversion rates, and overall website performance.</p><p>Here’s a step-by-step guide on how to set up Google Analytics for your project:</p><ul><li>Sign in to <a href="https://analytics.google.com/">https://analytics.google.com/</a>, create your account, and then create a new property.</li><li>Fill in the property name and set the reporting time zone and currency based on your current zone.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KrzCKiYc8eQKux6cZgF_vg.png" /></figure><ul><li>Choose the industry category and business size of your project.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LVfGM6zTAJ5G_ccEcKXO9Q.png" /></figure><ul><li>Define your business objectives.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*upsU-ePBxBJkAyB6eQ0s9g.png" /></figure><ul><li>Specify where you’ll be collecting data from: web, Android app, or iOS.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-c_ABJoUSCrauLIAsdd6Uw.png" /></figure><ul><li>Set up the data stream, such as the URL for the website.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wflr9NtC_wBzsKD9dq_Egw.png" /></figure><ul><li>The page will display the web stream details. Your data stream is uniquely identified by its <strong>Measurement ID</strong>. It is formatted in G-XXXXXXX.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*IVSOkb1KlOFRVfwpf1r34Q.png" /></figure><ul><li>You can install Google Analytics with a website builder or CMS, or manually install it in your website code. Simply copy and paste the provided code into your codebase as instructed.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aJ5LSdl2ZwClUKS0R3T-7g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QRx68R39SXcbjj7HAIFWJA.png" /></figure><ul><li>Before pushing the code to your repository, test if it works in your local console. Type ‘dataLayer’ and press enter. It should display a result indicating that you’ve successfully set up Google Analytics.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*geTWXW4YluXr3FAMQqgejQ.png" /></figure><ul><li>Now, push it to your website repository. All done!</li></ul><h3>New Relic: Elevating Application Performance Monitoring</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*713nP39JxwgwsqJHu2SpDw.png" /><figcaption><a href="https://newrelic.com/">https://newrelic.com/</a></figcaption></figure><p>New Relic is a comprehensive observability platform that focuses on monitoring application performance and infrastructure. Key features include:</p><ul><li><strong>Application Performance Monitoring (APM):</strong> New Relic offers detailed insights into application performance metrics such as response time, throughput, and error rates, enabling teams to identify performance bottlenecks and optimize code.</li><li><strong>Infrastructure Monitoring:</strong> New Relic monitors infrastructure components such as servers, databases, and containers, providing visibility into system health and resource utilization.</li><li><strong>Advanced Analytics:</strong> New Relic’s advanced analytics capabilities allow teams to correlate application performance with business metrics, empowering data-driven decision-making.</li></ul><p>With New Relic, organizations gain a complete view of their application stack, enabling proactive performance optimization and ensuring a seamless user experience.</p><p><strong>Source</strong></p><ul><li><a href="https://docs.sentry.io/">https://docs.sentry.io/</a></li><li><a href="https://www.w3schools.com/howto/howto_google_analytics.asp">https://www.w3schools.com/howto/howto_google_analytics.asp</a></li><li><a href="https://www.youtube.com/watch?v=2woWjkED-vg">https://www.youtube.com/watch?v=2woWjkED-vg</a></li><li><a href="https://docs.newrelic.com/">https://docs.newrelic.com/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1510eb2339b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Fostering Team Spirit: Five Practices That Define Our Team Culture]]></title>
            <link>https://medium.com/@ghaydarafa/fostering-team-spirit-five-practices-that-define-our-team-culture-33311398327f?source=rss-4d7e30798be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/33311398327f</guid>
            <dc:creator><![CDATA[Ghayda Rafa]]></dc:creator>
            <pubDate>Sun, 31 Mar 2024 14:42:29 GMT</pubDate>
            <atom:updated>2024-03-31T17:00:01.233Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U8bHuk-m5RRMtPuw" /><figcaption>Photo by <a href="https://unsplash.com/@marvelous?utm_source=medium&amp;utm_medium=referral">Marvin Meyer</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>It’s simple to lose sight about the human element — the people behind the screens — in the fast-paced world of software development, where conversations are frequently dominated by lines of code. However, creating a healthy work atmosphere and strong team chemistry are essential for both individual and group success in any tech project.</p><p>The “people person” is essential to efficient people management because they are technically skilled individuals with the soft skills needed to handle the intricacies of interpersonal relationships. This person is aware that developing deep connections, encouraging teamwork, and providing assistance are just as important as writing flawless code.</p><p>It takes more than just putting together a great collection of people to create a dynamic team dynamic; it also takes nurturing an atmosphere where each person feels heard, respected, and empowered. A people person is great at building teamwork, bridging gaps between members, and gently and empathetically resolving disagreement.</p><p>In our team, we prioritize fostering a supportive and collaborative environment where every member feels valued, respected, and empowered. Here are five key practices that define our team culture:</p><h3>Embracing a Culture of Helpfulness</h3><p>No one is left to struggle alone in our team. We actively cultivate a culture where asking for help is not only encouraged but celebrated. Creating an atmosphere where individuals feel safe to make mistakes without fear of judgment fosters trust and psychological safety. By offering support and assistance to those in need, we strengthen our bonds as a team and collectively grow stronger.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*l00AKcBRZjPUyEF2MIhFog.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*KYVLgPdk-ZTmq3CM2aIGhg.png" /></figure><h3>Gratitude and Appreciation</h3><p>Acknowledging the contributions of team members is essential for morale and motivation. We make it a habit to express gratitude for the efforts of our colleagues, like a simple “thank you” message in our communication channels. Recognizing and appreciating each other’s contributions reinforces a culture of respect and companionship.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*t4OK7sVT2ITzVkwxs-qwPA.png" /></figure><h3>Transparent Communication on Requirements</h3><p>Effective communication is the foundation of successful collaboration. We ensure that everyone is on the same page by maintaining clear and transparent communication regarding project requirements. Whether it’s through regular updates, clarifying discussions, or documentation, we strive to keep everyone informed and aligned, minimizing misunderstandings and maximizing productivity.</p><h3>Regular Progress Updates</h3><p>Keeping everyone informed about project progress is key to maintaining transparency and accountability within the team. We make it a point to provide regular updates on our individual tasks and overall project status. Whether it’s through our notion, progress reports, or informal check-ins, staying connected and informed helps us track our collective progress and address any challenges proactively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AUO7--mLCDPwc8Rh8it_xQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*uShHl4mPOn9uVbmws4CRsg.png" /></figure><h3>Code Reviews with a Positive Spin</h3><p>We believe in the power of constructive feedback to enhance code quality and promote continuous improvement. During code reviews, we make it a point to begin with words of appreciation, acknowledging the effort and dedication put into the work. Starting with phrases like “Thanks for your hard work” sets a positive tone and encourages openness to feedback.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*Ys9Eug9gtnabPFCT-VJJlw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/993/1*MWFoXiUoFfH-U_YEUrADIg.png" /></figure><p>By embracing these practices, we create a supportive and inclusive team culture that fosters collaboration, innovation, and continuous growth. Each member plays a vital role in shaping our collective success, and together, we strive to achieve excellence in everything we do.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33311398327f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enhancing Code Quality: A Comprehensive Approach]]></title>
            <link>https://medium.com/@ghaydarafa/enhancing-code-quality-a-comprehensive-approach-fba1ec602a62?source=rss-4d7e30798be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/fba1ec602a62</guid>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Ghayda Rafa]]></dc:creator>
            <pubDate>Sun, 31 Mar 2024 13:02:29 GMT</pubDate>
            <atom:updated>2024-05-08T04:43:23.800Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OcK0chc6WMGCbebs" /><figcaption>Photo by <a href="https://unsplash.com/@jstrippa?utm_source=medium&amp;utm_medium=referral">James Harrison</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In the software development world, maintaining high code quality is paramount to the success of any project. A robust codebase not only ensures the reliability and maintainability of the software but also enhances developer productivity and collaboration. In this article, we’ll delve into various practices and tools employed by our team to elevate code quality, with a focus on SonarQube, code reviews, and unit testing.</p><p>When code follows recommended practices and standards, it becomes more readable, maintainable, and robust. This is referred to as <strong>code quality</strong>. Code quality can be reliably evaluated using a variety of tools and methodologies, even though it is a little subjective. One of the most proactive methods in the quality assurance toolkit is static analysis.</p><p><strong>Static analysis</strong> is like having an observant friend who analyzes your code without actually executing it. It examines the code for potential issues, bugs, and vulnerabilities without running the program. By doing this, it catches problems early in the development process, saving you from headaches down the line. It’s similar to having a careful inspector who finds defects before they become more serious problems.</p><p>This proactive approach sets the stage for more reliable software and more efficient development cycles. With static analysis tools like SonarQube, teams can catch issues early, ensuring a solid foundation for their projects. Plus, it’s a great way to foster a culture of quality and reliability within the team.</p><h3>SonarQube: The Sentinel of Code Quality</h3><p>SonarQube is a robust tool that revolutionizes the way teams approach code quality assurance. Its extensive array of features empowers developers to conduct thorough code inspections and maintain high standards of quality throughout the development lifecycle. Let’s delve into some key components and features of SonarQube:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nGr0q3ezwXIg5nxSdTTvtw.png" /><figcaption><a href="https://www.sonarsource.com/products/sonarqube/">https://www.sonarsource.com/products/sonarqube/</a></figcaption></figure><p><strong>Dashboard</strong></p><p>SonarQube’s dashboard provides a comprehensive overview of a project’s code quality and health. It offers essential metrics like code coverage, technical debt, and issue density, enabling teams to quickly assess the state of their codebase and prioritize areas for improvement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZKuEx0ik4q6fSxKNusAuA.png" /></figure><p><strong>Quality Gates</strong></p><p>Quality Gates serve as a checkpoint in the development pipeline, defining conditions that code must meet to progress further. These conditions typically include metrics like code coverage, code duplications, and critical issue counts, ensuring that only high-quality code advances to production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*yFvg5Lx4lXphA76zmRyv-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*-c4VAsjlQVvJfYYpUMpedw.png" /></figure><p><strong>Issues Management</strong></p><p>SonarQube meticulously identifies various issues in the codebase, including bugs, vulnerabilities, code smells, and security hotspots. Each issue is categorized by severity, allowing teams to prioritize their efforts and address critical issues promptly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tLf_v6Z43WKJbcrGttXd9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vM2xaqqUYTbtW7hKQOBpzQ.jpeg" /></figure><p>Let’s try to remove this code line from SurveyService.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UHRfUbniVEll-jIbQT5I4Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*Wgq088sZ7QwRwR7QWIATyA.jpeg" /></figure><p>After commiting the code, now it’s clear:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WH1cwbHZCJrKLtoY87UU5A.png" /></figure><p><strong>Code Smells Detection</strong></p><p>SonarQube excels at detecting common programming practices known as code smells, which may indicate underlying problems in the codebase. By identifying issues such as duplicated code, complex methods, and unused variables, SonarQube guides developers in refactoring and enhancing the overall code quality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1m9Y_WsOM6PrbksaNWkXCw.png" /></figure><p><strong>Security Vulnerability Scanning</strong></p><p>SonarQube conducts thorough security vulnerability analysis, uncovering risks like SQL injection, cross-site scripting (XSS), and insecure cryptographic algorithms. By detecting these vulnerabilities early, teams can mitigate security threats and fortify their applications against potential attacks.</p><p>There are no examples of this from my team yet, but here is the documentation from Sonarqube:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sVyzYLRKkjft7CVm0AnRCQ.png" /><figcaption><a href="https://docs.sonarsource.com/sonarqube/latest/user-guide/rules/security-related-rules/">https://docs.sonarsource.com/sonarqube/latest/user-guide/rules/security-related-rules/</a></figcaption></figure><p><strong>Code Coverage Integration</strong></p><p>SonarQube seamlessly integrates with code coverage tools to measure the effectiveness of automated tests. High code coverage signifies that the codebase is extensively tested, reducing the likelihood of undetected bugs and regressions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VYkAMZWOa5-46va6oway3Q.png" /></figure><p><strong>Technical Debt Management</strong></p><p>SonarQube quantifies and visualizes technical debt, representing the cost of addressing issues and improving code quality over time. This insight enables teams to prioritize refactoring efforts and allocate resources efficiently, ultimately reducing the burden of technical debt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rrWIHTRMakWuf1zyOM5FYw.png" /></figure><p>Teams may create a proactive approach to code quality assurance and produce software projects that are more dependable, safe, and maintainable by utilizing SonarQube’s features. Teams may continuously monitor and improve the quality of their codebase by using SonarQube as the foundation of their development process. This promotes creativity and excellence in software development.</p><h3>Utilizing Code Reviews for Continuous Improvement</h3><p>An essential component of our development process is code reviews. Every code is carefully examined by other developers before being merged into the main branch. We make sure that code complies with accepted coding standards, best practices, and extensive testing through code reviews. Code reviews also promote cooperation, information exchange, and group ownership of the source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P86U_ZIeyuUMslvkzwLViw.png" /></figure><h3>Unit Testing: Ensuring Reliability and Stability</h3><p>Unit testing plays a crucial role in verifying the correctness of individual components of our software. Using Jest, a popular JavaScript testing framework, we write unit tests to validate the behavior of our code under various scenarios. Furthermore, we utilize code coverage tools to measure the effectiveness of our tests, aiming for high coverage to mitigate the risk of undetected bugs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UFs3kBuA1oE2i3c-6cDOyg.png" /></figure><h3>Continuous Integration: Automating Quality Assurance</h3><p>We use continuous integration to optimize our development process and uphold a high standard of code quality (CI). Every code change that is made with CI pipelines set up with Gitlab CI/CD initiates automated builds, tests, and static code analysis. By doing this, problems are identified early on, avoiding regressions, and preserving the integrity of the source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5mCxEE6mVCEbpfuJJG3ydw.png" /><figcaption>Error identified by failed build</figcaption></figure><p><strong>Source</strong></p><ul><li><a href="https://docs.sonarsource.com/">https://docs.sonarsource.com/</a></li><li><a href="https://www.perforce.com/blog/sca/what-static-analysis">https://www.perforce.com/blog/sca/what-static-analysis</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fba1ec602a62" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Crafting Maintainable Applications: Applying SOLID Principles and Best Practices]]></title>
            <link>https://medium.com/@ghaydarafa/crafting-maintainable-nestjs-and-nextjs-applications-applying-solid-principles-and-best-practices-7742570b2b98?source=rss-4d7e30798be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7742570b2b98</guid>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Ghayda Rafa]]></dc:creator>
            <pubDate>Sun, 31 Mar 2024 10:02:27 GMT</pubDate>
            <atom:updated>2024-04-21T10:01:00.485Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J7B0l_tUsTjCHux-" /><figcaption>Photo by <a href="https://unsplash.com/@pankajpatel?utm_source=medium&amp;utm_medium=referral">Pankaj Patel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Writing stable, scalable, and effective code requires a commitment to SOLID principles and the utilization of best practices in the software development industry. Using particular examples from my project codebase, we will see how these techniques and concepts can be implemented in a NestJS, NextJs, and Java applications.</p><h3><strong>Understanding SOLID Principles</strong></h3><p>SOLID is an acronym that stands for five key principles of object-oriented programming and design. Let’s briefly review each principle:</p><p><strong>1. Single Responsibility Principle (SRP)</strong></p><blockquote>A class should have only one reason to change, meaning it should have only one responsibility.</blockquote><p>In the SurveyService, each method is responsible for a specific set of operations related to surveys. For example, createSurvey, getAllSurveys, editSurvey, and deleteSurvey handle CRUD operations for surveys. There are also some additional methods according to requirements. This adheres to the SRP, as each method has a single responsibility related to surveys.</p><pre>@Injectable()<br>export class SurveyService {<br>  constructor(private readonly prisma: PrismaService) {}<br><br>  private validateFormDetails(form: SurveyDTO) {<br>     // method to validate form details<br>  }<br><br>  async createSurvey(createSurveyDTO: CreateSurveyDTO) {<br>     // method to create survey     <br>  }<br><br>  async getSurveyById(surveyId: string) {<br>     // method to get survey by id<br>  }<br><br>  async editSurvey(id: string, editSurveyDTO: EditSurveyDTO) {<br>     // method to update survey<br>  }<br><br>  async deleteSurvey(id: string): Promise&lt;string&gt; {<br>     // method to delete survey<br>  }<br><br>  async getAvailableSurveyByYear(<br>    admissionYear: string,<br>    graduateYear: string,<br>  ): Promise&lt;Form[]&gt; {<br>     // method to get available survey based on query year<br>  }<br><br>  async getAllSurveys(): Promise&lt;Form[]&gt; {<br>     // method to get all surveys<br>  }<br>}</pre><p><strong>2. Open/Closed Principle (OCP)</strong></p><blockquote>Software entities (classes, modules, functions, etc.) should be open for extension but closed for modification. This means we should be able to add new functionality or change existing behavior without altering the original source code.</blockquote><p>Here’s an example of the Open/Closed Principle (OCP) implementation in Java:</p><pre>// Payment.java<br>public interface Payment {<br>    Bill pay(Bill bill) throws InterruptedException;<br>}</pre><pre>// CouponAdapter.java<br>public class CouponAdapter implements Payment {<br>    private final Coupon adaptedCoupon;<br><br>    private final CustomerService customerService;<br><br>    public CouponAdapter(Coupon coupon, CustomerService customerService) {<br>        this.adaptedCoupon = coupon;<br>        this.customerService = customerService;<br>    }<br><br>    @Override<br>    public Bill pay(Bill bill) throws InterruptedException {;<br>        if(adaptedCoupon.isRedeemed()){<br>            return bill;<br>        }<br>        return adaptedCoupon.redeem(bill, customerService);<br>    }<br>}<br><br>// Coupon.java<br>public synchronized Bill redeem(Bill bill, CustomerService customerService) throws InterruptedException {<br>        Customer customer = customerService.findCustomer(bill.getUsername());<br><br>        if (!isRedeemed) {<br>            double customerBalance = customer.getBalance();<br>            double price = bill.getTotal();<br>            if (isEnoughBalance(customerBalance, price)) {<br>                isRedeemed = true;<br>                double finalPrice = price - (discount/100) * price;<br>                bill.setCustomerBalance(customerBalance - finalPrice);<br>                customer.setBalance(customerBalance - finalPrice);<br>                bill.setMethod(PaymentMethod.PET_WALLET_WITH_COUPON);<br>                bill.setTotal(finalPrice);<br>                bill.setPaid(true);<br>            }<br>        }<br><br>        return bill;<br>    }</pre><pre>// VoucherAdapter.java<br>public class VoucherAdapter implements Payment {<br>    private final Voucher adaptedVoucher;<br>    private final CustomerService customerService;<br><br>    public VoucherAdapter(Voucher voucher, CustomerService customerService) {<br>        this.adaptedVoucher = voucher;<br>        this.customerService = customerService;<br>    }<br><br>    @Override<br>    public Bill pay(Bill bill) {<br>        if (adaptedVoucher.isRedeemed()) {<br>            return bill;<br>        }<br>        return adaptedVoucher.redeem(bill, customerService);<br>    }<br>}<br><br>// Voucher.java<br>public synchronized Bill redeem(Bill bill, CustomerService customerService) {<br>        Customer customer = customerService.findCustomer(bill.getUsername());<br><br>        if (bill.getTotal() == this.amount) {<br>            this.isRedeemed = true;<br>            customer.setBalance(customer.getBalance());<br>            bill.setMethod(PaymentMethod.PET_WALLET_WITH_VOUCHER);<br>            bill.setCustomerBalance(customer.getBalance());<br>            bill.setPaid(true);<br>            return bill;<br>        }<br>        return bill;<br>    }</pre><p><strong>Interface Payment:</strong> This interface defines a contract for all types of payments. It allows for the addition of new payment functionalities without modifying existing code.</p><p><strong>Adapter Classes (CouponAdapter and VoucherAdapter)</strong>: These classes implement the Payment interface. They adapt different types of payments into the Payment contract, enabling the usage of various payment types without altering existing code.</p><p><strong>Coupon and Voucher Classes:</strong> Both classes have a redeem method that implements the redemption logic for each. This method processes payments and changes the payment status.</p><p>By adhering to the OCP, the system allows for the extension of payment functionalities through new adapters implementing the Payment interface, without requiring modifications to the existing codebase. Additionally, the logic for processing payments is encapsulated within the redeem methods of the Coupon and Voucher classes, promoting separation of concerns and maintainability.</p><p><strong>3. Liskov Substitution Principle (LSP)</strong></p><blockquote>Objects of a superclass should be replaceable with objects of its subclasses without affecting the correctness of the program.</blockquote><p>In my project, my team and I apply this principle to a practical example using the PrismaService class in a NestJS application. The PrismaService class extends the PrismaClient from the Prisma library, inheriting all its functionalities. This design ensures that instances of PrismaService can seamlessly replace instances of PrismaClient throughout the application without impacting functionality.</p><pre>import { Injectable, OnModuleInit, OnModuleDestroy } from &#39;@nestjs/common&#39;;<br>import { PrismaClient } from &#39;@prisma/client&#39;;<br><br>@Injectable()<br>export class PrismaService<br>  extends PrismaClient<br>  implements OnModuleInit, OnModuleDestroy<br>{<br>  async onModuleInit() {<br>    await this.$connect();<br>  }<br><br>  async onModuleDestroy() {<br>    await this.$disconnect();<br>  }<br>}</pre><p><strong>4. Interface Segregation Principle (ISP)</strong></p><blockquote>It is not appropriate to have clients rely on interfaces they do not use. This idea highlights how crucial it is to design precise and detailed interfaces.</blockquote><p>Here’s an example of ISP in a software development context, specifically in user management within a system:</p><p>Let’s say we have a UserManagement interface for managing users in the system:</p><pre>public interface UserManagement {<br>    void addUser(User user);<br>    void removeUser(User user);<br>    void updateUser(User user);<br>    void getUserInfo(User user);<br>    void changePassword(User user, String newPassword);<br>}</pre><p>Then, we have two classes implementing this interface: AdminUserManager and RegularUserManager :</p><pre>public class AdminUserManager implements UserManagement {<br>    // Implementation of all methods<br>}<br><br>public class RegularUserManager implements UserManagement {<br>    // Implementation of all methods<br>}</pre><p>But, there’s an issue with the UserManagement interface in terms of ISP. Regular users might not require the changePassword method since only admins might have the authority to change user passwords. When using the UserManagement interface for the RegularUserManager class, we&#39;re forcing that class to implement methods that are irrelevant to regular users. The solution is to split the UserManagement interface into several more specific interfaces based on user needs. This way, the RegularUserManager class only needs to implement interfaces that are relevant to it, while the AdminUserManager can implement all interfaces, including PasswordChange.</p><p>By applying ISP, we ensure that clients only depend on the functionality they need, thereby enhancing flexibility, maintainability, and clarity in the system.</p><pre>public interface UserAddition {<br>    void addUser(User user);<br>}<br><br>public interface UserRemoval {<br>    void removeUser(User user);<br>}<br><br>public interface UserUpdate {<br>    void updateUser(User user);<br>}<br><br>public interface UserInfo {<br>    void getUserInfo(User user);<br>}<br><br>public interface PasswordChange {<br>    void changePassword(User user, String newPassword);<br>}</pre><p><strong>5. Dependency Inversion Principle (DIP)</strong></p><blockquote>High-level modules should not depend on low-level modules. Both should depend on abstractions. Abstractions should not depend on details but details should depend on abstractions.</blockquote><p>The StudyProgramService and SurveyService rely on the PrismaService for database operations. By depending on abstractions (interfaces) instead of concrete implementations, the DIP is adhered to. This allows for easier testing, maintenance, and swapping of database providers in the future.</p><pre>import { PrismaService } from &#39;../prisma/prisma.service&#39;;<br><br>export class StudyProgramService {<br>  constructor(private readonly prisma: PrismaService) {}<br>...<br><br>export class SurveyService {<br>  constructor(private readonly prisma: PrismaService) {}<br>...</pre><h3>Example of Best Practice</h3><p>In line with best practices, I try to optimize the deletion process within the systems to ensure efficiency and maintainability. One notable approach is to use bulk deletion operations instead of iterating over individual items, so it can reduce database round trips and improve overall performance.</p><p>In the provided example, the implementation of the `deleteMultiple` method within the `StudyProgramService` demonstrates this best practice by utilizing the `deleteMany` function provided by Prisma. Instead of iterating over each individual ID and issuing separate delete requests, the method efficiently delegates the deletion task to Prisma’s `deleteMany` function, which is capable of handling multiple deletions in a single operation.</p><pre>async deleteMultiple(ids: string[]): Promise&lt;StudyProgram[]&gt; {<br>  const studyPrograms = await this.getMultipleStudyProgramsById(ids);<br>  await this.checkStudyProgramsUsed(ids);<br>  await this.prisma.studyProgram.deleteMany({<br>    where: {<br>      id: {<br>        in: ids,<br>      },<br>    },<br>  });<br><br>  return studyPrograms;<br>}</pre><p><strong>Source</strong></p><ul><li><a href="https://dev.to/sasithwarnakafonseka/building-maintainable-nextjs-applications-with-solid-principles-16g3">https://dev.to/sasithwarnakafonseka/building-maintainable-nextjs-applications-with-solid-principles-16g3</a></li><li><a href="https://dev.to/amirfakour/applying-solid-principles-in-nestjs-2g2o">https://dev.to/amirfakour/applying-solid-principles-in-nestjs-2g2o</a></li><li><a href="https://www.baeldung.com/java-interface-segregation">https://www.baeldung.com/java-interface-segregation</a></li><li><a href="https://www.baeldung.com/java-open-closed-principle">https://www.baeldung.com/java-open-closed-principle</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7742570b2b98" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Applying Nielsen’s 10 Usability Heuristics and Shneiderman’s 8 Golden Rules: A Practical Guide]]></title>
            <link>https://medium.com/@ghaydarafa/applying-nielsens-10-usability-heuristics-a-practical-guide-500b19e461eb?source=rss-4d7e30798be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/500b19e461eb</guid>
            <category><![CDATA[interaction-design]]></category>
            <dc:creator><![CDATA[Ghayda Rafa]]></dc:creator>
            <pubDate>Sun, 25 Feb 2024 16:49:36 GMT</pubDate>
            <atom:updated>2024-03-06T01:26:33.720Z</atom:updated>
            <content:encoded><![CDATA[<p>Nielsen’s 10 Usability Heuristics are interaction design principles created by Jakob Nielsen and Rolf Molich in 1990. Meanwhile, Shneiderman’s Eight Golden Rules was discovered by Ben Shneiderman. The principles promoted by both have the same goal, they hoped that the product created would be easier to use and more efficient for its users.</p><p><strong>Visibility of System Status (Nielsen) vs. Offer Informative Feedback, Design Dialogue to Yield Closure (Shneiderman)</strong></p><p>Nielsen has the principle that the user must always be informed about what is happening at the moment, about the actions and interactions he is carrying out with the current application. Shneiderman also mentioned that users must know where they are and what is happening at all times. Don’t keep users guessing. We should tell them what their action has led them to. So, for every action, there must be appropriate, human-readable feedback within a reasonable timeframe. An example in the application that we created is the appearance of a success alert when the user has successfully logged in. With this alert, the user is informed that he has been authenticated to enter the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Sd9vK4uEOkNBeCqO" /></figure><p><strong>Match Between the System and the Real World (Nielsen) vs. Strive for Consistency (Shneiderman)</strong></p><p>In Nielsen’s principle, we need to create a product with things that commonly exist in the real world. This is done so that each user is not confused and feels familiar with the signs or elements used in the product. While Shneiderman did not mention “real world” applications, he wrote that it is necessary to strive for consistency by utilizing familiar icons and user flows when designing similar situations and action sequences. Standardizing the way information is delivered ensures users can apply knowledge from one click to another without needing to learn new representations for the same actions. In our application design, we apply this principle by using icons that are commonly used in various places. For example, the person icon depicts the “Profile” feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Uw2qclPWm6ouqUwV" /></figure><p><strong>User Control and Freedom (Nielsen) vs. Support internal locus of control, Permit easy reversal of actions (Shneiderman)</strong></p><p>Both advocate for empowering users with control over their actions, allowing them to navigate and interact with the system freely. Users must have freedom and control their actions regarding the application so that we can gain their trust by building the system to perform as they expect. Shneiderman also said that we should offer users obvious ways to reverse their actions whether it occurs after a single action, a data entry, or a whole sequence of actions. A direct example in our application is, when a user enters to edit information, he can also press the cancel/back button to cancel the changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/0*lB7oupxfPPQ-R9YH" /></figure><p><strong>Consistency and Standards (Nielsen) vs. Strive for Consistency (Shneiderman)</strong></p><p>This similarity highlights the significance of consistency in design, which reduces cognitive load and enhances usability. Don’t create inconsistent products that can confuse users. We need to make a product that follows a standard well. For example, in our application, we decided to only use Bahasa Indonesia as the main language. Apart from that, we also use the same button display for each page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*peG2BGVpyiHLEVoCOsz8iA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*3xeby8jaeZUScmlRWZD_qw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*0mQCblIwrk-1l2VsiPKbIA.png" /></figure><p><strong>Error Prevention (Nielsen) vs. Offer Simple Error handling (Shneiderman)</strong></p><p>Both suggest proactive measures to minimize errors, such as confirming actions before irreversible changes and providing clear feedback. Products need to be made well which can help prevent users from experiencing problems. Shneiderman also says when unavoidable errors occur, make sure users are provided with simple, intuitive step-by-step instructions to resolve the issue as quickly and easily as possible. In our application, we implement this in the delete an item feature. The user will be given a pop up message asking whether the user is sure to delete the item. We also mark the required input field if the user forgot to fill it in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/0*bvVuZpfi_VBQjzuF" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mUAmwK43nQasCsuAS80TtA.png" /></figure><p><strong>Recognition Rather Than Recall (Nielsen) vs. Reduce Short-Term Memory Load (Shneiderman)</strong></p><p>Both recommend designing interfaces where users can recognize options and actions instead of relying on memory, achieved through clear labeling and visual cues. We need to make it easy for users to recognize things rather than making them need to remember. For example, in each field, we can provide a placeholder that can immediately tell them what they need to fill in that field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/0*e1fLE9IsGMeqZC66" /></figure><p><strong>Flexibility and Efficiency of Use (Nielsen) vs. Enable Frequent Users to Use Shortcuts (Shneiderman)</strong></p><p>Both advocate for designing interfaces that cater to different user needs, whether it’s efficiency through shortcuts for power users or simplicity for novice users. We need to make a product that is efficient for users. One of the things that can be provided is a shortcut to go to various features. In our application, we created a navbar that directly provides menu options for users to go to the feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oFS5QZpWyT8TpAhy" /></figure><p><strong>Aesthetic and Minimalist Design (Nielsen)</strong></p><p>According to Nielsen, we should try to make our application simple and pleasant to look at. Meanhile Shneiderman does not have a principle similar to this. In our application, we avoid using too many and unnecessary elements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n-LHhXgtnH7SQzbkbiIX4g.png" /></figure><p><strong>Help Users Recognize, Diagnose, and Recover from Errors (Nielsen) vs. Offer Informative Feedback (Shneiderman)</strong></p><p>Both stress the need for informative feedback in error situations, guiding users on how to recognize, understand, and recover from errors. If an error occurs, the user needs to be informed, including what user action caused the failure to occur. In this way, users can correct actions so they can continue using the application. One example of the design we created is that when a login error occurs, the user is informed of the cause of the login failure, for example, because the password is wrong or the email entered has not been registered in the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8kP9ZUH4r2HPiIjQ" /></figure><p><strong>Help and Documentation (Nielsen) vs. Reduce Short-Term Memory Load (Shneiderman)</strong></p><p>Sometimes we need some additional information for users so that they are not confused about how to use the features provided. The Schneiderman principle which is most similar to Nielsen’s principle is Reduce Short-Term Memory Load. It is said that interfaces should be as simple as possible with proper information hierarchy. For example in our application, in the survey filling feature in our application, we provide information such as score for the rating scale and also a simple guide of a feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*8brNRiokyBYBAiyPM5oMuw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*qBNYdzaYJgfv3nD5_tqevQ.png" /></figure><h4>Source</h4><ul><li><a href="https://www.nngroup.com/articles/ten-usability-heuristics/">https://www.nngroup.com/articles/ten-usability-heuristics/</a></li><li><a href="https://aelaschool.com/en/interactiondesign/10-usability-heuristics-ui-design/">https://aelaschool.com/en/interactiondesign/10-usability-heuristics-ui-design/</a></li><li><a href="https://www.interaction-design.org/literature/article/shneiderman-s-eight-golden-rules-will-help-you-design-better-interfaces">https://www.interaction-design.org/literature/article/shneiderman-s-eight-golden-rules-will-help-you-design-better-interfaces</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=500b19e461eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Notion and Git: Boosting Productivity in Development]]></title>
            <link>https://medium.com/@ghaydarafa/notion-a-customized-collaboration-tool-for-software-development-teams-eaa3f1f0d24e?source=rss-4d7e30798be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/eaa3f1f0d24e</guid>
            <category><![CDATA[project-management]]></category>
            <dc:creator><![CDATA[Ghayda Rafa]]></dc:creator>
            <pubDate>Sun, 25 Feb 2024 15:38:51 GMT</pubDate>
            <atom:updated>2024-05-08T04:12:49.511Z</atom:updated>
            <content:encoded><![CDATA[<p>When developing software with a team, of course, many things need to be considered, such as task management, project documentation, code collaboration, and even version control. We have access to a wide range of tools and platforms in this day of sophisticated technology that can promote teamwork and boost output. In this article, I’m going to introduce you to Notion and Git, tools that are widely used.</p><p>Notion is more than just a project management or note-taking app. It is a powerful platform for group collaboration that combines several functions into one organized space. I’ll explain to you how Notion can help our team work more efficiently.</p><p>With Notion, getting started is quite simple because there are numerous engineering templates available, such as Scrum Board, Agile, Sprint Planning, and others.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UVcrU_sfnhUIFfyD" /></figure><p>For further details, here are some things we can do in Notion to optimize team productivity</p><p><strong>Scrum Board</strong></p><p>In this feature, not only can we divide the scrum board into three sections — TO DO, IN PROGRESS, and DONE — but we may also customize it by adding other categories as needed. Scrum board visualization makes it easier for teams to see ongoing project progress.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HFSFURMfe26W5jPC" /></figure><p><strong>Epic and Task</strong></p><p>It’s simple to create lots of epics and link them to every task or product backlog item that currently exists. An epic is essentially a user story that is broken down into more manageable tasks or stories. The components of our application that are necessary are called epic. As the project develops, we can additionally designate a team member to handle each job and modify its status. We can receive notifications related to any change in our notion, which naturally helps in raising our awareness of the team’s work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sZdOsDq89UfQpP5u" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6kX1E73WaWHF3WRA" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b8ljGrRYRO_R_h2q" /></figure><p><strong>Timeline or Product Roadmap</strong></p><p>The dates we have specified in our work plan can be used to automatically generate views in the form of a timeline or product roadmap. A well-defined timeline ensures that all team members are aware of what is being worked on, when it will be finished, and what to anticipate from each iteration. This creates important consistency and visibility in software development projects.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4V06mW03NMTqf2tZ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hFA08SZWdkcjBARm" /></figure><p><strong>Real-time collaboration</strong></p><p>Most importantly, Notion allows team members to edit documents, task lists, or notes together in real-time. This means that when one team member makes a change, the change is immediately visible to the rest of the team without needing to refresh the page or wait for a manual save. In our project, we heavily relied on Notion for collaborative document creation. Whether drafting acceptance criteria or fleshing out intricate requirement details, Notion’s real-time collaboration feature played a pivotal role. It allowed team members to work together seamlessly, ensuring that everyone could contribute simultaneously and stay updated on the latest changes without any delays.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gFrkj9OPJPCT0ZIgHgF9qQ.png" /></figure><p>Now I will introduce you to Git. Git is a version control system that allows developers to track changes in their code, collaborate smoothly, and roll back to previous versions if necessary. Some examples of Git-based platforms that are widely used are Gitlab, Github, and Bitbucket. Each platform has similar features. In this article, I will explain some of the features available in Gitlab.</p><p><strong>Epic and Issues</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RECTf1J0zxPEfYhT" /><figcaption><a href="https://www.youtube.com/watch?v=c0EwYYUZppw&amp;t=88s">https://www.youtube.com/watch?v=c0EwYYUZppw&amp;t=88s</a></figcaption></figure><p>Just like in Notion, Gitlab also provides features for organizing Issues and Epics in our projects. Each issue has a title, description, labels, assignments, deadlines, and comments for further discussion. Each epic has a description and can contain issues linked to it. Epics allows project managers and teams to see the big picture of a project and identify the parts that need to be prioritized or completed first.</p><p><strong>Version Control</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1TBqNLJ72cOsiVRK" /></figure><p>Git facilitates version control by maintaining a history of changes made to files in a project. Every time a member commits a code change, it will be saved in Gitlab and we can see the code for each version or revert to that version if necessary.</p><p><strong>Collaboration</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/0*VhSjaj1pkc9dh7hi" /></figure><p>Of course, this platform supports teams to collaborate. Each member can clone the main code, they can work simultaneously on different features or improvements. This illustrates parallel programming which makes project development faster.</p><p><strong>Branching and Merging</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/0*FalKX6EPj1ebLXUA" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zSL6FGDGtUOyX5aE" /></figure><p>Git’s branch and merge features allow teams to experiment with new features or improvements without disrupting the main code base. Developers can create separate branches for each task or feature, work on them independently, and merge them back into the main branch when finished. When we want to merge code into another branch, we can make a merge request. At this stage, other members can review our code and provide feedback if there are deficiencies that need to be corrected before merging. This illustrates modularity and also reduces the risk of introducing bugs into the main code.</p><p><strong>CI/CD Automation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qyXKfJyq_6-BjgCR" /></figure><p>CI/CD (Continuous Integration/Continuous Deployment) allows teams to automatically integrate code, test changes, and deploy software quickly and regularly. GitLab provides powerful CI/CD tools to facilitate this practice. On the CI side, GitLab uses Pipelines to automate building and testing code every time there is a commit or pull request/merge request. The Pipelines configuration is defined in the .gitlab-ci.yml file in the project repository. GitLab Runner runs jobs from Pipelines in a container. On the CD side, GitLab enables automated deployment of software to multiple environments, including staging and production, via Pipelines. The Environment and Review Apps features allow creating isolated environments for each branch or pull request. With CI/CD in GitLab, teams can achieve faster, more secure, and more reliable software delivery by automating testing and deployment steps.</p><h4>Sources</h4><ul><li><a href="https://www.forbes.com/advisor/business/what-is-a-scrum-board/">https://www.forbes.com/advisor/business/what-is-a-scrum-board</a></li><li><a href="https://www.workamajig.com/blog/scrum-methodology-guide/scrum-epic">https://www.workamajig.com/blog/scrum-methodology-guide/scrum-epic</a></li><li><a href="https://docs.gitlab.com/">https://docs.gitlab.com/</a></li><li><a href="https://www.atlassian.com/git/tutorials/what-is-version-control">https://www.atlassian.com/git/tutorials/what-is-version-control</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eaa3f1f0d24e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Better Software: The Test-First Approach of Test-Driven Development]]></title>
            <link>https://medium.com/@ghaydarafa/building-better-software-the-test-first-approach-of-test-driven-development-e76e53f01b03?source=rss-4d7e30798be6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e76e53f01b03</guid>
            <category><![CDATA[test-driven-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Ghayda Rafa]]></dc:creator>
            <pubDate>Sun, 25 Feb 2024 13:19:37 GMT</pubDate>
            <atom:updated>2024-05-26T05:02:43.474Z</atom:updated>
            <content:encoded><![CDATA[<p>Have you ever heard of TDD? Test-Driven Development, or TDD, is a programming methodology in which test cases are written first, and then code is written to solve the test cases. We can design and create test cases that suit the application, then continue by implementing functions to develop. In this context, TDD is also often referred to as Test First Development. With this approach, we can avoid code duplication because we will only write code that answers the test cases or specifications that we want to have in our application.</p><h3>The TDD Cycle: Red-Green-Refactor</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/0*zE8Vj0svqFnXTD2R" /><figcaption><a href="https://brainhub.eu/library/test-driven-development-tdd">https://brainhub.eu/library/test-driven-development-tdd</a></figcaption></figure><p>There are 3 stages in TDD: the RED-GREEN-REFACTOR process.</p><ol><li><strong>RED = FAIL</strong><br>We will start by writing test cases that represent the requirements of the application. Make sure that we write both positive cases, negative cases, and possible edge cases. The application does not currently have a method that can respond to the test case. Consequently, when this test case is executed, it will provide a failure result.</li><li><strong>GREEN = PASS</strong><br>The next step is to implement functions that can answer the existing test cases. We only need to write as much code as necessary, with the aim of making the test case successful. This is done to ensure our code is clean of unnecessary lines and avoids code duplication. After the code is implemented, we can run the test again. We can go on to the next phase if all of the test cases pass and we have satisfied the application requirements. If there are still test cases that fail, we need to edit the code again until the function is implemented correctly and the test case can pass.</li><li><strong>REFACTOR</strong><br>Once the function has been implemented appropriately, we can restructure the code to clean up our application’s code structure. A few things that can be done include, for instance, relocating the recently written code to a more logical location, breaking down long codes, assigning suitable function names, and more. Ensure that the refactoring does not affect the functionality of our code by running the test again after it has been finished.</li></ol><h3>Practical Implementation in My Team Project</h3><p>I tried to use TDD in this PPL project like in the previously mentioned stages. I started by making the following test case, which has both positive and negative cases. The required functions are not yet implemented at this point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uA4YzCO-rxzcC3Qd" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3DhqiF49EV6M9wnJ" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XyTzjIR55W3-wI2E" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n6I9ZnzB9YEQtgpz" /></figure><p>I made a commit with the tag [RED] as a sign that the pipeline being run will fail the test section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/0*T5HcXe9aJhtab9Ve" /></figure><p>Then I continued by implementing the function according to the test case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uq3Yg7m90gZ_b4Mz" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Jo4oMsxiVHE-_ADL" /></figure><p>After that, I made a commit with the tag [GREEN], indicating that the pipeline would successfully execute because the function had been implemented to handle the earlier test case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KLg8ZvYeHNqSC2Ru" /></figure><p>I review my code once more after the test passes to determine whether the current code still needs to be refactored. I didn’t do the refactoring because, apparently, my code already looked decent enough — clean, effective, and didn’t require any refactoring.</p><p>I checked the code coverage and the result is 100%, which indicates that every line of code, every function, and every condition has been tested. Achieving this assures that my tests and functions are in sync.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-Vboyho-0e1jlH62ATWU4Q.png" /></figure><h4>Using Jest for Code Coverage</h4><p>Jest is a popular testing framework for JavaScript. It is particularly well-suited for Test-Driven Development (TDD) due to its rich feature set, ease of use, and comprehensive documentation. One of its standout features is the ability to check code coverage, which helps ensure that all parts of your code are tested. This is crucial in a TDD workflow as it guarantees that your tests cover the necessary scenarios.</p><p><strong>Key Features of Jest</strong></p><ol><li><strong>Easy Setup</strong><br>Jest is easy to set up and configure. It comes with a default configuration that works out of the box for most projects, but it also allows for extensive customization if needed.</li><li><strong>Fast and Reliable</strong><br>Jest runs tests in parallel to maximize performance. It also provides detailed error messages and stack traces, making it easier to identify and fix issues.</li><li><strong>Snapshot Testing</strong><br>Jest supports snapshot testing, which is useful for ensuring that your UI components in Frontend render correctly. This is particularly beneficial for React applications, where you can take snapshots of component trees and compare them over time to detect unexpected changes.</li><li><strong>Mocking and Spying</strong><br>Jest includes built-in support for mocking and spying, which allows you to isolate components and test them in controlled environments. This is essential for unit testing as it ensures that your tests are focused and reliable.</li><li><strong>Code Coverage Reports</strong><br>Jest can generate detailed code coverage reports, showing which lines, functions, and branches of your code have been executed by your tests. This helps you identify untested parts of your codebase and ensures comprehensive test coverage.</li></ol><p><strong>How Jest Enhances TDD</strong></p><ol><li><strong>Ensuring Comprehensive Test Coverage</strong><br>By providing detailed coverage reports, Jest helps you ensure that every part of your code is tested. This aligns with the TDD philosophy of writing tests first and then developing code to pass those tests.</li><li><strong>Facilitating Refactoring</strong><br>One of the stages in the TDD cycle is refactoring. Jest makes this process easier by providing reliable tests that you can run after making changes to your code. This ensures that your refactoring does not introduce any regressions.</li><li><strong>Speeding Up the Development Cycle</strong><br>Jest’s fast test execution and clear error messages help you identify and fix issues quickly, allowing you to maintain a fast development pace. This is important in a TDD workflow where tests are run frequently.</li><li><strong>Supporting Multiple Testing Strategies</strong><br>In addition to unit testing, Jest supports integration and snapshot testing. This allows you to test your application at different levels of abstraction, providing a more comprehensive validation of your code.</li></ol><h3>Advantages of TDD</h3><p>After putting TDD into practice personally, I discovered that this approach is interesting and offers several advantages. Some of them are:</p><ul><li><strong>Focus on application requirements</strong><br>To satisfy application requirements, we consider more carefully the scenarios that our code needs to handle. This is advantageous since it allows us to devote our whole attention to the required criteria.</li><li><strong>Debugging becomes easier</strong><br>We can do debugging more easily if there is an issue with the implementation of our function because the test case has already been built and the intended result of the code is clearly stated.</li><li><strong>The code becomes more straightforward<br></strong>Only the functions that are required are implemented, which simplifies and clarifies the objective of our code. Because every test has been designed to be self-explanatory and easily understood, the documentation is also more descriptive.</li></ul><h3>Disadvantages and Challenge</h3><ul><li><strong>It is not ideal for use with components that need to perform functional testing<br></strong>TDD is quite limited to be applied to frontend code or GUI design because TDD focuses more on unit development and code integration, rather than focusing on UI development. In UI development, we are involved with user interaction as well as more detailed visual aspects that TDD cannot cover.</li><li><strong>It is possible that some cases were missed<br></strong>Because writing test cases requires the developer to focus on the application requirements, human error may occur and certain situations that ought to be included are forgotten. Realizing this can also be challenging because some functions may be skipped because the code is only based on the test cases that were written.</li></ul><h3>Example Without TDD: My Experience in Another Project</h3><p>During my fifth semester in the Advanced Programming course, I encountered a project where Test-Driven Development wasn’t utilized. Instead, the development process followed a more traditional approach of coding first and then testing.</p><p>One major challenge I faced was ensuring comprehensive test coverage. Without predefined test cases guiding my development, it was difficult to anticipate all potential scenarios. As a result, even after extensive testing, achieving 100% code coverage proved elusive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hQkZ1Xv6yX6Hwqe2z0gRdg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m2bS0BmRdoPcqeRaXE0oQA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o1YY_2xOaiOcktDWMYqidA.png" /><figcaption>Even after the project ended, the code only achieved 86% coverage</figcaption></figure><p>Reflecting on this experience, I realized the value of Test-Driven Development. By writing tests first, developers can systematically define the behavior of their code and catch potential issues early in the development process. This not only improves code quality but also streamlines debugging and maintenance efforts in the future.</p><h4>Sources</h4><ul><li><a href="https://www.guru99.com/test-driven-development.html">https://www.guru99.com/test-driven-development.html</a></li><li><a href="https://brainhub.eu/library/test-driven-development-tdd">https://brainhub.eu/library/test-driven-development-tdd</a></li><li><a href="https://jestjs.io/docs/getting-started">https://jestjs.io/docs/getting-started</a></li><li><a href="https://www.craigrisi.com/post/the-pros-and-cons-of-different-test-tools-jest">https://www.craigrisi.com/post/the-pros-and-cons-of-different-test-tools-jest</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e76e53f01b03" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>