<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rob Crouch</title>
    <description>The latest articles on DEV Community by Rob Crouch (@fuzzwah).</description>
    <link>https://dev.to/fuzzwah</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1883624%2F97870112-152a-4697-b6b0-0cb8598c5b8d.jpg</url>
      <title>DEV Community: Rob Crouch</title>
      <link>https://dev.to/fuzzwah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fuzzwah"/>
    <language>en</language>
    <item>
      <title>day dreaming of v5</title>
      <dc:creator>Rob Crouch</dc:creator>
      <pubDate>Fri, 23 Aug 2024 03:55:22 +0000</pubDate>
      <link>https://dev.to/fuzzwah/day-dreaming-of-v5-1a0e</link>
      <guid>https://dev.to/fuzzwah/day-dreaming-of-v5-1a0e</guid>
      <description>&lt;p&gt;I'm elbows deep in a refactor of my project. It relies on django, postgresql, a bunch of math/science/statistics libraries, interfaces with discord, and collects data from a 3rd party API. All running old school style on a debian vps.&lt;/p&gt;

&lt;p&gt;Every part of this was due for a refresh, as I'd version pinned all the key parts.&lt;/p&gt;

&lt;p&gt;This required refactor had been started and burned out on a few times, but with a deadline on the introduction of this new 3rd party API. The current production system scrapes from a different data source. The schema has dramatically changed.&lt;/p&gt;

&lt;p&gt;So I'm working towards what I refer to as Version 4 of the project.&lt;/p&gt;

&lt;p&gt;Because of this I'm day dreaming about what I'd do if I was going to do a complete rewrite rather than this refactor. &lt;/p&gt;

&lt;p&gt;I'm dumping these intrusive thoughts out here so I can focus on the immediate task to hand and return to these notes when I've got V4 out the door, all bedded in and "done".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7f2h85luyvkiok64c309.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F7f2h85luyvkiok64c309.png" alt="Image description" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. 3rd party data requests should be cached
&lt;/h3&gt;

&lt;p&gt;Compress the "seldom used" json files, leave the test/dev data raw. This way if required the entire database can be rebuilt from this collection of data rather than having to make all the API calls again.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhhq3qe2zkjdw7n93goxq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhhq3qe2zkjdw7n93goxq.png" alt="Image description" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  2. output generated in response to a user request should be cached
&lt;/h3&gt;

&lt;p&gt;For some percentage (subquest: calculate the ballpark) of content that is generated in response to user requests won't change over time. All of these should returned cached output.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8hzbevi10e0wdbtgs81f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8hzbevi10e0wdbtgs81f.png" alt="Image description" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  3. split more things out into single function process, feed these from a job queue
&lt;/h3&gt;

&lt;p&gt;Currently my system has a few large "apps" that do a complete process from start to finish. This slows down testing and debugging.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxne37d3r3gtozhwgxueu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxne37d3r3gtozhwgxueu.png" alt="Image description" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  4. raw SQL queries as much as possible
&lt;/h3&gt;

&lt;p&gt;Use a framework and it's ORM where it makes sense (model definition, migrations, external API endpoints, user settings, etc), but for the core data store/retrieve; just do SQL. Obviously with a nice connection/cursor -&amp;gt; data structure wrapper.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv2uujz80tflrupznlnss.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fv2uujz80tflrupznlnss.png" alt="Image description" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5. a fast and efficient test harness is crucial
&lt;/h3&gt;

&lt;p&gt;Many of the points above also combine into improving testing. For example, once the outputs of user commands are cached; it's simple to replay a command and compare outputs as a simple automated regression test process. Similarly, splitting out the functions of the current large "self contained" processes makes testing far simpler.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwqd7e12trmj6r04ox7x7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwqd7e12trmj6r04ox7x7.png" alt="Image description" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  6. automate monitoring of key "steps" in the flow from user to the system and back to user
&lt;/h3&gt;

&lt;p&gt;Set up appropriate calls to action when these have errors.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8giks98gtrev4xk267uf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8giks98gtrev4xk267uf.png" alt="Image description" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  7. monitor the incoming data from the 3rd party API for schema changes
&lt;/h3&gt;

&lt;p&gt;Gracefully deal with as many edge cases you can think of.&lt;/p&gt;

&lt;p&gt;So yeah, &lt;strong&gt;tl;dr&lt;/strong&gt; is: I want to use Elixir and Phoenix so much for Version 5 :)&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Hello, void... may I scream into you?</title>
      <dc:creator>Rob Crouch</dc:creator>
      <pubDate>Thu, 15 Aug 2024 21:53:27 +0000</pubDate>
      <link>https://dev.to/fuzzwah/hello-void-may-i-scream-into-you-i50</link>
      <guid>https://dev.to/fuzzwah/hello-void-may-i-scream-into-you-i50</guid>
      <description>&lt;p&gt;The hardest part of a refactor is suppressing the desire to make it a rewrite.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foa80269lg27jp1lt0okw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foa80269lg27jp1lt0okw.png" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
