<?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 Phil Sheridan on Medium]]></title>
        <description><![CDATA[Stories by Phil Sheridan on Medium]]></description>
        <link>https://medium.com/@philrsheridan?source=rss-e1d78c5ecba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QOR7ZjPSMuVMQqGiBnsGyw.jpeg</url>
            <title>Stories by Phil Sheridan on Medium</title>
            <link>https://medium.com/@philrsheridan?source=rss-e1d78c5ecba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 11:49:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@philrsheridan/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[Flatiron Phase 5: Images]]></title>
            <link>https://philrsheridan.medium.com/flatiron-phase-5-images-9a206568ef32?source=rss-e1d78c5ecba------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a206568ef32</guid>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[image]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Phil Sheridan]]></dc:creator>
            <pubDate>Mon, 04 Nov 2024 18:19:08 GMT</pubDate>
            <atom:updated>2024-11-04T18:19:08.581Z</atom:updated>
            <content:encoded><![CDATA[<p>Before I begin, here is some background on my final project for Flatiron. I work in IT, and we use a software called TeamDynamix for our CRM. Like other CRMs, TeamDynamix is a way of managing client requests. These systems are most useful with as much information as possible: username, email, phone, time/date, title, description, tags, etc. For my final project I wanted to see if I was at a point where I could create my own version, loosely based off of other CRM systems I had seen in the past. I spend a few weeks designing the app, working through small hurdles to make everything organized and work fluidly. Some of these problems included integrating a search bar to search for existing tickets by title, tag, or requestor, managing queues that tickets are assigned to, that users can also assign themselves to to view in their homepage, and most prominently adding images to tickets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*VArNfqft0Zm3EYd14-FM0g.gif" /><figcaption>Searching for tickets by client username</figcaption></figure><p>Images were the last feature I added to my project. I waited until the end because I knew this was going to be filled with code that I had not had to work with in the past. After looking online, all of the options I came across seemed daunting. I did eventually find a solution that would work for my project, though implementation was not as easy as I expected. The biggest point of confusion was that I would need to store my images in a folder outside of my database. I chose this route because of the size and complexity of images compared to the rest of the data being stored, which would have caused my app to slow down considerably after storing many images.</p><pre>#server/models.py<br>class Image(db.Model, SerializerMixin):<br>    __tablename__ = &#39;images&#39;<br><br>    serialize_rules = (<br>        &#39;-ticket&#39;,<br>    )<br><br>    id = db.Column(db.Integer, primary_key=True)<br>    file_path = db.Column(db.String, nullable=False)<br>    ticket_id = db.Column(db.Integer, db.ForeignKey(&#39;tickets.id&#39;), nullable=False)<br><br>    # Relationships<br>    ticket = db.relationship(&#39;Ticket&#39;, back_populates=&#39;images&#39;)</pre><p>Shown above is my Image model. Notably, each image is assigned to a ticket and contains a file path (server/images/’image-name’). This is all that the database needs to reach the correct image. For example, assume there is a ticket that has one or more images assigned to it:</p><pre> #server/app.py<br>  def get(self, ticket_id):<br>        images = Image.query.filter(Image.ticket_id == ticket_id).all()<br><br>        if not images:<br>            return {&#39;error&#39;: &#39;No images found&#39;}, 404<br><br>        memory_file = io.BytesIO()<br>        with zipfile.ZipFile(memory_file, &#39;w&#39;) as zf:<br>            for image in images:<br>                file_path = f&quot;{app.config[&#39;UPLOAD_PATH&#39;]}/{image.file_path}&quot;<br>                if os.path.exists(file_path):<br>                    zf.write(file_path, image.file_path)<br>                else:<br>                    return {&#39;error&#39;: f&#39;Image not found at {file_path}&#39;}, 404<br><br>        memory_file.seek(0)<br><br>        return send_file(memory_file, download_name=&#39;images.zip&#39;, as_attachment=True) </pre><p>This is the code that is called when loading the images section of a ticket. Immediately, the image paths are found by querying Images with a specified ticket_id. If there are images, a memory_file is initiated to house a zip file. A new zipfile is initiated as zf and if the file_path exists, the full image path and its file_path (name) are added to the zipfile. Finally, the memory_file is directed to the start of the zipfile in memory with memory_file.seek(0) before the data is sent. The data is sent with send_file(memory_file, download_name=&#39;images.zip&#39;, as_attachment=True) This line sends the data to the client as an attachment, images.zip.</p><pre>  function getImages() {<br>    if (ticket.images.length === 0) {<br>      return<br>    }<br>  <br>    fetch(`/images/${ticket.id}`)<br>      .then(response =&gt; response.blob())<br>      .then(blob =&gt; {<br>        const zip = new JSZip()<br>        return zip.loadAsync(blob)<br>      })<br>      .then(zip =&gt; {<br>        const imagePromises = []<br>        zip.forEach((relativePath, file) =&gt; {<br>          imagePromises.push(<br>            file.async(&quot;blob&quot;).then(content =&gt; {<br>              const objectUrl = URL.createObjectURL(content)<br>              return { url: objectUrl, name: relativePath }<br>            }))<br>        })<br>        return Promise.all(imagePromises)<br>      })<br>      .then(imageData =&gt; {<br>        setImages(imageData)<br>      })<br>      .catch(err =&gt; {<br>        console.error(&#39;Error fetching and unzipping images:&#39;, err)<br>      })<br>  }</pre><p>Finally, in the front-end, the code above shows how the zip file is requested and saved. First, the request is converted to a Blob which stores large binary objects. In this block: <br>.then(blob =&gt; { const zip = new JSZip(); return zip.loadAsync(blob) }) The blob is asynchronously saved as a JSZip object promise of images. Within the forEach statement, a file url is created for the image content so it can be displayed in a browser. Once all the imagePromises have been added, and the images have processed <br>return Promise.all(imagePromises) returns the useable data to be assigned to the Images state.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*pFF0eNZtaA31q7HDAmo9wQ.gif" /><figcaption>Submitting, viewing, and deleting images.</figcaption></figure><p>Prior to implementing this code, I was unfamiliar with most of this process. However, learning how to create a zip file in memory and transfer that data to the client was extremely interesting and presumably valuable for the future. A key requirement of this project was to implement something we had not used in the Flatiron curriculum, and I thought this would be a perfect example of a new skill to put to the test. I thoroughly enjoyed learning to create applications like this one during my time in Flatiron.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a206568ef32" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flatiron Phase 4: Full-Stack]]></title>
            <link>https://philrsheridan.medium.com/flatiron-phase-4-full-stack-6a1f4b3a48c2?source=rss-e1d78c5ecba------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a1f4b3a48c2</guid>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[sqlalchemy]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[flask]]></category>
            <dc:creator><![CDATA[Phil Sheridan]]></dc:creator>
            <pubDate>Tue, 24 Sep 2024 15:57:57 GMT</pubDate>
            <atom:updated>2024-09-24T15:57:57.458Z</atom:updated>
            <content:encoded><![CDATA[<p>Phase 4 of Flatiron was dense and covered a wide range of topics that opened my eyes to the nature of full-stack development. I found myself drowning in new words, trying to understand new tools, and desperately needing to review. After getting a grip on the content of this phase, I loved how cohesively everything came together. Writing code in Python and JavaScript back-to-back has become much more natural than earlier in the course, and I found I was easily picking up new workflows, and repeatedly iterating.</p><p>The most difficult part of this phase for me was understanding the bridge between SQLAlchemy models and React fetch requests. It wasn’t until I started building my final project that everything started to click, and I was able to add, or change my models and their corresponding requests. That being said- nothing is fluent, and the language used for these relationships is still often difficult to grasp. The more complex my projects become, the more I understand that coding in full stack requires attention, or at the very least detailed notes.</p><p>My final project for Phase 4 of Flatiron is called DayList. The main files I want to focus on are models.py, app.py, and specific fetch requests from any .js file. The models file contains the skeletons of all the objects used in the app: user, calendar, note, and user_calendar. Each of these models contain relationships to each other: calendars have notes, users have calendars, etc. I struggled to understand how to initialize these relationships for a long time and came to understand that there are multiple ways of creating them.</p><p>Because calendars in my app can be shared between users, I needed to create a many-to-many relationship between users and calendars.</p><pre>class User_Calendar(db.Model, SerializerMixin):<br>    __tablename__ = &#39;user_calendars&#39;<br>    serialize_rules = (&#39;-user.calendars&#39;, &#39;-calendar.users&#39;)<br><br>    user_id = db.Column(db.Integer, db.ForeignKey(&#39;users.id&#39;), primary_key=True)<br>    calendar_id = db.Column(db.Integer, db.ForeignKey(&#39;calendars.id&#39;), primary_key=True)<br>    permission = db.Column(db.String, nullable=False)<br><br>    user = db.relationship(&#39;User&#39;, back_populates=&#39;calendars&#39;)<br>    calendar = db.relationship(&#39;Calendar&#39;, back_populates=&#39;users&#39;)<br><br>    def __repr__(self):<br>        return f&#39;&lt;User_Calendar {self.calendar_id}&gt;&#39;</pre><p>Above is the User_Calendar model used to bridge the user and calendar models together. This table has two primary keys, both of which are required making it a “join-table”. When a calendar is created, itself and the current user are added to a new User_Calendar (by default, the user is set as an owner). When a calendar is shared, a new User_Calendar is created with the existing calendar_id and user_id. By setting the cascade property to of the relationships associated with the Calendar model to cascade=`all, delete-orphan`, the calendar will delete any Notes, or User_Calendars associated with itself on deletion.</p><p>After finally completing my models, I found that interacting with them was extremely intuitive. Multiple times, I needed to change or add an attribute of a model and was easily able to add it and upgrade my database to match. Flask RESTful methods were easy to create and allowed me to customize what was returned by the request easily. Similarly to building models, the User_Calendar methods were slightly confusing before fully understood the logic behind them:</p><pre>    def get(self, calendarID):<br>        shared_user_ids = []<br>        shared_users = []<br><br>        user_calendars = User_Calendar.query.filter(User_Calendar.calendar_id==calendarID).all()<br>        for relationship in user_calendars:<br>            shared_user_ids.append(relationship.user_id)<br><br>        for user_id in shared_user_ids:<br>            this_username = User.query.filter(User.id == user_id).first().username<br>            this_permission = User_Calendar.query.filter(<br>                    User_Calendar.user_id == user_id and<br>                    User_Calendar.calendar_id == calendarID).first().permission<br><br>            shared_users.append(this_username + &quot;: &quot; + this_permission)<br>        return shared_users, 200</pre><p>In the code above, I specifically wanted to retrieve a string of the username, and permission level of a user to a calendar. To do this, I found all the User_Calendars associated with a given calendar and created a list of those User_Calendar user_ids. Using these user_id’s, I was able to find the username of the user, and permission level of the user through two more queries. I returned the agglutinated strings in a list called shared_users. This list is displayed when the user opens the sharing menu of a calendar.</p><p>Like each phase of Flatiron School, this phase has opened my eyes to so many new possibilities. I am at a point in my journey where I feel confident in creating almost anything I could think up. Through lulls of imposter syndrome, I am extremely proud of what I have learned and am excited to finish off the next phase and to build a portfolio.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a1f4b3a48c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flatiron Phase 3: SQL]]></title>
            <link>https://philrsheridan.medium.com/flatiron-phase-3-sql-ae75ce93481e?source=rss-e1d78c5ecba------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae75ce93481e</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Phil Sheridan]]></dc:creator>
            <pubDate>Mon, 13 May 2024 14:19:03 GMT</pubDate>
            <atom:updated>2024-09-23T19:42:51.045Z</atom:updated>
            <content:encoded><![CDATA[<p>SQL is a critical tool for organizing and managing databases. SQL provides an easy way to parse, modify, and link data between different tables. Most of the functions provided by SQL could be performed in Python or R alone, but these languages are not designed with that specific purpose in mind. SQL is a powerful and lightweight tool, making it ideal for large and constantly changing datasets.</p><p>For our purposes, SQLite was used to maintain a database that did not require an external host. SQLite is a lightweight C-library that is generally used for internal data storage of applications. Most importantly, the SQLite module allowed us to manipulate our databases directly within the terminal.</p><p>For most applications, SQL is a great method of sharing data. We use relational databases when data from one table needs to be directly accessible to another table. The easiest way to visualize this connection was through the many real-world examples used throughout phase 3 of Flatiron. For example, companies are strategically divided into a system of hierarchy to ensure a system of checks and balances at every level. These hierarchies typically employ a range of departments, each with managers supervising lower employees. In Python, and other object-oriented programming languages, we are taught to create objects to represent these real-world dynamics. For our example, a department, and an employee. An employee object could have attributes including but not limited to an ID, name, job title, salary, and crucially a department. Most of these attributes would be unique to the employee, however in a SQL database, the department ID could directly reference a department instance to allow for a one-to-many relationship.</p><p>An organized database can be useful on its own, but the options for data manipulation past this point are endless. Python is a powerful tool for creating object-oriented applications as was mentioned above, but these objects can be modeled and stored directly within a database. This is called object-relational mapping. Within python, we were able to execute SQL commands abstracted into methods that can be used repeatedly with constantly changing data. This collaboration allowed us to create applications for interacting with our data, such as locating the employees under each manager (as they continually change) or creating new employees.</p><p>My final project for phase 3 was a typing game. This idea is not novel, but the implementation was unique and surprisingly coherent. My models included a User, Test, and Sentence. Tests stored tests taken by users (which always include a sentence) these are two examples of one-to-many relationships as mentioned above. A user would be prompted to re-type a given sentence, their words-per-minute (WPM) would be recorded and weighted against the length of the sentence, and the Test would be saved alongside the user’s statistics.</p><p>One aspect of object-relational mapping (ORM) that confused me was the organization of the methods in my code. I broke my command-line interface (CLI ) application into 3 main sections: CLI, Helpers, and Models. The CLI was meant to contain only the menu options for each page, this means it would display the options in the command prompt, and directly call a helper method from Helpers. The helper methods were much more dense, containing most of the math and secondary prompts (any user inputs aside from menus). Helpers were also responsible for calling object methods. These methods were majorly SQL commands wrapped in methods, though there were some cases where I implemented instance methods to properly compartmentalize my code. As I wrote more and more methods for my project, I found myself becoming disorganized with where my methods lived. Some code that should have been in helpers was being written in CLI and helpers were calling class methods. Nearing the end of my project, I found myself spending time re-organizing and often re-writing these methods to ensure they were in the proper file. Below is breakdown of a method that I had to rewrite in the helpers module:</p><pre># Countdown to test, and initialize test instance<br>def begin_test(username):<br>    cprint(&quot;\n&quot;&quot;3...&quot;, &quot;red&quot;)<br>    time.sleep(1)<br>    cprint(&quot;\n&quot;&quot;2...&quot;, &quot;yellow&quot;)<br>    time.sleep(1)<br>    cprint(&quot;\n&quot;&quot;1...&quot;, &quot;white&quot;)<br>    time.sleep(1)<br>    cprint(&quot;\n&quot;&quot;GO&quot;&quot;\n&quot;, &quot;green&quot;)<br>    test(username)<br>    cprint(&quot;\n&quot;&quot;Press ENTER to return to the menu...&quot;, &quot;light_blue&quot;)<br>    input(&quot;&gt; &quot;) test_sentence.id)</pre><p>The code above is the countdown to taking a test. This block could have lived in either module, cli or helpers. I decided to keep it next to the main test block to keep the code as readable as possible.</p><pre># Select a random test sentence, start a timer, prompt input, end timer <br># Calculate time, accuracy, and wpm; create a new test with data<br>def test(username):<br>    #intitialize test variables<br>    user = User.find_by_name(username)<br>    sentences = Sentence.get_all()<br>    test_sentence = sentences[random.randint(0, (len(sentences)-1))]<br>    test_string = test_sentence.string<br><br>    #run test<br>    cprint(f&quot;{test_string}&quot;&quot;\n&quot;, &quot;yellow&quot;, attrs=[&quot;bold&quot;, &quot;underline&quot;])<br>    time.sleep(.2)<br>    start = time.time()<br>    user_input = input()<br>    end = time.time()<br>    test_time = round((end - start), 1)<br>    <br>    #calculate misses, accuracy, and wpm<br>    test_string_length = len(test_string)<br>    user_input_length = len(user_input)<br>    if test_string_length &gt; user_input_length:<br>        diff = test_string_length - user_input_length<br>        user_input += &quot;#&quot;*diff<br>    elif user_input_length &gt; test_string_length:<br>        diff = user_input_length - test_string_length<br>        test_string += &quot;#&quot;*diff<br>    misses = sum(1 for a, b in zip(test_string, user_input) if a != b)<br>    accuracy = round((((test_string_length-misses)/test_string_length)*100), 1)<br>    wpm = round((((test_string_length/5)/(test_time/60))*(accuracy/100)), 1)<br>    <br>    #display results<br>    cprint(&quot;\n&quot;&quot;      Test Results:      &quot;&quot;\n&quot;, attrs=[&quot;underline&quot;])<br>    if wpm &gt; user.record_wpm():<br>        cprint(f&quot;       WPM: {wpm} WPM (PB)&quot;, &quot;light_yellow&quot;)<br>    else:<br>        cprint(f&quot;       WPM: {wpm} WPM&quot;)<br>    print(f&quot;      time: {test_time}s&quot;)<br>    print(f&quot;  accuracy: {accuracy}%&quot;)<br><br>    #create Test instance with values<br>    Test.create(user_input, test_time, accuracy, wpm, user.id, test_sentence.id)</pre><p>Above is the code for a test in my application. This block is responsible for selecting a random sentence from the database, prompting the user for an input (repeating the sentence and recording the total time), and calculating all the user’s statistics. This was originally written in the cli because of the number of prints to the terminal, however the calculations and calls to the Test object caused me to rethink this decision. Any method that referenced an object method was likely making use of SQL. In this example, the final line of code is creating a new Test instance with all of the data collected.</p><p>Coming from learning React in JavaScript, Python and SQL were a breath of fresh air. These two environments are very similar but there was a great deal of control and ease of use that came with Python that I enjoyed. Initially I had a hard time restructuring my thinking to work with these datasets, but over time the workflow began to make much more sense. I am excited to see what is to come for the final two phases of Flatiron school.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae75ce93481e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flatiron Phase 2: useEffect()]]></title>
            <link>https://philrsheridan.medium.com/flatiron-phase-2-useeffect-e6ca4f023048?source=rss-e1d78c5ecba------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6ca4f023048</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[useeffect]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Phil Sheridan]]></dc:creator>
            <pubDate>Fri, 08 Mar 2024 18:51:04 GMT</pubDate>
            <atom:updated>2024-03-08T18:51:04.484Z</atom:updated>
            <content:encoded><![CDATA[<p>useEffect is a React hook that allows users to perform side effects. These side effects are triggered by re-renders of the component. useEffect takes two arguments, a function and optional dependencies that effect when the code runs. When useEffect is not passed a dependency, it will run on each render. An empty array will trigger useEffect only on the first render, and an array populated with props or state variables will run on the first render, and any time the dependency values change. Being able to run code specifically when a variable is updated allows for dynamic changes to an application when an event is triggered, or when state changes, i.e. a timer/clock is updated.</p><pre>//run each time the page is rendered.<br>useEffect(() =&gt;{})<br><br>//run only on the initial render.<br>useEffect(() =&gt;{}, [])<br><br>//run on the initial render, and when the listed dependencies are changed.<br>useEffect(() =&gt;{}, [timer, value…])</pre><p>useEffect was a critical aspect of my most recent project for phase 2 of the Flatiron schools software engineering program. The most valuable use case I found with useEffect was the ability to set the state of a variable and trigger a side effect that uses that updated value after the page is re-rendered. My application is a wishlist that can be edited and filtered by many values. The values that I am filtering for are stored in state, and on clicking an option I expect the list of items in the wishlist to update their order/appearance in some way. The clicking is handled by an event-listener, which updates state of filterArg (used to store the value I want to filter by: name, price, or necessity). When the state is updated, the page re-renders and useEffect is triggered. My useEffect function in this case sorts the items that will be displayed and sets the state of Items to the new sorted values. Below is an expanded version of the code from my wishlist application which outlines the function of each line.</p><pre>const handleFilter = (event) =&gt; { setFilterArg(event.target.textContent) }</pre><p>Above is the handler function for each of the buttons on the page. Each button has a different value used to change the order that the items are sorted in based on their values. filterArg is initialized as an empty string, meaning the items are sorted in the order they were added. Because filterArg is a state variable, updating it causes the component to re-render.</p><pre>useEffect(() =&gt;{<br> const tempItems = […items]<br> if (filterArg === &quot;Name&quot;) { tempItems.sort(compareName) } else <br> if (filterArg === &quot;Price&quot;) { tempItems.sort(comparePrice) } else <br> if (filterArg === &quot;Necessity&quot;) { tempItems.sort(compareCategory) }<br> setItems([…tempItems])<br>}, [filterArg])</pre><p>The useEffect hook above is triggered on the initial render of the component, and again each time filterArg is updated. To avoid mutating the original array, I copy the items variable using the spread operator first, and sort that copy. The <em>sort</em> method takes a value at an index of the array and compares that value to the index + 1. The comparison made is user defined, for example, compareName checks if the first letter the items name comes before or after the next item. After tempItems is sorted, items’ state is reassigned to the new value of tempItems.</p><pre>{items.filter(filterDeleted).map((item) =&gt; {<br> return ( &lt;ItemCard key={item.name} item={item} /&gt; )<br>})}</pre><p>Above is the portion of code that renders each item. ItemCard is a component used to format the details of each item into an organized card. The items are first filtered by their deleted values, then mapped to cards.</p><p>Initially, before implementing useEffect into this component, the list of items would only refresh when the page was manually refreshed. This happens because setting state is an asynchronous process. If the body of the useEffect hook was instead in the handleFilter function, the <em>sort</em> method would be running before state was updated. This would result in the list only updating when refreshed a second time, rather than <em>inline</em> with the filter button being pressed.</p><p>This project was extremely fun to put together. Learning to utilize react, and it’s many built in tools was eye opening. I once again found myself adding extra features and trying new things. While working, I recognized my growth in knowledge, workflow, and design. <strong>I cannot wait to keep moving forward.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6ca4f023048" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flatiron Phase 2: React]]></title>
            <link>https://philrsheridan.medium.com/flatiron-phase-2-react-b08f834b1908?source=rss-e1d78c5ecba------2</link>
            <guid isPermaLink="false">https://medium.com/p/b08f834b1908</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Phil Sheridan]]></dc:creator>
            <pubDate>Thu, 29 Feb 2024 16:39:58 GMT</pubDate>
            <atom:updated>2024-02-29T16:39:58.246Z</atom:updated>
            <content:encoded><![CDATA[<p>Phase 2 of the Flatiron school’s software engineering program has continued to be interesting and motivating. This phase built off of phase 1 by introducing React as a tool to use on-top of the JavaScript. React has taken much of the tedium out of creating a single-page website, though with being a powerful tool came some harsh learning curves. After learning the basics of React, I am curious to see the other tools that are commonly used in front-end development. I have read about many other tools that are commonly used along-side or in place of React, and I am curious to see how the skills I am learning now translate in the future.</p><p>Around the mid-point of this phase, I found myself with a familiar feeling of “imposter-syndrome”. The lesson was straight forward but required me to pass data to other components as props. This was covered in previous lessons, and while I thought I had grasped the concept well, this particular exercise intentionally left the component hierarchy up to the student. I struggled in deciding which component should contain the imported data’s state variable. State in React allows a component to individually update independent of the rest of the page. This feature takes a stale website and creates a dynamic environment capable of fluid movements and instant changes. However, state does not update in sync with the rest of your code. Because of this, I found myself in a mess of code; writing and re-writing function after function to get my application to update properly. The crux of my problems was sorting a list of item cards when an element was clicked. The function I had originally written would sort the items only after the page was refreshed (a feature not present natively on the site). Eventually after days of trial and error, I was able to successfully route the props of my components to update when requested, and my confidence was restored.</p><p>This lesson likely would have been completed the day I started it had I been able to clear my mind and re-analyze the structure of my code. I am finding more and more frequently in my work that a fresh pair of eyes are much more effective. Often times I will sit with a problem, trying time and time again to find a solution, only to immediately resolve it the next time I sit down to try. A skill I want to build over time is to be able to refresh my mindset and continue working without needing significant time to pass.</p><p>An application I have been using throughout my Flatiron journey is Obsidian. Obsidian is a markdown based text editor that facilitates saving organized notes across multiple devices. This software is majorly open-source, and users are encouraged to create their own extensions and CSS snippets to create the ideal work environment for themselves. There are many extensions for to-do lists, and wishlists, many of which I have tried, but I have always returned to pen and paper. I want to eventually develop a fully-fledged application that can be used in conjunction with Obsidian (potentially markdown based) for making lists. As I stated above, I am currently working on developing my workflow to prevent the need for long refresh periods when I am stuck. I feel that a listing/notetaking combination could facilitate this change.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*CgqSkGYV4jueCDVr7-Zp7w.gif" /><figcaption>Basic Wishlist Functionality</figcaption></figure><p>For my final project of phase 2, I made a wishlist application that allows a user to create a list of cards for items in a wishlist. I wanted to build off of the card style website we have been using throughout this phase. As someone who spends a great deal of time working on multiple devices, I wanted a tool that could help me stay organized when moving from location to location. On top of this, I am also the kind of person who until recently has always preferred handwritten notes. While I am not able to create the product I am looking for (yet), I wanted to design something useful that I felt fit into the same market. Items in my app are modular; can be edited, deleted and in-case something is accidentally deleted they can be restored from a recently deleted page. Additionally, these items can be sorted based on necessity, name, and their price.</p><pre>function handleDeleteRestore(event) {<br>  event.preventDefault();<br>//Create a temporary item (tempItem) to store a copy of the item being deleted/restored.<br>//Assign the negated value of .deleted.<br>  let tempItem = {…item}<br>  if (tempItem.deleted ) {tempItem.deleted = false} else<br>  if (!tempItem.deleted) {tempItem.deleted = true}<br>//PATCH the json file with the updated value.<br>  fetch(`http://localhost:3000/items/${item.id}`, {<br>    method: &quot;PATCH&quot;,<br>    headers: {&quot;Content-type&quot;: &quot;application/json&quot;},<br>    body: JSON.stringify(tempItem)<br>    })<br>  .then((response) =&gt; response.json())<br>//Map the updated item to items (state) using the same method.<br>  .then(() =&gt; setItems(items.map(thisItem =&gt; {<br>    if( thisItem.id === item.id ) {<br>      let tempItem = {…item}<br>      if (tempItem.deleted) { tempItem.deleted = false } else<br>      if (!tempItem.deleted) { tempItem.deleted = true }<br>      return tempItem }<br>    else { return thisItem }<br>   })))<br>}</pre><p>My biggest problem while making this project was a repeat bug. When creating new components that required a list updating (ItemList, DeletedList) my components would not re-render on an update. Manually refreshing these pages would show that the json file was receiving the correct updates, but for some reason or another I was struggling to make sense of the logic behind the state updates. Late in my development, I added both the deleted property to an item, and the DeletedList component. To utilize these features, an Item needed to be remapped to the json file with the deleted key being either true or false. This was simple; however, I was struggling to implement the mapping of state after the json file was updated as I did not want to re-fetch the data. If the item I was updating was not copied using the spread operator, the component would not update until the page was refreshed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*yEURA5fKvsWGpSK4K9P4Zw.gif" /><figcaption>Other Wishlist Features</figcaption></figure><p>This project was extremely fun to put together. I once again found myself adding extra features, cleaning up what was already particularly clean, and trying new things. While working, I recognized my growth in both knowledge, workflow, and design. <strong>I cannot wait to keep moving forward.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b08f834b1908" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flatiron Phase 1: Iteration]]></title>
            <link>https://philrsheridan.medium.com/flatiron-phase-1-iteration-ea9e57693af2?source=rss-e1d78c5ecba------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea9e57693af2</guid>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[education]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Phil Sheridan]]></dc:creator>
            <pubDate>Mon, 11 Dec 2023 21:29:08 GMT</pubDate>
            <atom:updated>2023-12-11T21:29:08.120Z</atom:updated>
            <content:encoded><![CDATA[<p>Phase 1 of Flatiron was an incredible journey for me, and I cannot wait to continue working through the next four phases. I loved the layout of this course. The workflow of using Canvas, GitHub and Visual Studio Code in tandem made the work feel real and extremely rewarding to complete. During Phase 1 I found myself falling slightly behind schedule due to the holidays and not having a device I could bring with me to get work done. I have recently picked up a Lenovo Slim 7 Pro to continue working on for the remained of the course and I am confident that this will help prevent any headaches I was running into previously. Working from two separate desktops (work and home), I found myself forgetting to commit my changes to GitHub and being stuck without my work. I found the material difficult but very well thought out and manageable. Any time I found myself getting stuck I was able to look back at previous modules or notes and eventually find my way. The hardest modules for me where the array methods. I fully understood the concept and function of these methods, however I needed to look up many examples of them online to figure out the best use cases.</p><p>I decided on a dictionary API for my Phase 1 project because I have a degree in Linguistics. I wanted to make an application that represented this side of my expertise. The free Dictionary API that I found made it easy to quickly draft some ideas. I knew I wanted to list every definition of the word, but quickly realized I would need a way to sort by part of speech because the API would return groups of results rather than one long list. This meant that verbs and adjectives were randomly thrown between nouns and prepositions. I also decided later on to add the ability to hide the lists of definitions by clicking the part of speech header because there were so many definitions for the words I was testing with. One of these words was “round” because it would return 6 different parts of speech, which was an excellent test for my grouping algorithm. I originally wanted to be able to view much more information about each word but found that the dictionary I was using didn’t have history/etymology for every word I was searching for. Rather than continuing with this idea, I decided to implement json-server to save a list of local favorites. Below is a .gif of the application using the word “test” as an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*vIUwzfXfrEDstiNGqg3ivg.gif" /></figure><p>This allowed me to save words like “round” to make sure each added feature wasn’t causing issues with the sorting algorithm or other features added later on like the phonetic transcriptions. The transcriptions were also added later on in the project, though they were not too difficult to implement because the API made them readily available. The following is a snippet from my phase 1 project. In this snippet I am iterating through the data returned from my API. Comments are included to outline what each chunk of code is doing:</p><pre>function reduceDefinitions (data) {<br>    let reducedDefinitions = {};<br>//reduceDefinitions takes one Object (data). This variable is the result of the API fetch. Below is an example of this json data:<br>//https://api.dictionaryapi.dev/api/v2/entries/en/test<br>//The function returns reducedDefinitions (an object of parts of speech paired with cooresponding definitions).<br><br>    data.forEach(function (fullGroup) {<br>//The API returns multiple results for each word (each result may have a mix of definitions of different parts of speech). This forEach statement <br>//itterates through each of these results. Each fullGroup is an Object containing 6 keys: license{}, meanings[{}, {}...], phonetic&quot;&quot;,<br>//phonetics[{}, {}...], sourceUrls[], and word&quot;&quot;.<br><br>        fullGroup.meanings.forEach(function (outputGroup){<br>            if (!Object.keys(reducedDefinitions).includes(outputGroup.partOfSpeech)) {<br>                reducedDefinitions[outputGroup.partOfSpeech] = [];<br>            };<br>//Each outputGroup is an array of objects (each object cooresponding to a part of speech) each containing n(definitions). The following if statement<br>//checks if the given part of speech is a key in reducedDefintions, then creates the key if not. <br><br>            outputGroup.definitions.filter(function (definitionObject){<br>                return reducedDefinitions[outputGroup.partOfSpeech].push(definitionObject)<br>//reducedDefinitions[part of speech] is then populated with the definitions matching that part of speech.<br>            });<br>        });<br>    });<br>    return reducedDefinitions;<br>};</pre><p>This section was by far the most challenging aspect of this project. There were many iterations of this function (some of which functioned the same as the final product), however, to ensure that the code was easily understandable I wanted to replace many of the for…in statements with forEach() or filter() array methods. These methods allowed me to initialize variables within the callback function rather than standalone within the for..in statements.</p><pre>fullGroup.meanings.forEach(function (outputGroup){...}<br><br>//rather than using:<br><br>for(let meanings in data[fullGroup].meanings) {<br> let outputGroups = data[fullGroup].meanings[meanings]; ...}</pre><p>My biggest takeaway from this project was to always be iterating. As a linguistics student, I wrote dozens of essays to earn my degree, and found myself in a very comfortable space with my style of writing. Because of this, I developed a “bad” habit of writing an initial outline of my paper, then going full bore deep dive into writing one singular “perfect” draft. I was never a fan of resting on my ideas or going back and editing my work because I was sure that my thought process from the start would not change even after stepping away and refreshing my mind. This process does not translate to coding. I found myself re-reading and, re-writing my code over and over in this project to get certain parts of my application working. I would remove full chunks of code and re-write them only to find that my initial attempt was almost identical to the new version (almost being the keyword). Even when I thought I was completely finished with my project, after diving back in I found that there were a few lines I could mitigate, or a variable that wasn’t needed. I am amazed at how this project was able to refine my workflow and I cannot wait to keep moving forward.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea9e57693af2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>