<?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 Kate on Medium]]></title>
        <description><![CDATA[Stories by Kate on Medium]]></description>
        <link>https://medium.com/@ktr16?source=rss-1e2d72ea2158------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*W4YRZZGREErKMhtE</url>
            <title>Stories by Kate on Medium</title>
            <link>https://medium.com/@ktr16?source=rss-1e2d72ea2158------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 12:14:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ktr16/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[First Rails JSON API]]></title>
            <link>https://medium.com/@ktr16/first-rails-json-api-d1164500eac1?source=rss-1e2d72ea2158------2</link>
            <guid isPermaLink="false">https://medium.com/p/d1164500eac1</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Kate]]></dc:creator>
            <pubDate>Mon, 03 Dec 2018 11:10:32 GMT</pubDate>
            <atom:updated>2018-12-03T11:10:32.401Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Starting a project:</strong><br>(Things I wish I’d done…)</p><ol><li>Create a list of all URIs you can anticipate</li><li>Make Entity Relationship Diagrams (ERDs) or similar for all Database Queries, especially if they span more than one table</li><li>Don’t overlook creating a ToDo list of sorts for independent projects</li><li>Favor more file structure over in-file logical decisions (ie more (nested) controllers)</li><li>Assume there’s more to the assignment than meets the eyes</li><li>Let the specification harness guide your project</li></ol><p><strong>At First</strong><br>I first approached this project by reusing my controllers, keeping “experience” logical decisions inside my controller to determine which model instances would be displayed at any given request. The “experience” depended on the params, including various id’s, and what the path was (request.path). After about 4 experiences for each of my controllers, I realized this was dumb and quickly becomes messy. I decided to add more controllers, nesting them with namespace or module. This was a great move that I’m definitely going to lean towards doing from the get-go in the future. It set me back some time, but I already had tests for these ‘experiences’ so it worked out well and easy.</p><p><strong>The Challenge</strong><br>I had one week to do this project; unfortunately, this was not my most available week, but I also definitely coupled it with underestimating the project. It’s funny because I thought most of this project was copying, pasting, and re-naming variables from one category-test to another. I still stand by that for the most part, but it’s funny how much time that actually takes, especially when some of the test data requires most of the other models to be instantiated and connected.</p><p>Speaking of underestimating time, I also underestimated working with time, timestamps actually, in postgresql. I tried a ton of things to get these to match the strings I had available from params searches, but ran out of time and decided to move past them. This is something I’m going to follow up on ASAP because it was critical for the project and I just couldn’t get it to work.</p><p><strong>Lessons Learned<br></strong>The checklist at the top is my main take away from this project. <br>I found doing #1 great, I appreciated not having to look at the assignment every time I needed to make a new route, and I was able to knock out multiple pieces in pretty much one go — one unbroken workflow. <br>#2 blew my mind as worked on these problems (see Amazed)<br>#3 To Do List — needs improvement — I did not organize myself for this project beyond a few in-file to-do lists like the URI list I mention. I wish I had done more to organize this. I do well organizing with groups, but on my own, here at least, I skipped it and I regret it.<br>#4 File Structures &gt; File Logic — I was skeptical that more directories and more files would actually make things better, but when I started to feel pressed for time on this project it really helped. I’m still sort of skeptical that creating a new controller for every nested route was the right thing to do, but for a project this small, it’s fine. I want to learn more about how companies actually balance this…and I need use the fuzzy find hotkey more.<br>#5 The assignment said there were 4 parameters that every category needed to search/filter by, but when I got to the last bit of time on the project, I realized this was more like the ‘idea’ of these 4 parameters. What the spec harness actually required was search by every non-referencing data field. I ran out of time to complete these, even though they are pretty simple to setup. This is where #6 comes into play…<br>#6 The Spec Harness — The Spec Harness can be hard to work with; you run all the tests and you see a couple hundred assertions and a couple of failures and you think you’re off to a great start…change a few things and all of a sudden there’s 6,000+ assertions and a hundred failures! Holy cow! How are you supposed to know where to start, where to look, what to do, when it ends?! Well, dig into those test files, and see what’s going on — and if you’re skeptical of a test, bring it up! Turns out some of the tests were wrong, and I was able to get my first open-source PR merge. In the future, I’d like to pay more attention to the spec harness from the start. It’s sort of hard when you’re doing new things, to dive into the tests before you have a good grasp on where those details and features come from, but the more I get used to projects with spec harnesses, the more I’ll get comfortable with this. I hope to see more in the future, but who knows, there aren’t spec harnesses in real life.</p><p><strong>Amazed<br></strong>I was not feeling great about ActiveRecord or SQL before this project. I think I didn’t have a clear picture of what needed to happen before I dove into throwing things together. Since learning about ERDs, creating/drawing out a structured, bare-minimum, left-to-right sequence of table connections, and definitely drawing it out physically, I’m amazed at how quickly and mostly-seamlessly my queries came together! I am going to do this everytime before getting started — #1 TAKE AWAY!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d1164500eac1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ruby Notes :  a Tool for Group Projects in Rails]]></title>
            <link>https://medium.com/@ktr16/ruby-notes-a-tool-for-group-projects-in-rails-34f262659491?source=rss-1e2d72ea2158------2</link>
            <guid isPermaLink="false">https://medium.com/p/34f262659491</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <dc:creator><![CDATA[Kate]]></dc:creator>
            <pubDate>Wed, 07 Nov 2018 21:55:55 GMT</pubDate>
            <atom:updated>2018-11-08T03:09:11.737Z</atom:updated>
            <content:encoded><![CDATA[<h3>Ruby Notes : a Tool for Group Projects in Rails</h3><p>Maybe you’re new to programming? <br>Maybe you’re new to programming in teams?</p><p>Ruby has a very opinionated community around comments in code — “the code should be readable and speak for itself” — but assuming you’re new to that community and maybe even new to the concept of code comments at all, lets move past opinions and talk about why comments can be useful, especially in team work.</p><p>Comments can be really effective tools for communication and collaboration. You can create logical sections of a file to quickly find certain types methods and functionality. You can indicate when values are intentionally limited (like numerical rounding) or formatted in a specific way that might be unexpected. Larger comments in code (block comments) are intended to explain <em>why</em> a given chunk of code is necessary and not <em>what</em> it does or <em>how </em>it works. It’s also important to realize that if you’re writing comments, <strong>maintaining those comments</strong> is just as important as maintaining the code.</p><p>Some comments are purely meant to be temporary and are a way to directly communicate intentions to teammates or yourself as the project progresses. These comments can be created with built-in tags that help you find them in your project later. These comments are intended to be actionable items that translate to code implementation and can be removed when the task is complete.</p><p>This post is going to cover three built in comment tags and how you can create your own.</p><h4>Built-in Tags</h4><p>TODO — # TODO: — Can be used to keep track of general action items, next steps or unexpected things that come up as solutions play out. You can indicate where features may be weak or can be made more robust. You can indicate where features can be implemented when dependencies are finally merged.</p><p>FIXME — # FIXME: — Can be used to indicate where something is broken or is of higher priority than a To-Do item. It’s good for features in need of some love that are currently vital but may be buggy or insufficient.</p><p>OPTIMIZE — # OPTIMIZE: —Generally for improving resource management and efficiency.</p><p><strong>Note:</strong> the comment tags don’t hold any functionality in accordance with their suggested use. They are meant for readability and general quick understanding when one is discovered in the code.</p><h4>Retrieving Notes</h4><p>In the terminal from within your project directory root, you can run <br>rake notes to retrieve all of the comments in your code <strong>with</strong> the built-in tags.</p><p>You can also retrieve all notes of a specific tag with the following:<br>rake notes:todo<br>rake notes:fixme<br>rake notes:optimize</p><p>In the final section of this post, you’ll learn how to retrieve custom tags.<br>(spoiler alert: rake notes:custom ANNOTATION=CUSTOMTAG )</p><p>You can also retrieve all comments (with or without tags) in your code by running rake notes:custom though, you’re probably not looking to do this. If you’re trying to stick to ‘no comments in code’ opinion, and all your actionable notes are complete, this can help you find where you have regular code comments or commented out garbage code.</p><p>For the following ruby code (which contains the only tagged-notes in my project):</p><pre>  it &quot;This test doesn&#39;t do anything but hold notes&quot; do<br>    # TODO:     something<br>    # FIXME:    something is broken<br>    # TODO:     something else<br>    # OPTIMIZE: something is slow<br>    # TESTME:   custom tag<br>    # TODO      the colon does not affect the note<br>    # HEY-JOHN  this note is for you<br>  end</pre><p><strong>Note: </strong>the comments TESTME and HEY-JOHN are custom tags and do not appear in the following steps ( — jump to last section for more information)</p><p>The terminal output of running rake notes is:</p><pre>spec/models/using_notes_spec.rb:</pre><pre>* [ 5] [TODO] something</pre><pre>* [ 6] [FIXME] something is broken</pre><pre>* [ 7] [TODO] something else</pre><pre>* [ 8] [OPTIMIZE] something is slow</pre><pre>* [10] [TODO] the colon does not affect the note</pre><p>You can see that the file path leads the collection of notes and that each note appears in order presented in that file, and includes the line number.</p><p>If we had notes in more than one file, the output would appear as follows:</p><pre>spec/models/using_notes2_spec.rb:</pre><pre>* [ 5] [TODO] this is a note in another file</pre><pre>* [ 6] [TODO] this too</pre><pre>spec/models/using_notes_spec.rb:</pre><pre>* [ 5] [TODO] something</pre><pre>* [ 6] [FIXME] something is broken</pre><pre>* [ 7] [TODO] something else</pre><pre>* [ 8] [OPTIMIZE] something is slow</pre><pre>* [10] [TODO] the colon does not affect the note</pre><pre>* [11] [TODO] _  it can be anything</pre><p>In your working IDE, it’s probably <strong>most effect </strong>if you use the project/file <strong>text search</strong> to look for your notes. This will provide you with <strong>direct links</strong> to those lines of code and actionable tasks.</p><h4>Custom Note Tags</h4><p>You can also make your own custom note tags!</p><p>To find them you’ll run the command:<br>rake notes:custom ANNOTATION=CUSTOMTAG</p><p>Your code can now include a note like:<br> # CUSTOMTAG: this is my custom note</p><p>These custom notes can be useful for all sorts of things!</p><p>One way is to tell your teammates that you’re currently working on a task and they shouldn’t touch that piece of functionality yet. This might come up if you need to quickly merge so the team can be up to date and move on individually from a common (but maybe not production ready) ground.<br> Your custom tag might look something like:<br># K-WIP: this is K&#39;s Work In Progress method — please ignore!<br>and be retrieve like:<br>rake notes:custom ANNOTATION=K-WIP</p><p>Another way is to indicate where teammates can pick up where you left off. Say, for example, you’re making a navigation bar html partial that links to all sorts of paths that other teammates will be implementing functionality for. You can create all the links or leave static text where the links would be and create notes in your various route/controllers/views/models files where that next person should pick up the remaining work.<br># HEY-JOHN: please make this static text a link to your new path for the profile page<br>and then John, <strong>after being informed you left these notes for him</strong>, can retrieve them with this command:<br> rake notes:custom ANNOTATION=K-WIP</p><p>One task I unfortunately find myself writing is # TESTME. This one is my shortest-lived comment and I preface writing any non-Test-Driven-Development functionality with this, even if I’m going to write a test immediately after. Sometimes, when working on view features, I build in model functionality, but only drive the development with feature tests. This is is a great time, in my opinion, to use a comment like this so you don’t forget to make a model test as well. Sometimes for better or <strong>worse</strong>, you just end up spiking some code to get through a complicated problem, but if you track it with a note, at least you know exactly where to go back to and test. These comments are also my top priority to address before I submit code to my team; the team is not responsible to initially test your contribution, you are.</p><p>In the example used earlier, running <br>rake notes:custom ANNOTATION=TESTME</p><p>would return the following:</p><pre>spec/models/using_notes_spec.rb:</pre><pre>* [9] custom tag</pre><p><strong>NOTE</strong>: the tag name does not appear in the result, only the file path(s) and the line number(s).</p><h4>THE DOWNSIDE:</h4><p>Unfortunately, running rake notes will <strong>NOT</strong> <strong>retrieve these custom notes</strong>, so be careful and make sure the team is aware of custom notes and has a standard set of custom tags if choosing to use this tool. Communication is the key to a successful project, so communicate the use of custom note tags in pull requests and tag anyone the notes are targeted for.</p><h4>Resources</h4><ul><li><a href="https://guides.rubyonrails.org/v4.0.0/command_line.html#notes">The Rails Command Line - Ruby on Rails Guides</a></li><li><a href="http://rubyquicktips.com/post/385665023/fixme-todo-and-optimize-code-comments">FIXME, TODO and OPTIMIZE code comments</a></li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FAZGOzb1Y5U8%3Fstart%3D37%26feature%3Doembed%26start%3D37&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DAZGOzb1Y5U8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FAZGOzb1Y5U8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b377041f94a947531c16f3deef49dd8f/href">https://medium.com/media/b377041f94a947531c16f3deef49dd8f/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34f262659491" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>