<?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 Christopher Ou on Medium]]></title>
        <description><![CDATA[Stories by Christopher Ou on Medium]]></description>
        <link>https://medium.com/@chrisou_56577?source=rss-bf8ce1acd585------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Christopher Ou on Medium</title>
            <link>https://medium.com/@chrisou_56577?source=rss-bf8ce1acd585------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 09:16:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@chrisou_56577/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[Phase 4 Blog]]></title>
            <link>https://medium.com/@chrisou_56577/phase-4-blog-2622533a1b5f?source=rss-bf8ce1acd585------2</link>
            <guid isPermaLink="false">https://medium.com/p/2622533a1b5f</guid>
            <category><![CDATA[flatiron-school]]></category>
            <category><![CDATA[rails]]></category>
            <dc:creator><![CDATA[Christopher Ou]]></dc:creator>
            <pubDate>Sun, 23 Oct 2022 23:37:39 GMT</pubDate>
            <atom:updated>2022-10-24T14:24:10.936Z</atom:updated>
            <content:encoded><![CDATA[<p>Here we are. Towards the end of Flatiron’s Phase 4. More than half way done and I’m excited. I think that every phase has knocked me down but to be honest, I’ve learned that it was more in my head than anything. I would have cohort-mates and friends ask “How did you do?” on the code challenge and I always said I wasn’t sure, I hope I pass. I passed every time, but I’m not here to show off because I did not get a perfect score in any of these code challenges but I wanted to show that even with my self doubt in every phase I was able to accomplish what I have up to this point. Imposter syndrome is real and I’m guilty of it.</p><p>Learning Rails was the same as Ruby but also different. We still needed to make tables, seeds, migrations, schema, routes, and everything we’ve been doing. Rails then added in new ways to help create those without typing too much.</p><p>rails g resource &lt;table_name&gt; entered in the terminal will create a new model, controller, table, and serializer(if you have the gem installed). After adding the following gem to the Gemfile you should run bundle install to install the gem that you just added. This was the gem I used :</p><p>gem “active_model_serializers”, “~&gt; 0.10.12”</p><p>With the rails g resource command it makes our lives a lot easier. An example of creating tables in the terminal would be:</p><p>rails g resource camper name age:integer</p><p>If you notice the name was left blank because it defaults to a string datatype. With age we have to specify the datatype by adding a colon and the datatype that fits. Once you press enter it should look something like this:</p><figure><img alt="Campers table" src="https://cdn-images-1.medium.com/max/728/1*b7BN8aT8BB-JXgOxrC3tNg.png" /><figcaption>Camper table</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*tqSuM3VErhIY75ns-770FQ.png" /><figcaption>Camper controller</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*Lu6IRpt22K8_S0vqKGWF-g.png" /><figcaption>Camper serializer(don’t forget this wont work with out the gem installed)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*hKJ0vjePThuIivcllFkYAg.png" /><figcaption>Camper class</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/488/1*fO04bg2AMP5mOu12KbDPeQ.png" /><figcaption>Routes for all the controllers</figcaption></figure><p>Isn’t that neat? All of this was created for us. Controllers deal with routing and rendering, models handle associations/holds value of a single row in a database table, serializers refactor code to avoid repetition/render multiple data models from a single controller/specify which attributes to render, and routes can recognize URLs and dispatch them to a controller’s action, and tables are set up to display the correct types of data so you can use CRUD to play around with that information.</p><p>I had an easier time in phase 4. When I’m towards the end of a long goal I tend to slow down and lose motivation. I hate it but it’s also normal from being burnt out. My tip for not being burnt out is to just always save time for yourself at the end of the day.</p><h3><strong>sources:</strong></h3><p><a href="https://www.educative.io/answers/what-are-serializers-in-ror">https://www.educative.io/answers/what-are-serializers-in-ror</a></p><p><a href="https://www.codegram.com/blog/routing-in-rails/">https://www.codegram.com/blog/routing-in-rails/</a></p><p><a href="https://codecabulary.launchacademy.com/learn-rails/writing-a-rails-model">https://codecabulary.launchacademy.com/learn-rails/writing-a-rails-model</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2622533a1b5f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phase 3 Blog]]></title>
            <link>https://medium.com/@chrisou_56577/phase-3-blog-14fbc1b4ae38?source=rss-bf8ce1acd585------2</link>
            <guid isPermaLink="false">https://medium.com/p/14fbc1b4ae38</guid>
            <category><![CDATA[phase-3-blog]]></category>
            <dc:creator><![CDATA[Christopher Ou]]></dc:creator>
            <pubDate>Mon, 03 Oct 2022 00:04:53 GMT</pubDate>
            <atom:updated>2022-10-03T14:31:40.541Z</atom:updated>
            <content:encoded><![CDATA[<p>After phase 2, I wasn’t going to make the same mistake. I went into phase 3-Ruby mentally prepared and I didn’t get over confident. I figured phase 2 React was just JavaScript with some new information so I didn’t need to study as hard but I was wrong. Entering phase 3 I did as much as I could for as long as my mind allowed. I even skipped meals because I was in the zone, but don’t learn that from me. I want you guys to learn tips and tricks that helped me get to this point.</p><p>As with every new phase I always do the fundamentals module so I have a basic grasp of how syntax works and since this was a new language it seemed more important to do so. Finishing up the Ruby fundamentals I felt confident, and I was conned yet again. The fundamentals were easy enough but working on Active Record was a challenge at first.</p><p>Associations were confusing. I think I took it too literally when thinking of real life situations. A normal way of thinking about it would be a restaurant has customers, then those customers write the reviews. The way we had to write it was the restaurant has reviews and has many customers through those reviews. Seems a bit odd to me. Depending on how you interpret it the associations could be wrong, thus making everything break.</p><blockquote><strong>How to figure out associations.</strong></blockquote><p>A friend helped me understand how to see the pattern better. If we had Restaurant, Review, and Customer classes, find the join table first. That join table <strong>belongs_to :the_other_two_classes</strong> and those will be singular.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*5Db4xG002nGfF4p056gwzw.png" /></figure><p>Then the class Restaurant will have <strong>has_many :join_table_class </strong>in<strong><em> </em></strong>plural and <strong>has_many :other_class_name, through: :join_table_class</strong> also in plural.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*D5Yw4laeNDcSYO5QULUyFQ.png" /></figure><p>The same is done for the Customer class. <strong>has_many :join_table_class </strong>and <strong>has_many :other_class_name, through: :join_table_class </strong>once again in plural.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*PRJEQpDeZnbuZZDoW9yJpQ.png" /></figure><blockquote><strong>My issues with seeding.</strong></blockquote><p>Seeds can be confusing and if it’s not confusing it can be annoying. Seeding is done so you are able to enter fake information if you want to test your aggregate methods. Without testing them you can still get everything to work but you would never know if your methods work correctly. Seeding is not required but highly recommended.</p><p>My issue with seeding was when I made a mistake and re-seeded, the ID wouldn’t line up again. If I had ID’s one through five and I had to re-seed, the ID’s would be continuous meaning it would be 6 through 10 now. A few ways to fix that is to delete the database, make changes, migrate, and seed again. Another way was a shovel method that I’m not too familiar with so I didn’t use it but I know it works, and lastly this link sent by my instructor <a href="https://github.com/splendeo/activerecord-reset-pk-sequence">https://github.com/splendeo/activerecord-reset-pk-sequence</a> which will do everything for you.</p><blockquote><strong>Aggregate methods</strong></blockquote><p>I had a lot of problems with the aggregate methods and still do. I need more practice with that but I am getting better at it. I’m still not familiar with what I need to do in certain cases and I can get some of the basic methods to work. There isn’t much I can help with on this subject but to keep working on it. There are many different ways to do this part but Google is your best friend here. You could find an easier/shorter way to write code you already know how to write or a totally different approach. That is for you to decide which you prefer.</p><p>One thing I did learn through Googling was that when I tried to call a method I wrote in another class it wasn’t working because I typed…</p><blockquote>Wrong code:</blockquote><p>“Review for #{Restaurant.name} by #{Customer.full_name}: #{star_rating} stars.”</p><blockquote>Right code:</blockquote><p>“Review for #{restaurant.name} by #{customer.full_name}: #{star_rating} stars.”</p><p>Notice the capitalization in the first example, which was wrong. The correct code was in lowercase and this way I called the full_name method from the Customer class instead of having to write first_name and last_name in place of full_name.</p><p>Next is the ActiveRecord tables and more specifically the data types. The tables are pretty simple in my opinion. This didn’t give me a hard time but I just wanted to share that there are a lot of other data types that we have yet to learn at this stage. Here are some new ones:</p><p><strong>:primary_key, :string, :text, :integer, :float, :decimal, :datetime,</strong></p><p><strong>:timestamp, :time, :date, :binary, :boolean</strong></p><p>ActiveRecord seemed hard when I was studying but now that I did all the practice code challenges twice it isn’t as bad as I thought. One week before the code challenge I was feeling a little depressed because I couldn’t get it to stick. I didn’t want to get out of bed to study and it was one of the only times I really thought of giving up. I bombed the mock code challenge too. I decided to get up and study until I couldn’t anymore. As I said earlier I even skipped meals so I had more time to study.</p><p>Bottom line, I’ve gone through many struggles to get to where I am. I still need a lot of work but the one thing I can say is to not give up. I was in a dark place during this phase and it was all psychological. I also wouldn’t have made it this far without some amazing people in my cohort that have helped me understand certain concepts. I want to see everyone continue to the finish line since it has been a long journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14fbc1b4ae38" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phase 2 Blog]]></title>
            <link>https://medium.com/@chrisou_56577/phase-2-blog-1ec3211a2004?source=rss-bf8ce1acd585------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ec3211a2004</guid>
            <dc:creator><![CDATA[Christopher Ou]]></dc:creator>
            <pubDate>Sun, 11 Sep 2022 21:48:33 GMT</pubDate>
            <atom:updated>2022-09-11T23:00:31.928Z</atom:updated>
            <content:encoded><![CDATA[<p>When I finished phase 1 of the Flatiron bootcamp I was so ready and confident going toe to toe with react. After a week of studying and lectures, React knocked me out. I was literally struggling till the Thursday before code challenge. I put my head down and did as many mock challenges as I could.</p><p>The challenges I faced during react was making me feel humiliated. React was throwing right hooks with components and props and I was getting hit in the face. What helped me the most was when our lecturer, Dakota, told us to make a diagram with all the components. Since I’m a visual learner I need to see how the hierarchy looks. Imagining it in my head never worked for me. He introduced a Visual Studio Code extension, Draw.io, but many people can also draw it with a pen and paper and doing so is definitely faster but I prefer Draw.io.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e9S7ZX4X5VlP_s-FINiiSw.png" /><figcaption><strong>Draw.io snippet to visually see the component Hierarchy.</strong></figcaption></figure><p>It took me a while to realize that the components themselves give us hints as to which component is the child component of App.js and which component is the child of those. Components residing in the App component are going to be children of App. In practice challenges where you might be given starter code it can look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*tUVWeqiCM97Iqw88QtJfQA.png" /></figure><blockquote><strong><em>Next step is to check each child to see if they have any children as well.</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*lko_5ch2oeFSFThArhvJ4Q.png" /><figcaption><strong>Nope, no component that we need here.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*x5VIw-Tm1EPNnjXPn75CnA.png" /><figcaption><strong>The PlaneteersContainer component has Planeteer as a child.</strong></figcaption></figure><p>My biggest struggle was learning information flow. It confused me trying to figure out how to pass data from parent to child and from child to parent. That’s very important in React and I kept getting knocked to the floor because I couldn’t grasp it. Seeing the pattern isn’t too hard but I wanted to understand it. As much as I got knocked down I was also able to learn some neat tricks to make React a little easier.</p><blockquote><strong><em>If I wanted to reuse any value, I learned to assign it to a variable like this:</em></strong></blockquote><pre>const planeteerUrl = &quot;http://localhost:8003/planeteers&quot;</pre><p>I can remember planeteerUrl but I won’t memorize the actual URL. Another reason is that it’s shorter to type and on top of that VS code will give you recommended words you have typed previously so you don’t even have to type out planeteerUrl.</p><blockquote><strong><em>This next example is something I thought only worked in if statements because that’s where I always saw it.</em></strong></blockquote><pre>const filterPlaneteers = planeteers.filter((planeteersFilter) =&gt; {</pre><pre>return planeteersFilter.name.toLowerCase().includes(search.toLowerCase()) || planeteersFilter.bio.toLowerCase().includes(search.toLowerCase())</pre><pre>})</pre><p>This code asked us to do a search function that looked in the key value pair of bio and name. I was originally going to use two <em>.filter</em> functions but I then remembered something my previous instructor said, <strong><em>“</em>coders are lazy<em>.”</em></strong> Funny but true since I searched on google and realized that I could use the <em>logical OR operator. </em>Thank you Tyler.</p><blockquote><strong><em>Eureka! I got tripped up on this code because I was going to use </em>useState<em> for this:</em></strong></blockquote><pre><em>planeteerProp</em>.fromUSA ? &quot;USA-based&quot; : &quot;Working overseas&quot;</pre><blockquote><strong><em>This is what shows in the API:</em></strong></blockquote><pre><em>&quot;fromUSA&quot;</em>: true</pre><p>My thought process was I needed<em> useState </em>because the DOM will be different depending on the information provided. But the reason for <em>useState</em> is when information changes then the DOM can be re-rendered. The information isn’t actually changing because it’s in the API this whole time as a boolean, true or false. Whichever value is assigned will not change thus, <em>useState</em> is not needed.</p><blockquote><strong><em>What will need a</em> useState<em> is this piece of code:</em></strong></blockquote><pre><em>const</em> [cardText, setCardText] = useState(true)</pre><pre>{cardText ? <em>planeteerProp</em>.bio : <em>planeteerProp</em>.quote}</pre><p>This code will render the bio information first. Once you click on the image, the information within “<em>planeteerProp</em>.bio” will be swapped with “<em>planeteerProp</em>.quote” and the <em>useState</em> will cause the DOM to re-render and show the wanted information.</p><p>React put me on the ground a few times. Enough to make me miss JavaScript but now that I have a decent grasp of how it works it isn’t so bad. I felt defeated more in phase 2 than I was in phase 1 but I got back up every time. For me the hardest part was information flow and how everything is sent up and down the parent and child. Once that obstacle is overcome the rest is stuff I already know.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ec3211a2004" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Phase 1 blog]]></title>
            <link>https://medium.com/@chrisou_56577/phase-1-blog-49d084095431?source=rss-bf8ce1acd585------2</link>
            <guid isPermaLink="false">https://medium.com/p/49d084095431</guid>
            <dc:creator><![CDATA[Christopher Ou]]></dc:creator>
            <pubDate>Thu, 25 Aug 2022 21:15:58 GMT</pubDate>
            <atom:updated>2022-08-25T21:15:58.111Z</atom:updated>
            <content:encoded><![CDATA[<p>Phase 1 was a tough one. There is so much to learn and the fast paced style didn’t help. I’m not complaining though. I knew what I signed up for and I was ready for the challenge. After I quit my job, I was lost as to what to do and that’s when I found coding.</p><p>Before I get into phase 1 I’ll go over some things I went over during the prework. I had 3 weeks from my start of the prework till the start of the cohort. I went through basic fundamentals of JavaScript. Practiced everything from syntax to arrays, objects to functions, and the last part of the prework was to build a personal webpage.</p><p>Most of the prework I did was instrumental in helping me get through phase 1. I had to learn new things but the prework definitely made it easier. In phase 1 I learned how to “fetch()”, use “addEventListener()”, render information with json data, learned the importance of scoping(certain things didn’t work without figuring that out), adding user information added by a form, and to me the most important thing of all was to keep doing practice work. By doing so I was able to recognize certain patterns and knew what to do. For a short while I never could remember the syntax of a “fetch().then” function but as time went by I have it memorized. I’m not an expert by any means and I still need a lot of help but I am more confident than I was on August, 8th.</p><blockquote><strong>Some issues with syntax that I struggled with when trying to populate the HTML with JSON data was remember the parenthesis in query selector, pound/hashtag symbol for id and period for class name:</strong></blockquote><pre><em>const</em> zodiacName = document.querySelector(&quot;#zodiac-name&quot;)</pre><pre>zodiacName.textContent = &quot;Western Zodiac: &quot; + <em>zodiacs</em>.name</pre><blockquote><strong>Here I would always add parenthesis when it wasn’t needed:</strong></blockquote><pre>fetch(&#39;http://localhost:3000/&#39;)</pre><pre>.then(<em>res</em> <em>=&gt;</em> <em>res</em>.json())</pre><pre>.then(<em>zodiacs</em> <em>=&gt;</em> <strong><em>()</em></strong> {</pre><pre>}</pre><blockquote><strong>Why I always thought I needed the parenthesis after the fat arrow operator is a mystery to me but I broke out of this bad habit:</strong></blockquote><pre>fetch(&#39;http://localhost:3000/&#39;)</pre><pre>.then(<em>res</em> <em>=&gt;</em> <em>res</em>.json())</pre><pre>.then(<em>zodiacs</em> <em>=&gt;</em> {</pre><pre>}</pre><blockquote><strong>My awesome instructor, Tyler, helped with making the code look more streamlined. He showed us the importance of a clean, short, simple code but it had to be balanced with readability:</strong></blockquote><pre><em>let</em> ramenInfo = (<em>data</em>) <em>=&gt;</em> {</pre><pre><em>const</em> name = document.querySelector(&quot;.name&quot;)</pre><pre>name.textContent = <em>data</em>.name</pre><pre><em>const</em> restaurant = document.querySelector(&quot;.restaurant&quot;)</pre><pre>restaurant.textContent = <em>data</em>.restaurant</pre><pre><em>const</em> image = document.querySelector(&quot;.detail-image&quot;)</pre><pre>image.src = <em>data</em>.image</pre><pre><em>const</em> rating = document.querySelector(&quot;#rating-display&quot;)</pre><pre>rating.textContent = <em>data</em>.rating</pre><pre><em>const</em> comment = document.querySelector(&quot;#comment-display&quot;)</pre><pre>comment.textContent = <em>data</em>.comment</pre><pre>}</pre><blockquote><strong>I separated code based on what they did within a function. I had to look up and down to see what my code was doing. It was a huge strain especially when compounded by code that wasn’t working. At first glance it definitely is shorter but harder to read. My code used to look like this:</strong></blockquote><pre><em>let</em> ramenInfo = (<em>data</em>) <em>=&gt;</em> {</pre><pre><em>const</em> name = document.querySelector(&quot;.name&quot;)</pre><pre><em>const</em> restaurant = document.querySelector(&quot;.restaurant&quot;)</pre><pre><em>const</em> image = document.querySelector(&quot;.detail-image&quot;)</pre><pre><em>const</em> rating = document.querySelector(&quot;#rating-display&quot;)</pre><pre><em>const</em> comment = document.querySelector(&quot;#comment-display&quot;)</pre><pre>name.textContent = <em>data</em>.name<br>restaurant.textContent = <em>data</em>.restaurant<br>image.src = <em>data</em>.image<br>rating.textContent = <em>data</em>.rating<br>comment.textContent = <em>data</em>.comment</pre><pre>}</pre><blockquote><strong>One obstacle I have yet to bulldoze through is the form. The hardest part for me was remembering what to write next. Everything in bold below is something I still need to memorize. Looking at the code now I know how to write it but if I were to do this again I can add certain parts and forget what comes next. It’s a slow process but I have made progress and I will continue to do so:</strong></blockquote><pre><em>const</em> newRamen = document.querySelector(&quot;#new-ramen&quot;)</pre><pre>newRamen.addEventListener(&quot;submit&quot;, (<em>e</em>) <em>=&gt;</em> {</pre><pre><em>e</em>.preventDefault()</pre><pre><em>const</em> id = allRamen[allRamen.length - 1].id + 1</pre><pre><em>const</em> userInput = {</pre><pre><strong><em>id: id,</em></strong></pre><pre><strong><em>name: e.target.name.value,</em></strong></pre><pre><strong><em>restaurant: e.target.restaurant.value,</em></strong></pre><pre><strong><em>image: e.target.image.value,</em></strong></pre><pre><strong><em>rating: e.target.rating.value,</em></strong></pre><pre><strong><em>comment: e.target[&quot;new-comment&quot;].value</em></strong></pre><pre>}</pre><pre>eachRamen(userInput)</pre><pre><em>e</em>.target.reset()</pre><pre>})</pre><p>I have learned a lot and met some great, dedicated, funny, hard working, and down to earth individuals in my cohort. One big factor was Tyler. He is very chill and lets us work on labs, mock code challenges, and anything else we need to work on, by ourselves, at our own pace(as self-paced as bootcamp learning can get). Some might want the instructor to be there 24/7 to help whenever they need but I prefer to try first and when it’s taking way too long I will ask for help. I have never learned when someone tried to “help” but was giving me the answers.</p><p>With so much to learn and how hard it has been, I still made a lot of progress. My future goals will be to learn what phase 2 will bring to my door step. Algorithms is another important subject I need to conquer. For now, it will be a short rest before I’m thrown into the fire again and I welcome it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=49d084095431" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>