<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://cooksey.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://cooksey.io/" rel="alternate" type="text/html" /><updated>2026-09-23T15:13:05-05:00</updated><id>https://cooksey.io/feed.xml</id><title type="html">Charlie Cooksey</title><subtitle>Welcome to my site, where I share my knowledge and experience as a full-stack developer, with a focus on backend technologies. On my blog, I write about Ruby, Rails, data stores, test-driven development and JavaScript on both frontend and backend. Join me on a journey of leaning and growth in the world of technology, and discover how we can build better software together.</subtitle><entry><title type="html">Fear and Loafing in Suburbia</title><link href="https://cooksey.io/2026/03/24/fear-and-loafing-in-suburbia.html" rel="alternate" type="text/html" title="Fear and Loafing in Suburbia" /><published>2026-03-24T20:30:00-05:00</published><updated>2026-03-24T20:30:00-05:00</updated><id>https://cooksey.io/2026/03/24/fear-and-loafing-in-suburbia</id><content type="html" xml:base="https://cooksey.io/2026/03/24/fear-and-loafing-in-suburbia.html"><![CDATA[<p>It’s been almost three years since I last wrote here. I thought about writing several times, but the thought of it was overwhelming. Where to start? What to talk about, what not to talk about…</p>

<p>We bought a house in Adelaide a few months ago. Still getting settled but we love it. We plan to never move again. We have a birdbath out front and a fantastic covered outdoor area in the backyard. My new office has fancy double doors. There’s a fair bit of foot traffic on the sidewalk on our street, so the people watching has been good. I absolutely love the neighborhood. Lots of rainbow lorikeets and big Aussie magpies.</p>

<p>The LLM boom has certainly been interesting. LLMs and AI tools are becoming part of the daily toolkit. I find using the free web-based ChatGPT useful as an Internet search replacement, but it confidently lies to me fairly often. I’ve been studying Model Context Protocol (MCP), using “AI” Agents, learning various approaches to orchestration, guardrails, and guidelines. With a highly curated setup, it is very impressive as a coding assistant. I’ve heard talk of putting LLMs like ChatGPT in schools to help teach children, which seems like a sketchy idea given the hallucinations. I’m also concerned about the future junior-to-senior pipeline for newer software developers. LLM CEOs’ economic predictions are also concerning.</p>

<p>Life continues. We bought a house, we’re getting settled. I’m still coding, still learning. Still enjoying it.</p>

<p>I hope you’re well. o7</p>]]></content><author><name></name></author><category term="life," /><category term="software," /><category term="industry," /><category term="updates" /><summary type="html"><![CDATA[It’s been almost three years since I last wrote here. I thought about writing several times, but the thought of it was overwhelming. Where to start? What to talk about, what not to talk about…]]></summary></entry><entry><title type="html">Even Here, We Are</title><link href="https://cooksey.io/2023/06/18/even-here-we-are.html" rel="alternate" type="text/html" title="Even Here, We Are" /><published>2023-06-18T00:00:00-05:00</published><updated>2023-06-18T00:00:00-05:00</updated><id>https://cooksey.io/2023/06/18/even-here-we-are</id><content type="html" xml:base="https://cooksey.io/2023/06/18/even-here-we-are.html"><![CDATA[<p>This is my second winter living in Australia. Winter in June, I’m still getting used
to that. In Adelaide, winter consists of rain and wind. It’s mild compared to
Denver.</p>

<p>We lived downtown for the first year, having just recently moved to a bigger
place in the suburbs. Living downtown had perks. The people-watching is off the
charts. We didn’t need a car for our first year since several large grocery
stores were within 400 meters of us. As an American, Adelaide’s public
transport is fantastic (as an American). We had no trouble getting around the
entire city. Adelaide’s CBD was a great first place to live in Australia.</p>

<p>I do prefer a quieter suburb these days. Rainbow Lorikeets come by often. The
bigger house has allowed us to move our belongings out of storage from a year
ago. It’s been so nice to have so many of our things again. It’s like Christmas
unpacking things from our old Denver house.</p>

<p>The car we bought is the exact same car we had in Denver. I’ll update with
pictures of both cars later.</p>

