<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Wisdom Ikezi</title>
    <description>The latest articles on DEV Community by Wisdom Ikezi (@i_am_ziike).</description>
    <link>https://dev.to/i_am_ziike</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2800873%2Fddad6556-0b7f-49a3-8c08-c69dca67ad65.png</url>
      <title>DEV Community: Wisdom Ikezi</title>
      <link>https://dev.to/i_am_ziike</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/i_am_ziike"/>
    <language>en</language>
    <item>
      <title>I Built a Smart Bookmark Extension</title>
      <dc:creator>Wisdom Ikezi</dc:creator>
      <pubDate>Sat, 08 Mar 2025 14:44:21 +0000</pubDate>
      <link>https://dev.to/i_am_ziike/i-built-a-smart-bookmark-extension-1208</link>
      <guid>https://dev.to/i_am_ziike/i-built-a-smart-bookmark-extension-1208</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Finding Bookmarks Shouldn’t Be This Hard
&lt;/h3&gt;

&lt;p&gt;Like many others, I’ve always used browser bookmarks to save interesting articles, videos, and useful websites. But over time, my bookmarks became an unorganized mess—a black hole where saved pages went to disappear. Finding a specific bookmark when I needed it felt like searching for a needle in a haystack, especially with Chrome’s default bookmark manager and most existing extensions.&lt;/p&gt;

&lt;p&gt;The biggest issue? Search is too rigid. Sure, I could apply date filters, but that barely helped. If I didn’t remember the exact title or keyword, my bookmarks remained buried, even though I knew they were there somewhere.&lt;/p&gt;

&lt;p&gt;So, I decided to build something that could actually solve this problem for me.&lt;/p&gt;

&lt;h3&gt;
  
  
  How PageStash Works
&lt;/h3&gt;

&lt;p&gt;The idea was simple: use AI to make bookmarks more searchable. Instead of relying solely on keyword matching, I leveraged Gemini to create a more intuitive search experience.&lt;/p&gt;

&lt;p&gt;Here’s how it works:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;When searching for a bookmark, the extension gets a list of URLs and titles.&lt;/li&gt;
&lt;li&gt;Gemini then analyzes the content and determines what the bookmark is actually about and filters the ones that matches your search term&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For example, if you saved an article titled “10 Ways to Improve Productivity” but only remember that it was about time management, you can simply search for “tips to manage time better”, and the system will surface your bookmark.&lt;/p&gt;

&lt;h3&gt;
  
  
  Challenges I Faced
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;While most websites include useful metadata in the URL or title, not all do. If a webpage lacks descriptive information, the AI model might not be able to categorize it accurately, which in turn reduces accuracy.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Privacy Concerns&lt;br&gt;
Security was a top priority while building PageStash. All search requests are processed through Gemini’s API, meaning only Google handles your data.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To give users more control, I also introduced a “Credentials” page, allowing them to attach their own Gemini API key. This key is securely stored locally on their device, enhancing privacy while also improving response time and performance—especially when handling multiple requests at once.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final Thoughts
&lt;/h3&gt;

&lt;p&gt;While I tried to aim for a 100% accuracy, achieving perfection in AI-driven search is nearly impossible. That said, I’m proud of what I built, and I might take on the challenge of improving it in the future.&lt;/p&gt;

&lt;p&gt;I had a blast working on this project, and I’d love to collaborate on similar ideas. If you’re interested in building something together, I’m usually free on weekends!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/iamziike/pagestash-extension/tree/main" rel="noopener noreferrer"&gt;Source Code&lt;/a&gt;&lt;br&gt;
&lt;a href="https://chromewebstore.google.com/detail/pagestash/khklapnpffhhaklagbcgliaboajoimdh" rel="noopener noreferrer"&gt;Extension&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gemini</category>
      <category>javascript</category>
      <category>react</category>
      <category>programming</category>
    </item>
    <item>
      <title>What is Defensive Programming🛡️</title>
      <dc:creator>Wisdom Ikezi</dc:creator>
      <pubDate>Sat, 01 Feb 2025 21:43:19 +0000</pubDate>
      <link>https://dev.to/i_am_ziike/what-is-defensive-programming-3cj4</link>
      <guid>https://dev.to/i_am_ziike/what-is-defensive-programming-3cj4</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Building Code That’s Ready for Anything&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;What is Defensive Programming?&lt;/li&gt;
