<?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 Morgan Collado on Medium]]></title>
        <description><![CDATA[Stories by Morgan Collado on Medium]]></description>
        <link>https://medium.com/@morgancollado?source=rss-491bb3069fef------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*W-1JhHre7TH_Aryergm-jQ.jpeg</url>
            <title>Stories by Morgan Collado on Medium</title>
            <link>https://medium.com/@morgancollado?source=rss-491bb3069fef------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 15:46:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@morgancollado/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[Testing or Tylenol for Future Headaches]]></title>
            <link>https://morgancollado.medium.com/testing-or-tylenol-for-future-headaches-270937235ca8?source=rss-491bb3069fef------2</link>
            <guid isPermaLink="false">https://medium.com/p/270937235ca8</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[testing-framework]]></category>
            <category><![CDATA[jest]]></category>
            <dc:creator><![CDATA[Morgan Collado]]></dc:creator>
            <pubDate>Thu, 06 May 2021 22:40:09 GMT</pubDate>
            <atom:updated>2021-05-06T22:42:33.871Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the first things I had to do at MyFitnessPal was write a component that logs out a user once they come to that page. Writing the logic to sign the user out was simple, mostly because Next Auth had already written that code and all I had to do was invoke their pre written function.</p><p>The hard part was writing tests to make sure that the component functioned as desired.</p><figure><img alt="White man sweating profusely looking nervous and fanning himself" src="https://cdn-images-1.medium.com/max/220/1*8aBoqKOR8PqnC8vAI2CWWQ.gif" /><figcaption>Me at the thought of writing these tests</figcaption></figure><p>I had never written tests before and I was extremely nervous. But this is the work! Encountering new technologies and figuring out how to integrate them into your current stack is one of my favorite parts of being an engineer. I spent the next few days pouring over <a href="https://jestjs.io/">Jest</a> and <a href="https://testing-library.com/docs/react-testing-library/intro/">React-Testing-Library</a> (RTL) documentation. These are libraries that work in concert allowing you to test how your components function.</p><p>But the problem that I was running into is that all the examples seems to assume that you would use Jest and RTL to make sure that certain DOM elements were rendered on the page. In my case, I wanted to ensure that the signOut function provided by Next Auth was called whenever the user found themselves on the page. I couldn’t find any resource that explicitly talked about testing function calls or how to write the test so that it invoked the function I wanted.</p><p>So, how to solve this problem? The first thing that I needed to do was use Jest to mock the entire module that I was working with, in this case Next-Auth/Client.</p><pre>jest.mock(&#39;next-auth/client&#39;)</pre><p>Once the module was mocked, I could call on the different functions within that module in my expect statements.</p><pre>expect(client.signOut).toHaveBeenCalled()</pre><p>Jest has a matcher named .toHaveBeenCalled and it does exactly as you would expect. It checks to see if the function was called. By creating a mockSession and rendering the LogOut component within the test, Jest and RTL is able to check if the function was invoked successfully.</p><p>It took a lot longer to figure out how to write the tests than to actually write the code itself. That being the case, why bother writing tests if you can check the behavior yourself in the browser?</p><p>We do this to make sure that the code functions regardless of changes made to the app. As you are growing more features and layering in new functionality, tests make it easy to check that the new things you built don’t break older parts of the app. And if they do, the tests can tell you right away what went wrong. This will prevent headaches down the line when you deploy a new feature and can’t seem to figure out why your user can’t log out of the app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*Q26iuFAemkbEbls5Ps8BSQ.gif" /><figcaption>Wow I feel it working already</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=270937235ca8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Programming; keeping people connected since 1950]]></title>
            <link>https://morgancollado.medium.com/programming-keeping-people-connected-since-1950-b79126b34997?source=rss-491bb3069fef------2</link>
            <guid isPermaLink="false">https://medium.com/p/b79126b34997</guid>
            <dc:creator><![CDATA[Morgan Collado]]></dc:creator>
            <pubDate>Thu, 22 Apr 2021 21:21:11 GMT</pubDate>
            <atom:updated>2021-04-22T21:21:11.675Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k1frLSyVoABnhINsB4z-zQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k1frLSyVoABnhINsB4z-zQ.png" /></figure><p>The Supplication App was my first foray into full stack web development. While not as refined as ZenDesk, it facilitates a function that makes the Internet so dang cool. Namely the ability to send messages across the web to be saved into a database and then reproduced for someone somewhere else. This magic is what has kept our world spinning through the pandemic and has offered a life line to so many people stuck in isolation even before COVID struck. It was access to this technology that kept me alive when I was younger and it is a marvel that I can now build it myself.</p><p>Constructing the logic for this project was much easier then it was for my CLI app. This is because Sinatra and ActiveRecord have so many short cuts built into it that allow one too quickly and easy create models, controllers and views.</p><p>ActiveRecord gives you the short cuts to create relationships between your models. It is sophisticated enough to create a model with a self-referential relationship. This allowed me to keep my code DRY and flexible so that the relationship between User and Ticket allowed a customer to edit only their tickets and an admin can respond to and edit all tickets. All of this done with a few lines of code. The rest of it was already written by the devs who make ActiveRecord.</p><p>Building the controller actions is simplified due to RESTful conventions. The routes operate the same across the industry, the only thing that changes is the specific views rendered and words associated with your particular app.</p><p>I even used software to build the file structure for my app with the Corenal gem.</p><p>What strikes me here is that there is so much code that we do not write ourselves that makes our lives easier. I knew on some level that developers had access to tools that would make software development easier but it really hit home on this project just how dependent we are on each other. If I had to write all the code in my project by hand, it would have taken me many more weeks.</p><p>Whenever I use metaprogramming, I need really dig deep to make sure that I know what is happening under the hood. There is still so much that I do not understand and while these shortcuts can be helpful it can obscure how the code works which makes it difficult to debug when it breaks. While magic is great, it is much more useful and gratifying to know how the technology works.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b79126b34997" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Enums or Whose String is it Anyway?]]></title>
            <link>https://morgancollado.medium.com/enums-or-whose-string-is-it-anyway-8abddb8f498a?source=rss-491bb3069fef------2</link>
            <guid isPermaLink="false">https://medium.com/p/8abddb8f498a</guid>
            <dc:creator><![CDATA[Morgan Collado]]></dc:creator>
            <pubDate>Tue, 13 Apr 2021 21:32:17 GMT</pubDate>
            <atom:updated>2021-04-14T02:55:08.111Z</atom:updated>
            <content:encoded><![CDATA[<p>One of the challenges that a junior developer faces is the problem of you don’t know what you don’t know. Case in point, I was meeting with my mentor this week, looking over a project that I had built and she asked me “Why didn’t you write this attribute as an Enum?”</p><p>To which I reply, “I don’t know her.”</p><figure><img alt="Mariah Carey shaking her head and saying, with a smile, “I don’t know her”" src="https://cdn-images-1.medium.com/max/430/1*YzjLce_3zL33G_Apb1EmrQ.gif" /></figure><p>Unlike Mariah, I do want to get to know her!</p><p>So, what are enums? <a href="https://api.rubyonrails.org/v5.2.5/classes/ActiveRecord/Enum.html">Enums</a> are a layer of abstraction given to us by ActiveRecord in Rails. It allows us to create a integer column on our model. Then, within the model, you can write the following code to map those integers to the whatever symbol you need within your code to be expressive.</p><pre>enum status: [:not_started, :initial_pickup, :clinic_dropoff, :clinic_pickup, :final_dropoff]</pre><p>In the above example, I have a column in my Rides model with a name of Status that is the data type of integer. The above code allows me to map the integer 0 to mean `:not_started`. So whenever I set the model’s attribute of status to :not_started, the database knows to save this data as the number 0. This is much more performant then using strings because the database doesn’t actually care about how we store the data. Using enum allows us to abstract these strings into integers which takes up less memory then the full string.</p><p>This allows us to control the attribute so that a user cannot input a string that is not anticipated and keeps our database fast.</p><p>You may be wondering where the <em>Whose Line is it Anyway?</em> reference is but much like the show, the blog is made up and title doesn’t matter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8abddb8f498a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Separating Concerns or Keeping Track of Who is Doing What]]></title>
            <link>https://morgancollado.medium.com/separating-concerns-or-keeping-track-of-who-is-doing-what-3d3f27afddc3?source=rss-491bb3069fef------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d3f27afddc3</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[redux]]></category>
            <dc:creator><![CDATA[Morgan Collado]]></dc:creator>
            <pubDate>Wed, 07 Apr 2021 13:56:05 GMT</pubDate>
            <atom:updated>2021-04-07T13:56:05.835Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="a code snippet showing some redux logic." src="https://cdn-images-1.medium.com/max/601/1*MJiS0B28LzGi7ocOqR-W1Q.png" /><figcaption>A slice of reducer, delicious.</figcaption></figure><p>For my capstone, I built one in a series of apps to help the hotline coordinators at the North Texas Abortion Support Network better coordinate their volunteer drivers to assist clients with getting rides to their appointments. NTXASN is a mutual aid program run by my spouse that helps people get connected to the logistical resources necessary to exercise their right to choose. Living in Texas, there are many barriers that keep people from accessing the care that they need. While technology cannot remove all of these barriers, it can help make sharing resources and getting connected with people more efficient. I wanted to partner with my spouse to leverage my newly acquired tech skills to help level the playing field. They helped me think through the initial feature set and the relationships between users and rides.</p><p>Getting started was difficult. I spent the first 3 days spinning my wheels trying to figure out how to get a Rails backend to allow sessions with a React front end. I was pointed to a very helpful video series by Howard, an instructor at Flatiron, that showed me how to go about doing this. I needed to configure my rails API to allows sessions by changing the cors.rb file to include credentials:true. I also needed to include ActionController::Cookies in the Application Controller because the api flag in rails new excludes this module from the controller. Cookies are necessary for session based authentication. Finally, I needed to change my application.rb file to include ActionDispatch middleware so which allows rails to store cookies. Then it was just a matter of writing the sessions controller like one would on a fully fledged Rails app.</p><p>With the backend configured, I turned my attention to building my front end. Understanding the way Redux supplies data to the React components was confusing at first but watching Howard build the app really helped improve my understanding. When we say mapStateToProps we are saying, “Take the state as defined in Redux and give it to the properties that you can then pass into the component to display to the user.” We can call this slice of state anything we want but we want to make sure that the variable name makes sense to make it easier for other devs to read and understand how the data is being manipulated. This is what initially confused me because I did not understand that we were declaring a variable like any other that points to a specific value in memory.</p><p>When we say mapDispatchToProps we are saying “Take the actions we can send to the store (in order to manipulate the store) and make it available to this component by passing it as a property.” This allows the component to fire actions that change Redux state. This makes our app dynamic and responsive as each time we update state in Redux, we update the data displayed within the component.</p><p>Abstracting this level of logic out of the components made it incredibly easy for me to style and change the components. Since I didn’t need to worry about each component managing its own state or keep track how my application state was changing across components from within the components themselves, I was able to take material UI templates and configure them to hold the values from Redux state. What took me a week to build from scratch, took me just a night too refactor to include the styling I wanted. It is incredible how this design pattern makes it easy to maintain and extend the front end. No wonder so many devs use it!</p><p>Redux is to Models in Rails as React is to the views. It is the application logic that powers the front end. By separating concerns, I can keep my code dry and easy to debug. Having everything in its place allows use to build increasingly complex systems without losing track of who is doing what or how data is being changed. Ensuring that all of my application data is one place gives me one source of truth that I can reference and makes the presentational components interchangeable. It gives us a frame of reference so that we can compile within our own minds how the application functions, giving us greater control over what we are writing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d3f27afddc3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[‘coding (what is it good for)’]]></title>
            <link>https://morgancollado.medium.com/coding-what-is-it-good-for-8672ddb361fe?source=rss-491bb3069fef------2</link>
            <guid isPermaLink="false">https://medium.com/p/8672ddb361fe</guid>
            <dc:creator><![CDATA[Morgan Collado]]></dc:creator>
            <pubDate>Wed, 31 Mar 2021 18:47:36 GMT</pubDate>
            <atom:updated>2021-03-31T18:47:36.122Z</atom:updated>
            <content:encoded><![CDATA[<p>Technology runs our modern lives. From connecting with family across the world to meeting basic survival needs like aquiring food, technology is the medium through which we navigate this world. I have always been a techy person, always keeping up with the latest developments in hardware and software. This was solidified by working for tech companies like Apple and TaskRabbit. Working to support techonology and its users have motivated me to learn how to build the tools that are used everyday by everyday people.</p><p>I want to leave the world better then I found it. Learning how to code seems to be a way to do this. With how ubiqutous software is in determining one’s life course and opportunities, I want to be in a position to inform the creation of those mechaisms to ensure nobody is left behind. Instead of just helping users troubleshoot apps, I want to be able to make those apps. I want to connect with other developers to see what they are building and how I can add to that. I want to chart a course for others to follow to increase economic opportunities for those in my community. Most of all, I want to leave behind a legacy that enriches all those that come in contact with it. I want to make life easier for people through technology and I want to create experiences that suprise and delight.</p><p>I am also a deeply curious person who wants to understand fundemtally how things work. I have a passion for learning and challenging myself to grow. Learning to code will satisfy that part of me that is always seeking new knowledge for its own sake.</p><p>I’m so excited to be embarking on this journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8672ddb361fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>