<p>Life feels more peaceful here. The atmosphere is more chill, relaxed. The
stronger social safety nets in Australia give nice peace of mind. Workers gain
flexibility when health insurance has nothing to do with employment. I recently
left my consulting agency position with an Australian company. I  accepted a
new contracting position for an American company as the team load for their
Oceania software division. It’s a very new role for me. I’m absolutely loving
it so far. I plan to write more about it later in the year.</p>

<p>I miss friends and family back home in the USA, but Australia has been so gracious to me and us. I’m
grateful to have had such an amazing and unique expirence in my life.</p>]]></content><author><name></name></author><category term="2023," /><category term="australia," /><category term="denver," /><category term="adelaide," /><category term="software" /><category term="developer," /><category term="gratitude," /><category term="wellness" /><summary type="html"><![CDATA[This is my second winter living in Australia. Winter in June, I’m still getting used to that. In Adelaide, winter consists of rain and wind. It’s mild compared to Denver.]]></summary></entry><entry><title type="html">On The Other Side (of the planet)</title><link href="https://cooksey.io/2022/06/18/on-the-other-side-of-the-planet.html" rel="alternate" type="text/html" title="On The Other Side (of the planet)" /><published>2022-06-18T06:43:00-05:00</published><updated>2022-06-18T06:43:00-05:00</updated><id>https://cooksey.io/2022/06/18/on-the-other-side-of-the-planet</id><content type="html" xml:base="https://cooksey.io/2022/06/18/on-the-other-side-of-the-planet.html"><![CDATA[<p>We moved to Australia on 18 April 2022. This is the start of the rest of my life, all over again. I’ve lived in Australia now for two months.</p>

<p>I’ve accepted a new senior software engineering role with a Rails-oriented Australian software company. I couldn’t be happier to be working for this company. When we still lived in the USA, I did a first-look at ruby positions in Australia. One Australian company stood out to me, so I emailed them. The company and I kept in contact for over a year. After many interviews, it’s the first company I found a year and a half ago. When you go looking for a good company and find one, trust your gut. I started my new position in mid-July 2022.</p>

<p>We live in the central business district (CBD) of Adelaide, South Australia. My wife and I always wanted to live in a vibrant metropolitan downtown, but most American cities aren’t built for that. Adelaide is the perfect place to fulfil a good life wish-list item.</p>

<p>Getting used to Life in Australia has been interesting. We finally bought a television for the living room of our apartment. I like Australian TV so far. :) We need a car where we live so then “downtown life” has been amazing. Two or three times a week we walk our shopping trolley to the grocery store 300 metres away, shop, and bring it home. Hearing the city noises each weekend is wonderful. Sirens are rare. Mostly I hear joy when I sit on our balcony.</p>

<p>There are millions of shops and restaurants within a 5 - 10 minute walk from our apartment building. I can’t wait to start going out to them more. City life does not disappoint.</p>

<p>Of course, I miss my family and friends. Talking to family and friends is hard in my new timezone. It’s 5 PM for them when I wake up. In my day, I have American evenings and mornings later. We talk enough, but the “off hours” are lonely when it’s prime time. But that’s okay. I’ve made friends here. Good people are nice when getting comfortable. I don’t have to tell you that. Relax the shoulders, release the tension the back, breathe deeply through the nose and be grateful.</p>

<p>My wife’s family has been a huge help in getting us settled in Adelaide. We couldn’t have done it without them. They pitched in and really saved us energy, money, time, and some of our sanity. Big thank you to them.</p>

<p>To the readers of this, I hope you are well.</p>]]></content><author><name></name></author><category term="adelaide" /><category term="australia" /><category term="colorado" /><category term="software" /><category term="development" /><summary type="html"><![CDATA[We moved to Australia on 18 April 2022. This is the start of the rest of my life, all over again. I’ve lived in Australia now for two months.]]></summary></entry><entry><title type="html">Australia Or Bust</title><link href="https://cooksey.io/2022/04/03/australia-or-bust.html" rel="alternate" type="text/html" title="Australia Or Bust" /><published>2022-04-03T00:00:00-05:00</published><updated>2022-04-03T00:00:00-05:00</updated><id>https://cooksey.io/2022/04/03/australia-or-bust</id><content type="html" xml:base="https://cooksey.io/2022/04/03/australia-or-bust.html"><![CDATA[<p>After two years of work, I am finally able to share some big personal news: my wife and I are moving from Denver, Colorado in the United States to Adelaide, South Australia. We will leave the United States on 16 April 2022. That is two weeks from now.</p>