&lt;li&gt;Why is Defensive Programming Important?&lt;/li&gt;
&lt;li&gt;Common Defensive Programming Techniques&lt;/li&gt;
&lt;li&gt;When is Defensive Programming Too Much?&lt;/li&gt;
&lt;li&gt;Final Thoughts&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;What is Defensive Programming?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Defensive Programming&lt;/em&gt; is an approach in which developers anticipate potential issues and write code to manage unexpected inputs, system failures, or errors.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Why is Defensive Programming Important?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Defensive programming enables the programmer to view the code from several angles: a user's perspective, an attacker's viewpoint, and a careless developer's stance. Additionally, it boosts the chances of creating bug-free software.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Benefits of Defensive Programming&lt;/strong&gt;
&lt;/h4&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Handles the Unpredictable&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Users don’t always interact with software as we expect. Defensive programming allows your application to handle these situations effectively.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Prevents Catastrophic Failures&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;An unhandled error can result in significant crashes or data loss. Defensive programming helps mitigate this.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Improves Code Maintainability&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Writing defensively makes your code simpler to debug, extend, and maintain for future developers.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Increases Security&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Validating and sanitizing inputs can prevent security vulnerabilities like SQL injection or cross-site scripting.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Common Defensive Programming Techniques&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Applying the following guidelines can help us implement defensive programming effectively. These principles ensure that your code is robust, secure, and able to handle unexpected situations gracefully.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Validate Inputs and Outputs&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;It’s crucial to ensure that all incoming and outgoing data adhere to the expected formats and constraints since user input, API responses, and external data sources cannot be trusted without proper validation. Furthermore, always sanitize data before displaying it to users to prevent any potential vulnerabilities from arising.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Validating Forms&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useForm&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-hook-form&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;zod&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;UserSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;email&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;UserForm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;handleSubmit&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;register&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useForm&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;defaultValues&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;
      &lt;span class="na"&gt;onSubmit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nf"&gt;handleSubmit&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;UserSchema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;safeParse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;success&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
          &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This is Sparta🛡️&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Name"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;email&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Email"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;password&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt; &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Password"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;

      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Validating forms is possible with vanilla javascript, but this process is unadvised.&lt;br&gt;
Using a proven library like &lt;a href="https://zod.dev/" rel="noopener noreferrer"&gt;zod&lt;/a&gt;  or &lt;a href="https://medium.com/@paulallles/validation-with-yup-bb12565c1f9d" rel="noopener noreferrer"&gt;yup&lt;/a&gt;  makes your life easier.&lt;br&gt;
In the example above, we are using &lt;strong&gt;&lt;em&gt;zod&lt;/em&gt;&lt;/strong&gt; to verify that the response we receive from the user aligns with the schema/requirements described. &lt;em&gt;&lt;strong&gt;We can also apply part of this approach to validate API responses.&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;UserSchema&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;safeParse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;apiJsonResponse&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;strong&gt;Null Checks&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Prevent &lt;code&gt;null&lt;/code&gt; exceptions by checking values before use. In JavaScript, we can utilize optional chaining to diminish the chances of these occurring.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nf"&gt;showHello&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// No Error&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  &lt;strong&gt;Fail Gracefully&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;It's important to design your software so that it can handle errors and exceptions gracefully, ensuring it doesn't crash. You can add helpful features like try-catch blocks, fallback procedures, and default values to keep everything running smoothly. It’s also a great idea to display clear and descriptive error messages when issues arise, as this can make the experience much more user-friendly!&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Testing&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Taking the time to write tests that ensure specific parts of your software function as expected makes a big difference.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Avoid Magic Numbers and Hard-Coded Values&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Use named constants or enums instead of arbitrary numbers or strings. This method enhances the readability of your code, simplifies maintenance, and reduces the likelihood of errors during updates.&lt;/p&gt;

&lt;h5&gt;
  
  
  &lt;strong&gt;Limit the Scope of Variables&lt;/strong&gt;
&lt;/h5&gt;

&lt;p&gt;Define variables within the narrowest scope necessary to minimize unintended side effects. This approach keeps your code modular, making it easier to maintain and debug. Additionally, we must avoid all unnecessary globally scoped variables.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;When is Defensive Programming Too Much?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Although defensive programming is crucial, excessive implementation may result in excessively complex code. Finding the right balance can sometimes be challenging; I sometimes find myself in this situation. &lt;br&gt;
To address any confusion, I recommend you consider the following questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is the code becoming bloated and unreadable?&lt;/li&gt;
&lt;li&gt;Will the current validations, checks, etc., degrade the user experience?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If that’s the case, I suggest lowering the number of checks. You can move forward if user experience is a secondary concern and application security is the top priority.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Final Thoughts&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Defensive programming extends beyond merely preventing crashes; it focuses on developing reliable, secure, and maintainable software. Always ask yourself: "What could go wrong?" and write your code with that in mind.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
