<?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 Troy Gooden on Medium]]></title>
        <description><![CDATA[Stories by Troy Gooden on Medium]]></description>
        <link>https://medium.com/@tro12185?source=rss-e6712c45cb8c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_ZGM_2WrE3cHsg12.jpg</url>
            <title>Stories by Troy Gooden on Medium</title>
            <link>https://medium.com/@tro12185?source=rss-e6712c45cb8c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 10:29:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@tro12185/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[Generator Functions in]]></title>
            <link>https://medium.com/@tro12185/generator-functions-in-21f80a44ba82?source=rss-e6712c45cb8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/21f80a44ba82</guid>
            <dc:creator><![CDATA[Troy Gooden]]></dc:creator>
            <pubDate>Sun, 05 Apr 2020 03:49:42 GMT</pubDate>
            <atom:updated>2020-04-05T08:25:22.085Z</atom:updated>
            <content:encoded><![CDATA[<h3>Generator Functions in Javascript</h3><p>Generator functions are a neat little thing in the ECMAScript spec. Introduced in ES6 generator functions have the ability to take a function, and produce a return when it “yields”, which is a fancy term for saying a stopping point. I think of generator functions as javascript functions that maintain their own state, and have to be called on to produce every yielded value, It sounds confusing but I will show you how this works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*wxTxKBiDTyHMdjSdVZho0w.png" /></figure><p>In the image above if you look closely you will see first and foremost how we declare our function. Adding an asterisk(*) after the function keyword lets this object know that it is a generator function. Even though you declared the generator, these functions can’t be used without assigning them to a variable. Now this is where the magic happens, we assign our generator function and we even pass in an argument.</p><p>In order to activate the generator function / have it run we simply use the variable assigned to it and call the method <strong>.next()</strong> on it.</p><p>Let’s take a look at how generator functions work when we call the <strong>next</strong> method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*ro0SRlwOaJMK5uMZh-A1Ig.png" /></figure><p>Calling the <strong>next</strong> method the first time produces the return of an object that will contain both the value of the yielded statement, and whether or not the generator function is finished. It will go in order of the statements yielded to it. Calling <strong>next</strong> the first time will return our first statement (value:1, done: false), if we keep calling it the return value will then produce our next line with the value of 2 and lastly our <strong>arg</strong> line with the value of 34. Once a generator function has no other statements to yield the final object returned contains the last returned value of the function, and the done key will now be <strong>true</strong>. Once the done value is true the generator function no longer needs to iterate over itself when called with the next method.</p><p>Functions like these are used in libraries like Redux Saga and Thunk in order to help the control flow of asynchronous activities. These functions are really good when needing to handle multiple values or calls in a synchronous manner.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21f80a44ba82" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cookies….LocalStorage….Sessions?? Browser Storage options]]></title>
            <link>https://medium.com/@tro12185/cookies-localstorage-sessions-browser-storage-options-eeb0a3f9fb6?source=rss-e6712c45cb8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/eeb0a3f9fb6</guid>
            <dc:creator><![CDATA[Troy Gooden]]></dc:creator>
            <pubDate>Mon, 30 Mar 2020 02:58:31 GMT</pubDate>
            <atom:updated>2020-03-30T03:56:35.600Z</atom:updated>
            <content:encoded><![CDATA[<p>When it comes to storing data, usually we are used to thinking in current applications, and how they use variables and databases to store and retreive information. When it comes to your browser, standards were put in place to help developers save content locally on your machine to help websites mainly to identify you or save content you do on websites. The API for most modern day browsers include 3 types of ways to save data to your browsers and that comes in the forms of either Cookies, Local Storage, or Sessions.</p><h3>Cookies</h3><p>You probably have thousands of these saved on your computer from different websites, this is definitely considered the ‘OG’ when it comes to web storage. Cookies are many only a text only form of data, sites will save them on your browser to retrieve information on your visit. There have been new laws that have been put in place to make sure you know how companies are using these cookies and your data. Each browser you use will have its own individual set of cookies, which are independent to itself. What this means is that if you are logged into one site on your firefox browser, it wouldn’t be shared with cookies from your chrome browser. Cookies can be used for both good and bad, because trackers can tell which websites you visit by matching up the cookies from one website to another site you may visit in the future.</p><h4>Pros:</h4><p>Supported in more browsers</p><p>Uses very little space</p><p>More useful for server side code</p><p>Has an expiration date that can be set</p><h4>Cons:</h4><p>Very Small Storage</p><p>Used often for malicious tracking</p><p>Used often for client side Code</p><p>Limited to 4KB</p><h3>Local Storage</h3><p>Local Storage tends to be a very good, and new way to persist data from a website. They allow more flexibility than a cookie because they are larger in size, and are very structured. Using local storage in your application is as easy as stating “localStorage.setItem(ItemKey, ItemValue)”. This is super easy to do in languages like javascript, and by using “localStroage.getItem” you can pull in the data that will be linked to the key you set.</p><h4>Pros:</h4><p>Uses key value pairs to store data</p><p>A more common way to persist data from a user</p><p>Does not expire</p><h4>Cons:</h4><p>Not a good option for sensitive data</p><p>Limited to 5MB</p><h3>Session Storage</h3><p>Session storage maintains most of the options from the local storage, the main difference is the state disappears once the browser tab / window is closed. You should mainly use this storage to collect data about just the current thing going on with a website from the client. important data should not be persisted in any form.</p><h4>Pros:</h4><p>Good for quick data that needs to be persisted</p><p>Helps not to keep unwanted data around</p><h4>Cons:</h4><p>Not good for long term data</p><p>With these options for storage in the browsers the potential for how websites interact with the user becomes even more limitless. In the day and age were data is King, it helps to make sure we have many places that we can save that data. Happy Coding folks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eeb0a3f9fb6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object Destructuring in Javascript]]></title>
            <link>https://medium.com/@tro12185/object-destructuring-in-javascript-913702a050fb?source=rss-e6712c45cb8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/913702a050fb</guid>
            <dc:creator><![CDATA[Troy Gooden]]></dc:creator>
            <pubDate>Mon, 23 Mar 2020 01:52:34 GMT</pubDate>
            <atom:updated>2024-12-03T05:57:07.633Z</atom:updated>
            <content:encoded><![CDATA[<h3>Simplifying Code with Object Destructuring in ES6</h3><p>One of my favorite features of ES6 is <strong>object destructuring</strong>, a technique that simplifies not only the way your code looks but also how easily you can access your data. In essence, destructuring allows you to extract and assign variables from small to large datasets with minimal effort. In JavaScript, destructuring is commonly used with <strong>arrays</strong> and <strong>objects</strong>.</p><p><strong>Destructuring Arrays</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0h1bRlySOSm5EmEcyRq74g.png" /></figure><p>Traditionally, when accessing elements from an array like names or colors, you would use <strong>bracket notation</strong> to specify the index of the value you need. While this method works, what if I told you there’s a cleaner, more intuitive way to achieve the same result? Enter <strong>array destructuring</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J9SQG7QOkioCZaoG6jIxTg.png" /></figure><p>In the example above, we use <strong>bracket notation</strong> on the left side of the equal sign to define variables. These variables directly correlate to the indexes of the array on the right side of the equal sign. For instance, nameOne is assigned the value ‘Mark’ because it corresponds to the first index of the names array. Every variable on the left is mapped to the respective index in the array.</p><p>Although it may seem complex at first, playing around with destructuring quickly reveals its elegance and power. With array destructuring, you can extract multiple values in a concise, readable way, reducing redundancy and improving clarity in your code.</p><p><strong>Destructuring Objects</strong></p><p>Where destructuring truly shines is with <strong>objects</strong>, especially when working with frameworks like React. In scenarios where you’re passing down large amounts of data through <strong>props</strong>, destructuring allows you to explicitly pick out the properties you need, saving time and making your code more manageable.</p><p>Unlike arrays, destructuring objects works by matching <strong>keys</strong> to variable names, not indexes. This provides a precise way to access only the data you need without having to repeatedly reference the object itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j7_jEFEcpxFgE7Ypg-GNdQ.png" /></figure><p>In the example above, we declare a constant on the left-hand side with the object keys we want to extract (name, street, city etc). By placing the object <strong>business</strong> on the right side of the equal sign, we can directly assign these values to variables without having to write repetitive code like business.name or business.street.</p><p><strong>Why Use Destructuring?</strong></p><p>Destructuring offers several advantages:</p><p>1. <strong>Cleaner Code</strong>: By reducing repetitive access patterns, it makes your code more concise and readable.</p><p>2. <strong>Explicit Variable Selection</strong>: You can extract only the data you need, avoiding unnecessary clutter.</p><p>3. <strong>Syntactic Sugar</strong>: Destructuring adds elegance and simplicity, making your code easier to write and understand.</p><p>Whether you’re simplifying variable naming or cleaning up your codebase, destructuring is a powerful tool that deserves a place in your JavaScript toolkit. Play around with it, integrate it into your projects, and see how it transforms your coding experience.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=913702a050fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Composition when building apps?]]></title>
            <link>https://medium.com/@tro12185/composition-when-building-apps-3d9da747ebac?source=rss-e6712c45cb8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d9da747ebac</guid>
            <dc:creator><![CDATA[Troy Gooden]]></dc:creator>
            <pubDate>Mon, 16 Mar 2020 04:33:56 GMT</pubDate>
            <atom:updated>2020-03-16T04:33:56.074Z</atom:updated>
            <content:encoded><![CDATA[<p>When we build apps, sometimes we want functionality to be repeated amongst objects in our application so we don’t have to keep repeating code. We use principles that understand good programming concepts such as Polymorphism, Abstraction, Inheritance, and encapsulation. All these things have their place in different programs, but one of the concepts we will focus on today is using composition to build objects in our apps as opposed to inheritance.</p><p>Now imagine that we are building a game which has Heros in it. We may need our game to have characters that share different moves based on what type of hero we are creating.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-zAV6qiECq4pXByRz5WHKA.png" /></figure><p>In our example above we create a class called Hero that can then create more Hero’s. The Hero class has 2 basic functions that all heros can inherit that include attacking and walking. We then create 2 more heroes which extend our main class functionality through ArcherHero and SwordHero, both of which come with their own methods. The problem with inheritance is that we can only inherit one class at a time, so let’s say we wanted to create a new hero that had the ArcherHero properties and the SwordHero properties……we might run into a issue on how to make our program do this properly. This is kind of where inheritance has a weak point. If we really want to make sure our new Hero can swing a sword and also fire a arrow, it’s here that we can maybe refactor our code to use composition instead to create this multi-talented hero.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U42JzZdOdH4FRLZZ9oSN7A.png" /></figure><p>With the code above now we will see what composition is all about. As you can see we now broke up the function of all our code. We made a hero with the function “swordArcherHero” …. after making this hero where we would pass in the name of our hero, we are able to return all the abilities we want our hero to have. Each ability we pass into our return statement of our new multi-talented hero will also pass in the hero name object itself so it can reference who the action belongs to. This new form factor of our code is using composition so that no matter what the number of new actions we create for our hero, we can always add it, remove it, or even give it specific properties and methods that that Hero can then carry on. We have much cleaner code and methods that can be used with a myriad of different heros. No longer are we stuck trying to repeat code and inherit classes after more classes. Try to use composition when you know you may have methods that will be shared amongst many different objects. Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d9da747ebac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Snapshot Testing in React]]></title>
            <link>https://medium.com/@tro12185/snapshot-testing-in-react-6f7f707ad0e7?source=rss-e6712c45cb8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/6f7f707ad0e7</guid>
            <dc:creator><![CDATA[Troy Gooden]]></dc:creator>
            <pubDate>Mon, 09 Mar 2020 02:45:48 GMT</pubDate>
            <atom:updated>2024-12-14T02:35:57.884Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Snapshot Testing in React: A Beginner’s Guide</strong></h3><p>When it comes to testing, we need tools that ensure our applications perform exactly as intended. One useful testing concept in the <strong>React</strong> ecosystem is <strong>Snapshot Testing</strong>. With snapshot testing, we capture a “snapshot” — a representation of our code’s current state — and compare it to future code to ensure consistency. This makes it easy to identify whether changes in a project affect how components render and behave.</p><p>Snapshot testing is especially useful for React because it allows us to confirm that updates or refactoring do not unintentionally alter the UI.</p><p><strong>Setting Up Snapshot Testing in React</strong></p><p>In React, <strong>Jest</strong> is pre-installed as the default testing library. However, for snapshot testing, we need additional tools to integrate seamlessly with React components. These include:</p><p>1. <strong>Enzyme</strong>: For creating snapshots of components.</p><p>2. <strong>enzyme-adapter-react-16</strong>: Ensures compatibility between Enzyme and React 16.x.</p><p>3. <strong>enzyme-to-json</strong>: Converts Enzyme output into a format Jest can process.</p><p><strong>Required Installations</strong></p><p>To get started, install the following packages:</p><p>• React 16.x</p><p>• enzyme</p><p>• enzyme-adapter-react-16</p><p>• enzyme-to-json</p><p>Once installed, you’re ready to configure snapshot testing.</p><p><strong>Configuring Snapshot Testing</strong></p><p>Next, you need to set up an <strong>adapter</strong> for Enzyme to work with React. Open (or create) the <strong>setupTests.js</strong> file in the root of your project. This file configures the environment for testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_INev0NgRQdjOpKJaCipHw.png" /><figcaption>Setting up our setupTests.js File</figcaption></figure><p>With this configuration in place, Enzyme can now interact with your React components for testing.</p><p><strong>Writing a Snapshot Test</strong></p><p>Jest automatically detects test files ending in <strong>.test.js</strong> or <strong>.spec.js</strong>, or files inside a <strong>__tests__</strong> folder. Create a file named <strong>App.test.js</strong> in your project’s root directory to test the rendering of your App component.</p><p>Here’s an example of a basic snapshot test for the App component:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*igKf_mGwrllCr1BPIoS4Bw.png" /></figure><p><strong>How It Works</strong></p><p>1. The <strong>shallow</strong> method from Enzyme renders the App component without recursively rendering child components.</p><p>2. The <strong>toMatchSnapshot</strong> method creates or compares the current snapshot to ensure the component’s output remains consistent.</p><p>When you run npm test, Jest creates a __snapshots__ folder in the same directory as the test file. Inside, a .snap file is generated, containing the snapshot of the App component.</p><p><strong>Example Snapshot Output</strong></p><p>Below is an example of what a generated snapshot file might look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hYidyZWYH_UpkQHJOOo6VA.png" /></figure><p>The snapshot represents the DOM output of the App component at the time of the test.</p><p><strong>Monitoring Changes with Snapshots</strong></p><p>Snapshot tests are most effective when you provide realistic data and inputs to your components. Whenever the component’s structure or output changes, Jest will notify you, allowing you to review whether the changes are intentional.</p><p>If the changes are expected, you can update the snapshot by running:</p><pre>npm test -- -u</pre><p>If not, this alerts you to unintended modifications that could break your application.</p><p><strong>Limitations of Snapshot Testing</strong></p><p>• <strong>Shallow Rendering</strong>: Since we used shallow rendering, child components are not tested in this example. For more comprehensive tests, consider using mount from Enzyme.</p><p>• <strong>Maintenance</strong>: Snapshots must be reviewed and updated responsibly. Blindly updating snapshots can defeat the purpose of testing.</p><p><strong>Additional Resources</strong></p><p>For a deeper dive into snapshot testing, refer to:</p><p>• <a href="https://jestjs.io/">Jest Documentation</a></p><p>• <a href="https://enzymejs.github.io/enzyme/">Enzyme Documentation</a></p><p>Snapshot testing is a powerful way to ensure the stability of your React components. It simplifies the process of catching unintentional UI changes, giving you more confidence as your project evolves.</p><p><strong>Happy coding!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f7f707ad0e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is SSH? How does it help our applications?]]></title>
            <link>https://medium.com/@tro12185/what-is-ssh-how-does-it-help-our-applications-ef9a3a3d0eb2?source=rss-e6712c45cb8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef9a3a3d0eb2</guid>
            <dc:creator><![CDATA[Troy Gooden]]></dc:creator>
            <pubDate>Mon, 02 Mar 2020 04:14:54 GMT</pubDate>
            <atom:updated>2020-03-02T07:00:57.640Z</atom:updated>
            <content:encoded><![CDATA[<p>SSH (Secure Shell) is a network protocol popularly used to secure your information. We mainly tend to want to use this protocol on unsecured networks especially when it comes to transferring things like passwords or sensitive data. This protocol allows us to make sure things like passwords are not being transferred in just plain text, and to also prevent against being able to snoop on data.</p><p>Within this architecture the client will connect to a server in where they will share a key with each other. There is a public key and a private key that lives on both the client machine and the server machine. By using these keys the client can always makes sure the server integrity is never compromised because the client receives a key from the server that will identify it as the correct server. Think of it as instead of shaking hands with someone upon greeting them, you instead give them a dap (the handshakes you see the basketball players do) that you both memorized and you only do with your best friend.</p><p>Once a client confirms that the server is who it says it is, and vice versa…. the client can now do things that it couldn’t do with the server before having access, such as file transfers. You can control things to do on the server once this line of communication is open. We use SSH in many things such as web services when we want to have computers gain access to accounts that are really tied to their computers. It allows for a level of security where computers can identify each other properly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef9a3a3d0eb2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is the package.json doing?]]></title>
            <link>https://medium.com/@tro12185/what-is-the-package-json-doing-2f9016a832a9?source=rss-e6712c45cb8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f9016a832a9</guid>
            <dc:creator><![CDATA[Troy Gooden]]></dc:creator>
            <pubDate>Mon, 24 Feb 2020 03:50:12 GMT</pubDate>
            <atom:updated>2020-02-24T04:20:35.715Z</atom:updated>
            <content:encoded><![CDATA[<p>Usually when you write code in Javascript, we actually sometimes use a node.js bundler manager called NPM(or YARN). We use these tools to help us import code from other libraries so that our app may depend on the code from that library to run. Usually once you initiate a code folder with something like NPM INIT, it creates a package.json file in the root of a directory that will serve as the way NPM can point your application to libraries and files and also configuration it might need.</p><p>Your package.json also holds more information that just your application dependencies, it also houses the name of your app, the version of your app, you’ll get a small description if needed, and you can even show your licensing in your package.json file.</p><p>The real bread and butter of your package.json as mentioned before is in your dependencies. We have key and value pairs listed in JSON format that explains package names and versions of packages that we will be using in our application. When we are to run the command “NPM Install” it would actually look at our package.json file and will use that as a way to know what packages your program needs to download to work properly. In addition, if any of the packages you downloaded have dependencies, the package.json file in that application will also download the files and libraries it needs to run properly.</p><p>Please not there are two types of dependencies that you will be installing in your package.json file. Regular dependencies are going to be under “Dependencies”. All this means is that your app needs, or relies on these packages in order to run. They are to be installed and will be included in the build process for when your app goes into production mode. If your app can&#39;t function without a library, chances are it should be located under these type of dependencies. By default the Npm Install command will save any library install as a regular dependency.</p><p>Dev Dependencies on the other hand are applications that we only need around the environment that we are creating our code in. This can mean things like linter, code highlighters, or applications that run on your terminal and even debuggers. Put these inside your dev dependencies because you don’t need these tools to make it out into production. These are solely for creating your code, not implementing it into the outside world.</p><p>As we can see the package.json file is something that enables us to keep our applications and the code they depend on very structured. We keep our code modular, sustained, and written with proper configurations thanks to things like the package.json file.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f9016a832a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is CommonJS?]]></title>
            <link>https://medium.com/@tro12185/what-is-commonjs-f12dd53818cf?source=rss-e6712c45cb8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f12dd53818cf</guid>
            <dc:creator><![CDATA[Troy Gooden]]></dc:creator>
            <pubDate>Sun, 23 Feb 2020 07:40:35 GMT</pubDate>
            <atom:updated>2024-12-03T05:37:55.835Z</atom:updated>
            <content:encoded><![CDATA[<p>CommonJS is a format that revolutionized how we modularize JavaScript applications, making it simple and efficient to import and use modules. By breaking our programs into smaller, reusable pieces, JavaScript has evolved into a more manageable and structured language.</p><p><strong>The Evolution of JavaScript Modularization</strong></p><p>Initially, JavaScript relied on <strong>script tags</strong> in HTML documents to import functionality. While functional, this approach had significant limitations. Code became unorganized, difficult to reuse, and exposed to the global environment, leading to potential bloating and even security risks. Libraries loaded via script tags would attach their code to the global window object, creating an environment that was both cluttered and prone to conflicts.</p><p><strong>Attempts to Solve the Global Scope Problem</strong></p><p>To mitigate these issues, developers turned to techniques like <strong>wrapper functions</strong> and <strong>IIFE (Immediately Invoked Function Expressions)</strong>. These methods helped isolate code, reducing its impact on the global scope. However, they introduced new challenges:</p><p>• <strong>Load Order Dependencies</strong>: Scripts needed to be loaded in the correct order to prevent applications from breaking.</p><p>• <strong>Global Scope Pollution</strong>: Some functions and variables could still leak into the global namespace.</p><p>• <strong>Naming Collisions</strong>: Libraries could inadvertently overwrite each other’s functions or variables, creating maintenance headaches.</p><p><strong>The Rise of CommonJS</strong></p><p>As JavaScript grew, the <strong>module.exports</strong> pattern emerged as a solution to these challenges. By leveraging CommonJS, developers could define and share libraries without polluting the global scope. This system allowed for explicit <strong>require</strong> statements to include modules, eliminating naming collisions and ensuring greater control over dependencies.</p><p><strong>The Benefits of CommonJS</strong></p><p>With CommonJS integrated into the JavaScript ecosystem, developers gained:</p><p>1. <strong>Explicit Module Management</strong>: Applications could specify which files and modules to use, reducing ambiguity and improving maintainability.</p><p>2. <strong>Code Bundling</strong>: Tools like Webpack or Browserify made it possible to bundle modular code into a single file, optimizing performance for production.</p><p>3. <strong>Structured File Systems</strong>: Developers could organize projects systematically, ensuring that libraries were only included where needed.</p><p><strong>Conclusion</strong></p><p>CommonJS has transformed how JavaScript handles modularization, providing a robust system for creating, sharing, and managing code. It has helped JavaScript evolve into a cleaner, more efficient language, paving the way for modern frameworks and tools to flourish.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f12dd53818cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Testing in Javascript introduction]]></title>
            <link>https://medium.com/@tro12185/testing-in-javascript-introduction-dfce9357b964?source=rss-e6712c45cb8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfce9357b964</guid>
            <dc:creator><![CDATA[Troy Gooden]]></dc:creator>
            <pubDate>Mon, 10 Feb 2020 04:50:56 GMT</pubDate>
            <atom:updated>2020-02-10T04:50:56.375Z</atom:updated>
            <content:encoded><![CDATA[<p>When making applications we can sometimes forget that when it comes to big apps , we need ways to make sure our program is going to execute in the ways that we tell it. When it comes to testing we need to make tests that can be ran, so that the functions will have the right inputs, outputs, we can even check to see if a function exists or not in our programs. I’m going to describe a couple of ways of implementing tests in your JavaScript application.</p><p>The usual kind of tests when it comes to programming with JavaScript consist mainly of unit tests, integration tests , and UI tests.</p><h3>Unit Testing</h3><p>With unit testing we want to cover our smallest portion of code as possible. We test functions to check their inputs and whatever the outputs should also be. You should get into the habit of using pure functions in your code because they become easier to test the more and more you use them. You want to consider all edge cases when writing the tests for these functions.</p><h3>UI Testing</h3><p>Your UI tests usually are things that are browser specific when it comes to JavaScript. Our UI test need to give us a real life account of what a user does with your application, this could be something such as typing, clicking on an item, viewing new components on the web page, scrolling and many of the other interactions on a page. We need to take into account the versions of JavaScript being ran on a users machine and even the browser of their choice. We want to be able to recreate the whole user experience of what would be viewed in their browsers.</p><h3>Integration Testing</h3><p>As our applications get bigger we introduce the possibilities of breaking other parts of our code base. Because some implementations of code can be modular, it’s quite common that parts of your code will depend or alter how other parts of your application will function. With integration testing we are able to find bugs introduced once you change function “x” or add a library that now broke a certain part of your program.</p><h3>Summary</h3><p>By writing clear, maintainable, and concise tests that look for the many different ways which your program should perform, we decrease the chances of breaking vital parts of our applications. Also by using different workflows such as test driven development, we overall take the proper precautions to create beautiful, scalable applications.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfce9357b964" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Excellent extensions for your javascript development]]></title>
            <link>https://medium.com/@tro12185/excellent-extensions-for-your-javascript-development-29092486baf2?source=rss-e6712c45cb8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/29092486baf2</guid>
            <dc:creator><![CDATA[Troy Gooden]]></dc:creator>
            <pubDate>Mon, 03 Feb 2020 06:01:14 GMT</pubDate>
            <atom:updated>2020-02-03T08:19:35.902Z</atom:updated>
            <content:encoded><![CDATA[<p>When you are developing in any language chances are you will be using an editor to put together and structure your code. The editor of my choice happens to be VS CODE and I want to introduce some extensions that will help when it comes to helping you with your development.</p><h3><strong>ESLINT</strong></h3><p>This extension is golden, just in the sense that it checks your code, and it knows exactly what you are trying to write syntax wise. A linter in general will help you know when you are writing code improperly, which also means less errors, or unknowns that happen when your code is written properly.</p><h3><strong>GITLENS</strong></h3><p>When creating large applications we usually we use a version control system that will help show us all the iterations of our code. Gitlens happens to be an extension that taps into git to let you see the actual times, lines, and information of commits on a repository you are currently working on.</p><h3><strong>PRETTIER</strong></h3><p>One thing about your code is that you want to make sure it is human readable. With prettier you are able to structure your code in a way with predetermined indentations and spacing. It makes your code way more readable, and it keeps your projects looking very nice. Prettier is something that you can have structure your code every time you save a file or just</p><h3><strong>AUTO CLOSE TAG</strong></h3><p>When using libraries such as react, or even if you are just marking up regular html you want to use auto close tag to help with having to not type out opening and closing tags all the time. It is just a little less code to write but it is a big help.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29092486baf2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>