<p>I’m American. My wife is Australian. We met in 2007. We got married in 2010 in the United States. We’ve lived in the here for 12 years. In 2020 we decided it was time for a new adventure. We began the Australian immigration process for my permanent residency. In November of 2021, I was approved for permanent residency in Australia.</p>

<p>It’s April 2022 now. We’ve moved into a hotel in Denver while the sale on the house closes.</p>

<p>We’ve spent the last five months visiting my family, saying goodbye to friends, and planning our move to my wife’s hometown, Adelaide. Her family is so excited to see her. It’s been a very long time for her and her family. I’m extremely excited but I’m even more excited about how happy my wife is to be going home. And I’m unbelievably overjoyed to live in Australia. I doubt I will ever live in the United States again. It wouldn’t make sense for us at this point.</p>

<p>My last day at work with Interfolio was 25 March 2022. I wish I had found the company sooner. I liked the company and position a lot. The work was interesting and it was my first time using GraphQL. I’ll greatly miss my team and wish them all the best. I’m going to look for work in Australia in May or June.</p>

<p>I’m so excited for this new chapter in our lives. I’ll keep you posted.</p>]]></content><author><name></name></author><category term="moving," /><category term="denver," /><category term="south" /><category term="australia," /><category term="adelaide," /><category term="colorado" /><summary type="html"><![CDATA[After two years of work, I am finally able to share some big personal news: my wife and I are moving from Denver, Colorado in the United States to Adelaide, South Australia. We will leave the United States on 16 April 2022. That is two weeks from now.]]></summary></entry><entry><title type="html">Thoughts On The Dream Job</title><link href="https://cooksey.io/2021/07/23/thoughts-on-the-dream-job.html" rel="alternate" type="text/html" title="Thoughts On The Dream Job" /><published>2021-07-23T00:00:00-05:00</published><updated>2021-07-23T00:00:00-05:00</updated><id>https://cooksey.io/2021/07/23/thoughts-on-the-dream-job</id><content type="html" xml:base="https://cooksey.io/2021/07/23/thoughts-on-the-dream-job.html"><![CDATA[<p>In Feburary 2020, I interviewed was hired at Sophos, a global cyber-security company. Sophos develops products for network security, email security, encryption, mobile securiy, and communications endpoints. The company has 3,500 employees. It is an institution.</p>

<h3 id="company-industry-is-not-the-job">Company industry is not the job</h3>

<p>I have been guilty of conflating the project(s) I work on with the prestiege of the job. For instance, I’ve always felt that contributing to open source as a job is glamorous. Cyber security, also glamorous. Working close to hardware feels glamorous. These things are generally admired and often sought out. These fields look good on a resume, and the work feels important.</p>

<p>However, I don’t believe it lives up to the hype. It is likely your work will feel distant from the company’s mission. Are you really working in cyber-security if your backend API project returns threat detection models rather than a customer’s shopping cart? What’s the difference? Either way, you fetch data from the datastore and return that data serialized. Does the content of the payload matter?</p>

<p>It feels like it should matter, but I don’t think it does.</p>

<h3 id="java-isnt-bad">Java isn’t bad</h3>

<p>I succesfully avoided Java for over a decade. At Sophos I had the rite of passage: work on an Enterprise Java app. The project is at least 15 years old. It’s the biggest application I have ever seen. It has &gt; 10,000 classes. It requires an enormous amount of domain knowledge due to the abstractions on top of almost everything. I actually kind of like it. I was intimidated at first, but I am proud to say I was succesful in working on the Enterprise Java application.</p>

<p>I still prefer Ruby because it allows more creatitivty.</p>

<h3 id="communication-is-important">Communication is important</h3>

<p>I was in a unique position at Sophos. I worked on the Darkbytes team. [My team had previously been its own company. Sophos had just announced the acquisition.] (https://www.sophos.com/en-us/press-office/press-releases/2019/01/sophos-acquires-darkbytes-as-foundation-of-new-mdr-services.aspx) Our Ruby projects leveraged <a href="http://sinatrarb.com/">the Sinatra framework</a>. We used Sinatra at Rackspace as well.</p>

<p>The applications that I worked on were internal mechanisms to track managed threat detection and response (MTD/MTR). The internal ReactJS and customer-face Angular frontends displayed case data and detection data.</p>

<p>Six or seven months into the position, we began to integrate our platform into the Enterprise Java application for the purposes of showing MTD/MTR analysis to the customers on the customer-facing Sophos portal. The frontend used Angular 1.x as we migrated to Angular5+.</p>

<p>Our team used Slack, Sophos used Teams. This made it harder to communicate changes, plan accordingly, and ask questions. We did not have project managers, QA, or scrum masters for a year after I joined the team. We were scrappy and still got things done. We filled in those roles as 2020 turned into 2021.</p>

<h3 id="reflecting-on-the-work">Reflecting on the work</h3>

<p>I spent a year working between both teams / organizations. It was challenging but I was succesful in my role. I created Ruby Sinatra JSON endpoints that returns serialized threat detection data. We store the analytics in ElasticSearch and case data in regionalized Postgres instances.</p>

<p>Using Sinatra with ActiveRecord, we created an abstraction on top the database layer with a customized <code class="language-plaintext highlighter-rouge">database.yml</code>. The abstraction layer is passed a customer object which contains region data and calls the appropriate datastore. This system was used to fetch threat detection analysis from ElasticSearch and case-specific threat data from regionalized Postgres. All returned via JSON using</p>

<p>Then I would context switch to the Java side. I would add the new Darkbytes API service method, consume the Ruby endpoint, write integration tests, and open a pull request. This fed the customer-facing portal with MTR/MTD aggregation queries and case data.</p>

<p>It was interesting, involved work. I’m proud to have done it.</p>

<p>But, it is time to move on.</p>

<p>I now think Java has an undeserved bad reputation. I believe there is too much ceremony, but it is ultimately a great tool for the role that it fills in software development. Enterprise Java Spring applications are rightly opinionated. This is useful when there are 500+ people working on the same application. It forces a common dialong between employees that will likely never meet. That said, I’d like to focus on growing in the areas that interest me. And Java is not what interests me.</p>

<h3 id="next">Next</h3>

<p>I am excited to begin my new position at with a higher education company. They are a Rails + Angular shop. The team looks great, the projects are interesting, and I am looking forward to this happy change.</p>

<p>I hope all is well to you, reader, whoever you are.</p>]]></content><author><name></name></author><category term="cyber" /><category term="security," /><category term="software" /><category term="developer," /><category term="jobs," /><category term="dream" /><category term="job" /><summary type="html"><![CDATA[In Feburary 2020, I interviewed was hired at Sophos, a global cyber-security company. Sophos develops products for network security, email security, encryption, mobile securiy, and communications endpoints. The company has 3,500 employees. It is an institution.]]></summary></entry><entry><title type="html">Fender Stratocaster Rebuild</title><link href="https://cooksey.io/2019/08/09/fender-stratocaster-rebuild.html" rel="alternate" type="text/html" title="Fender Stratocaster Rebuild" /><published>2019-08-09T00:00:00-05:00</published><updated>2019-08-09T00:00:00-05:00</updated><id>https://cooksey.io/2019/08/09/fender-stratocaster-rebuild</id><content type="html" xml:base="https://cooksey.io/2019/08/09/fender-stratocaster-rebuild.html"><![CDATA[<p>This guitar is an E-Series 1987 Japanese Fender Stratocaster Squier. I didn’t
know most of that until a month ago. At thirteen, I got it from a pawn shop in
small Texas town. It was my first guitar. Many have come and gone over the
years, but this one has been with me since. This guitar moves with me to
Australia and back. It has my companion and tool in six bands that I can recall
from memory right now. It was never great, but that was never the point of this one, for me.</p>

<p><img alt="This guitar is a 1987 Japanese Fender Stratocaster Squier" src="/assets/images/stratocaster-00.webp" /></p>

<p>It didn’t even work anymore. It was missing the high E tuning key, the
electronics hardly worked, the fret board had sharp pieces. I had been
considering buy a new electric guitar for about a year and had recently gotten
very serious about it. However, my wife talked me into fixing the Stratocaster
up, and I’m really happy with how it turned out.</p>

<p><img alt="old, broken 1987 Japanese Fender Stratocaster Squier" src="/assets/images/stratocaster-01.webp" /></p>

<p>It was in a sad state. And nasty. Look at the bridge. Yikes</p>

<p><img alt="electronics Japanese Fender Stratocaster Squier" src="/assets/images/stratocaster-02.webp" /></p>

<p>I needed to drill new holes in the headstock to install the new Fender tuning
keys.  After that, I used steel wool to smooth the fret board and a very fine
grain sandpaper to blunt sharp frets.  Third, I wired inn the electronics.
Then, I gave the bridge components a thorough cleaning.</p>

<p><img alt="electronics Japanese Fender Stratocaster Squier" src="/assets/images/stratocaster-03.webp" /></p>

<p>The last thing to do was bolt everything in and back together and string it up.</p>

<p>The pickups I went with are Seymour Duncan —</p>

<ul>
  <li>Neck: Little 59 Humbucker</li>
  <li>Middle: split single coil Humkbucker</li>
  <li>Bridge: JB Jr. Humbucker</li>
</ul>

<p>Here’s an unlisted YouTube video of how it sounds. In this video, I’m playing a
summary of 46 &amp; 2 by Tool.</p>]]></content><author><name></name></author><category term="fender," /><category term="squier," /><category term="stratocaster," /><category term="japan" /><summary type="html"><![CDATA[This guitar is an E-Series 1987 Japanese Fender Stratocaster Squier. I didn’t know most of that until a month ago. At thirteen, I got it from a pawn shop in small Texas town. It was my first guitar. Many have come and gone over the years, but this one has been with me since. This guitar moves with me to Australia and back. It has my companion and tool in six bands that I can recall from memory right now. It was never great, but that was never the point of this one, for me.]]></summary></entry><entry><title type="html">Blogging from iOS 13 beta on iPad Air 2</title><link href="https://cooksey.io/2019/07/03/blogging-from-ios-13-beta-on-ipad-air-2.html" rel="alternate" type="text/html" title="Blogging from iOS 13 beta on iPad Air 2" /><published>2019-07-03T00:00:00-05:00</published><updated>2019-07-03T00:00:00-05:00</updated><id>https://cooksey.io/2019/07/03/blogging-from-ios-13-beta-on-ipad-air-2</id><content type="html" xml:base="https://cooksey.io/2019/07/03/blogging-from-ios-13-beta-on-ipad-air-2.html"><![CDATA[<p>The introduction of iPadOS looked promising enough for me to consider replacing
more of the work I do on my <a href="https://www.archlinux.org">Arch</a> on my laptop. I’m
not interested in deprecating a laptop that I love, but offloading more simple
tasks to other, more mobile, devices appeals to my sense of freedom.</p>

<p>This morning I downloaded the
<a href="https://apps.apple.com/us/app/pretext/id1347707000">Pretext</a> app for editing
<a href="https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#links">Markdown</a>
on iPad. It seems to do the job well.</p>

<p>My job gives me a MacBook Pro for development, and I have a personal Dell XPS
laptop running Arch Linux. For reasons not quite known to me, I prefer to do as
much work as I can on my phone or tablet rather than my laptops. I like to
think the reason is that I feel more able to accomplish tasks without the need
of a proper computer, but the reality is more likely that I just like gadgets.</p>

<p>As a final test of this iPad blogging experience, let’s see how a little code
does.</p>

<script src="https://gist.github.com/cdcooksey/2f9116324ebb5e6b170728db50969cb7.js"></script>

<p>Seems good. PHP for funsies?</p>

<script src="https://gist.github.com/cdcooksey/3bf89ae9cddec1acc57dabcb28d827e4.js"></script>

<p>Well, that seems to work fine. Now I’m thinking about how I might send this
markdown file from my iPad
<a href="https://www.cnet.com/products/apple-ipad-air-2-wi-fi-tablet-32-gb-9-7-mnv62lla/">MNV62LL/A</a>
to automatically insert the file into my git repository. Maybe I will set up a
secret email address that I can send this to. A little bit of code could watch
the email, pull new markdown files into the repo, rebuild
<a href="https://middlemanapp.com">middleman</a> and automatically push the addition to
AWS through the existing CI/CD pipeline.</p>

<p>We’ll see.</p>]]></content><author><name></name></author><category term="ruby," /><category term="php," /><category term="git," /><category term="ipad," /><category term="ios" /><category term="13" /><summary type="html"><![CDATA[The introduction of iPadOS looked promising enough for me to consider replacing more of the work I do on my Arch on my laptop. I’m not interested in deprecating a laptop that I love, but offloading more simple tasks to other, more mobile, devices appeals to my sense of freedom.]]></summary></entry><entry><title type="html">Check Out This Diff</title><link href="https://cooksey.io/2018/08/29/check-out-this-diff.html" rel="alternate" type="text/html" title="Check Out This Diff" /><published>2018-08-29T00:00:00-05:00</published><updated>2018-08-29T00:00:00-05:00</updated><id>https://cooksey.io/2018/08/29/check-out-this-diff</id><content type="html" xml:base="https://cooksey.io/2018/08/29/check-out-this-diff.html"><![CDATA[<p>Oh, snap. Look! I had already refactored this controller quite a lot, but then I did this. So satisfying.</p>

<p><img alt="image of readable one-liner in ruby controller rails" width="80%" src="/assets/images/check-out-this-diff.jpeg" /></p>]]></content><author><name></name></author><category term="ruby," /><category term="rails," /><category term="git," /><category term="diff" /><summary type="html"><![CDATA[Oh, snap. Look! I had already refactored this controller quite a lot, but then I did this. So satisfying.]]></summary></entry><entry><title type="html">On Test Driven Development</title><link href="https://cooksey.io/2018/08/08/test-driven-development.html" rel="alternate" type="text/html" title="On Test Driven Development" /><published>2018-08-08T09:09:00-05:00</published><updated>2018-08-08T09:09:00-05:00</updated><id>https://cooksey.io/2018/08/08/test-driven-development</id><content type="html" xml:base="https://cooksey.io/2018/08/08/test-driven-development.html"><![CDATA[<h3 id="why">Why</h3>
<p>One of the things I see most on job descriptions, brought up in interviews, and thrown around in general
programming discussion is <a href="https://en.wikipedia.org/wiki/Test-driven_development">Test Driven Development</a>.
For the most part, everyone understands how the methology works and how to implement it.  But, I see a lot
of developers miss out on the benefits when it comes to fixing a bug.</p>

<h3 id="how">How</h3>

<p>First, it needs to be said that every single bug should have at least one test in the pull request that
fixes the bug.  That’s a given, I hope, but we can expand on this.</p>

<p>When I bug rears its ugly head, the first thing that should happen is adding at least one test to prove
the bug’s existence.  Reproduce the bug with tests.</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">describe</span> <span class="no">CustomAddingClass</span> <span class="k">do</span>
  <span class="n">let</span><span class="p">(</span><span class="ss">:amount</span><span class="p">)</span> <span class="p">{</span> <span class="mi">1</span> <span class="p">}</span>
  
  <span class="n">describe</span> <span class="s1">'#add_one'</span> <span class="k">do</span>
    <span class="n">subject</span> <span class="p">{</span> <span class="no">CustomAddingClass</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">amount</span><span class="p">).</span><span class="nf">add_one</span> <span class="p">}</span>
    <span class="n">it</span> <span class="p">{</span> <span class="n">is_expected</span><span class="p">.</span><span class="nf">to</span> <span class="n">be</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="p">}</span>
  <span class="k">end</span>
<span class="k">end</span>
</code></pre></div></div>

<p>This is your test, and it passes. Look at our class:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">class</span> <span class="nc">CustomAddingClass</span>
  <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">amount</span> <span class="o">=</span> <span class="mi">1</span><span class="p">)</span>
    <span class="vi">@amount</span> <span class="o">=</span> <span class="n">amount</span>
  <span class="k">end</span>

  <span class="k">def</span> <span class="nf">add_one</span>
    <span class="vi">@amount</span> <span class="o">+</span> <span class="mi">1</span>
  <span class="k">end</span>
<span class="k">end</span>
</code></pre></div></div>

<p>We expect <code class="language-plaintext highlighter-rouge">CustomAddingClass#add_one</code> to increment the constructor arg by one, but it isn’t working.  The
test passes, but reports are an error message: <code class="language-plaintext highlighter-rouge">TypeError (no implicit conversion of Integer into String)</code>.</p>

<p>What gives? You could guess all day, and with this particular error message, you’d probably figure it out
really quickly. This is just a simple example. Imagine the system is far more complex.</p>

<p>We need a test to reproduce the bug we’re seeing in production.</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="n">describe</span> <span class="s1">'#add_one'</span> <span class="k">do</span>
  <span class="n">context</span> <span class="s1">'when amount is a string'</span> <span class="k">do</span>
    <span class="n">let</span><span class="p">(</span><span class="ss">:amount</span><span class="p">)</span> <span class="p">{</span> <span class="s1">'1'</span> <span class="p">}</span>
    <span class="n">subject</span> <span class="p">{</span> <span class="no">CustomAddingClass</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">amount</span><span class="p">).</span><span class="nf">add_one</span> <span class="p">}</span>
    
    <span class="n">it</span> <span class="p">{</span> <span class="n">is_expected_to</span> <span class="n">raise_error</span><span class="p">(</span><span class="no">TypeError</span><span class="p">)</span> <span class="p">}</span>
  <span class="k">end</span>
<span class="k">end</span>
</code></pre></div></div>

<p>Ah, ha! We’ve found our bug. Somehow the frontend is allowing a string to be passed to <code class="language-plaintext highlighter-rouge">CustomAddingClass#new</code>.</p>

<p>So, we update our class to ensure that we’re always dealing with an integer:</p>

<div class="language-diff highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">class CustomAddingClass
</span>  def initialize(amount = 1)
<span class="gd">-    @amount = amount
</span><span class="gi">+    @amount = amount.to_i
</span>  end
<span class="err">
</span>  def add_one
    @amount + 1
  end
<span class="p">end
</span></code></pre></div></div>

<p>And now our test fails because we no longer have an error when a string is passed into the constructor. So we
update the new test to fit the new behavior.</p>

<div class="language-diff highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">describe '#add_one' do
</span>  context 'when amount is a string' do
    let(:amount) { '1' }
    subject { CustomAddingClass.new(amount).add_one }
    
<span class="gd">-    it { is_expected_to raise_error(TypeError) }
</span><span class="gi">+    it { is_expected_to equal(2) }
</span>  end
<span class="p">end
</span></code></pre></div></div>

<p>All we’ve done here is replace is the assertion that the class will raise an error with the new assertion
that we expect it to return the originally expected value.</p>

<p>And all tests pass again.</p>

<p>Huzzah! Now you can rest easy as you’ve proven how the bug manifests and the fix.</p>

<p>TDD implemented for bug fixing.</p>]]></content><author><name></name></author><category term="tdd," /><category term="bdd," /><category term="test" /><category term="driven" /><category term="development," /><category term="ruby," /><category term="rspec" /><summary type="html"><![CDATA[Why One of the things I see most on job descriptions, brought up in interviews, and thrown around in general programming discussion is Test Driven Development. For the most part, everyone understands how the methology works and how to implement it. But, I see a lot of developers miss out on the benefits when it comes to fixing a bug.]]></summary></entry><entry><title type="html">There’s more to learning to fish than buying a pole.</title><link href="https://cooksey.io/2018/07/01/there-s-more-to-learning-to-fish-than-buying-a-pole.html" rel="alternate" type="text/html" title="There’s more to learning to fish than buying a pole." /><published>2018-07-01T10:14:00-05:00</published><updated>2018-07-01T10:14:00-05:00</updated><id>https://cooksey.io/2018/07/01/there-s-more-to-learning-to-fish-than-buying-a-pole</id><content type="html" xml:base="https://cooksey.io/2018/07/01/there-s-more-to-learning-to-fish-than-buying-a-pole.html"><![CDATA[<p>I’ve been learning to fish. I’ve learned this is, in fact, not how it works.</p>

<p><img src="/assets/images/learning-to-fish.webp" alt="It turns out that there's more to fishing than buying a pole" width="80%" /></p>]]></content><author><name></name></author><category term="fishing," /><category term="fishing" /><category term="pole," /><category term="trout," /><category term="ambitions," /><category term="stupidity" /><summary type="html"><![CDATA[I’ve been learning to fish. I’ve learned this is, in fact, not how it works.]]></summary></entry></feed>