<?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: Seth T.T</title>
    <description>The latest articles on DEV Community by Seth T.T (@stickyfingies).</description>
    <link>https://dev.to/stickyfingies</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%2F818849%2Fb8f11fd1-334f-455d-9559-66addd03cba9.jpeg</url>
      <title>DEV Community: Seth T.T</title>
      <link>https://dev.to/stickyfingies</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stickyfingies"/>
    <language>en</language>
    <item>
      <title>Tech Story: C++ compiler behavior in a technical interview</title>
      <dc:creator>Seth T.T</dc:creator>
      <pubDate>Sat, 14 Dec 2024 23:15:47 +0000</pubDate>
      <link>https://dev.to/stickyfingies/tech-story-c-compiler-behavior-in-a-technical-interview-c7n</link>
      <guid>https://dev.to/stickyfingies/tech-story-c-compiler-behavior-in-a-technical-interview-c7n</guid>
      <description>&lt;p&gt;&lt;strong&gt;Interviewer:&lt;/strong&gt; Given this example C++ function which assigns a local vector &lt;code&gt;a&lt;/code&gt; into another local vector &lt;code&gt;b&lt;/code&gt; then &lt;code&gt;return b&lt;/code&gt;, would the compiler optimize the copy (&lt;code&gt;a&lt;/code&gt; -&amp;gt; &lt;code&gt;b&lt;/code&gt;) into a move?&lt;/p&gt;

&lt;h4&gt;
  
  
  My Response
&lt;/h4&gt;

&lt;p&gt;I can't tell you the answer, because I don't know.  But I can tell you how I would figure it out resourcefully, and we can talk about the effectiveness of my approach.&lt;/p&gt;

&lt;p&gt;Here, we're dealing with copies into returned local values, and asking whether the compiler would optimize the copy into a move.&lt;/p&gt;

&lt;h4&gt;
  
  
  Gut feelings
&lt;/h4&gt;

&lt;p&gt;Automatically, my brain is going to pull memories from past programming experience and consumed media which may be relevant to the example.  Any information relevant to answering the problem will be used to make a "gut prediction," which provides two outputs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;(A) an expected outcome (yes, the optimization happens)&lt;/li&gt;
&lt;li&gt;(B) my confidence in the prediction (not confident at all xD)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After a couple of seconds, my brain will retro-fit an explanation onto those two data points, and that is when the "slow thinking" brain can analyze my prediction and make decisions.  Here are the explanations my brain generated:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;(A) Yes, the optimization happens because I've seen the C++ term "Return Value Optimization" thrown around various forums, and that seems relevant to the problem.  I also don't remember seeing examples of using &lt;code&gt;std::move&lt;/code&gt; in return statements, so I lack reasons to think the answer is actually "no."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(B) My understanding of C++ has a lot of "unknown unknowns" r.e. its complex language semantics and optimization rules.  I know that otherwise-trivial structs and classes do become non-trivial if any of their instance variables are non-trivial.  This makes struct triviality a "viral" data property that can butterfly-effect how the compiler might optimize a piece of code.  I don't know if other "viral properties" exist which can also change compiler behavior, and without knowing that it becomes impossible to reason about how the compiler will behave.  So, my brain throws its squishy hands in the air and says "impossible to predict."&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Basically, I don't make any assumptions about C++ because I know better.  So... how do I figure out the answer?&lt;/p&gt;

&lt;h4&gt;
  
  
  Use Resources
&lt;/h4&gt;

&lt;p&gt;Step 1:  Google.  Always.  Starting with what I know, I'd probably google "return value optimization" + "move semantics" as a query to find literature that relates those two topics.  Stack Overflow is a moderated source-of-truth for popular questions, and might have a good answer if the question is popular enough to have received moderator attention.&lt;/p&gt;

&lt;p&gt;But let's assume Stack Overflow is down for maintenance or my internet is disconnected and I &lt;em&gt;can't&lt;/em&gt; Google the answer.  How would I figure this out?  Simple: compare the assembly.&lt;/p&gt;

&lt;h4&gt;
  
  
  Analyze Evidence
&lt;/h4&gt;

&lt;p&gt;Step 2: I would compile the example program using zero optimization (&lt;code&gt;-O0&lt;/code&gt;) and full optimization (-&lt;code&gt;O3&lt;/code&gt;) and make the compiler emit assembly code (&lt;code&gt;-S&lt;/code&gt;) instead of an executable.  Comparing the assembly side-by-side, we can evaluate any code differences and make a prediction about whether the copy was optimized into a move.  I say 'prediction' and not 'answer' in case the assembly is difficult to interpret or in case other optimizations are occluding the evidence we're looking for.&lt;/p&gt;

&lt;h4&gt;
  
  
  Learn the Rules
&lt;/h4&gt;

&lt;p&gt;But this still only gives us the answer in &lt;em&gt;this particular case.&lt;/em&gt;  If we change the code, or look at an example of a real production codebase, the answer might not be the same, and unless we know &lt;strong&gt;exactly&lt;/strong&gt; what rules the compiler follows to optimize copies, you'll always have to re-compile the code and evaluate the assembly to know &lt;strong&gt;for sure&lt;/strong&gt; the optimization happened.&lt;/p&gt;

&lt;p&gt;That's where my brain goes.  Cheers!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>On Commercial Software Evolution</title>
      <dc:creator>Seth T.T</dc:creator>
      <pubDate>Thu, 10 Oct 2024 03:32:53 +0000</pubDate>
      <link>https://dev.to/stickyfingies/on-commercial-software-evolution-5db</link>
      <guid>https://dev.to/stickyfingies/on-commercial-software-evolution-5db</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;Cover image by Wikimedia Commons.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This article models the free market using Stuart Kauffman's &lt;a href="https://en.wikipedia.org/wiki/Fitness_landscape" rel="noopener noreferrer"&gt;Fitness Landscape&lt;/a&gt; to understand its influence upon, and from, commercial software products.&lt;/p&gt;

&lt;p&gt;Bolded vocabulary terms are used across article sections.&lt;/p&gt;

&lt;h2&gt;
  
  
  Fitness Landscape
&lt;/h2&gt;

&lt;p&gt;From Wikipedia:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;In evolutionary biology, fitness landscapes or adaptive landscapes (types of evolutionary landscapes) are used to visualize the relationship between genotypes and reproductive success.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A few key points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a &lt;strong&gt;genotype&lt;/strong&gt; is a collection of features intrinsic to some individual or population.&lt;/li&gt;
&lt;li&gt;reproductive success can be generalized as &lt;strong&gt;fitness value&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here's an example of a fitness landscape visualization:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2efah61iw6ir3237srp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fh2efah61iw6ir3237srp.png" alt="visualization of fitness landscape" width="440" height="321"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, the 2D horizontal axes represent the &lt;strong&gt;genotype&lt;/strong&gt;, and the 1D vertical axis represents the &lt;strong&gt;fitness value&lt;/strong&gt;.  In reality, the genotype may be more than 2 dimensions.  It may be useful to imagine the genotype as an N-dimensional collection of various qualities.&lt;/p&gt;

&lt;p&gt;From Wikipedia:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Genotypes which are similar are said to be "close" to each other, while those that are very different are "far" from each other.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This helps us compare different genotypes across the landscape.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dynamic Structure
&lt;/h2&gt;

&lt;p&gt;Ann &lt;strong&gt;evolution function&lt;/strong&gt; defines the &lt;strong&gt;fitness value&lt;/strong&gt; for every distinct &lt;strong&gt;genotype&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Here's one example of an &lt;strong&gt;evolution function&lt;/strong&gt; moving and resizing the hills on a fitness landscape:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fenbqvwty8l4q3nbf7ykk.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fenbqvwty8l4q3nbf7ykk.gif" alt="animated visualization of a static and dynamic fitness landscape" width="480" height="270"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A few observations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;evolution function&lt;/strong&gt; doesn't introduce any "cliffs" or "holes" in the fitness landscape.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;evolution function&lt;/strong&gt; is perpetual, and does not stop at any time.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We also see a collection of distinct gray &lt;strong&gt;species&lt;/strong&gt; on the landscape's surface.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each &lt;strong&gt;species&lt;/strong&gt; corresponds with some unique &lt;strong&gt;genotype&lt;/strong&gt; at any point in time.&lt;/li&gt;
&lt;li&gt;Each &lt;strong&gt;species&lt;/strong&gt; can move across the landscape by changing its &lt;strong&gt;genotype&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From now on, the &lt;strong&gt;landscape function&lt;/strong&gt; is the evolution function that changes the surface of the fitness landscape, and the &lt;strong&gt;species function&lt;/strong&gt; is the evolution function that moves species across the surface of the landscape.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Commercial Software Market
&lt;/h2&gt;

&lt;p&gt;The below translation is generally a gross over-simplification, but for the purposes of this article, it'll do just fine.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Fitness Landscape&lt;/th&gt;
&lt;th&gt;Commercial Software Market&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Species&lt;/td&gt;
&lt;td&gt;Software product&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Genotypes&lt;/td&gt;
&lt;td&gt;Features&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Fitness value&lt;/td&gt;
&lt;td&gt;Feature/product value&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Species function&lt;/td&gt;
&lt;td&gt;Producer behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Landscape function&lt;/td&gt;
&lt;td&gt;Consumer behavior&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;⬆️ &lt;strong&gt;You can ignore this table, it's just for reference.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Some key points:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A software product is a collection of features&lt;/li&gt;
&lt;li&gt;Consumer behavior affects feature value, and transitively, product value&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As with evolutionary biology, producers must evolve their software products to stay in business, or else they die.  The ability of a producer to evolve their products over time is &lt;strong&gt;more&lt;/strong&gt; necessary to their long-term survival than having maximally-valuable products.&lt;/p&gt;

&lt;p&gt;For this reason, it's important for producers to have &lt;em&gt;some&lt;/em&gt; control over their &lt;strong&gt;species function&lt;/strong&gt; so they can remain in business.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Fun fact: some producers are able to routinely ship poor-quality software products, because their &lt;strong&gt;species function&lt;/strong&gt; is just adaptive enough to keep them alive.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Since we're modeling producer and consumer behavior using evolution functions, we can explore the mathematical structure of these functions to better understand the market.&lt;/p&gt;

&lt;h2&gt;
  
  
  Producers and Consumers
&lt;/h2&gt;

&lt;p&gt;Consumer demand evolves smoothly and continuously over time.  Software, however, is shipped and released on a discrete time schedule.  Consumers perceive spontaneous "jumps" as new features are introduced or removed from a software product.&lt;/p&gt;

&lt;p&gt;Producers dislike this asymmetry, because a set of features under development may become less valuable by the time they are released.  When producers cannot react quickly or regularly to consumers, the &lt;strong&gt;landscape function&lt;/strong&gt; has outpaced the &lt;strong&gt;species function.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is evident from the growing popularity of &lt;a href="https://en.wikipedia.org/wiki/Agile_software_development" rel="noopener noreferrer"&gt;Agile Software Development&lt;/a&gt;, a methodology for producers to accelerate their &lt;strong&gt;species function&lt;/strong&gt; and keep pace with the consumer landscape.&lt;/p&gt;

&lt;h2&gt;
  
  
  Agile Software Development
&lt;/h2&gt;

&lt;p&gt;The four main principles of Agile, according to &lt;a href="https://en.wikipedia.org/wiki/Agile_software_development" rel="noopener noreferrer"&gt;Wikipedia&lt;/a&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Individuals and interactions&lt;/strong&gt; over processes and tools&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Working software&lt;/strong&gt; over comprehensive documentation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Customer collaboration&lt;/strong&gt; over contract negotiation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Responding to change&lt;/strong&gt; over following a plan&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The critical point is &lt;strong&gt;responding to change&lt;/strong&gt;.  Agile places a great emphasis on&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;detecting change in the fitness landscape&lt;/li&gt;
&lt;li&gt;nudging your genotype towards areas with a higher fitness&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In effect, Agile allows producers to be more confident that whatever features they ship will be in demand by the time they are released.&lt;/p&gt;

&lt;p&gt;While this is generally effective, there are some interesting costs associated with having a higher-pace evolution function.&lt;/p&gt;

&lt;h2&gt;
  
  
  Technical Debt
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;This section is subjective.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For software, it is faster and easier to expand an existing product, than to build a new one entirely.  Producers are generally suspicious of building new products in existing high-fitness areas, and will prefer to push an existing software product towards locally-fit areas whenever possible.&lt;/p&gt;

&lt;p&gt;Even when expanding to new consumer markets (new "hills" on the fitness landscape), a producer will opt to Frankenstein-surgery their existing software onto that hill, and will only create a new product if absolutely necessary.&lt;/p&gt;

&lt;p&gt;What happens is the species function slows as the number of features becomes larger.  The high-paced species function that once benefited our species has since become cancerous, chaining the software product's ability to evolve with consumer demand.&lt;/p&gt;

&lt;p&gt;Companies experience this as &lt;strong&gt;technical debt&lt;/strong&gt;, and it's generally difficult to solve because of how immensely complex their software has become.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Solution
&lt;/h2&gt;

&lt;p&gt;If you've made it this far, thank you.&lt;/p&gt;

&lt;p&gt;I believe, but am not certain, there is no "golden pace" for software development to avoid technical debt.  I believe that every commercial software product will encounter it in some form, by virtue of the discrete evolution function.&lt;/p&gt;

&lt;p&gt;I believe, but am not certain, that we can develop software without technical debt.  And for as long as I strive to build better software, I will continue to believe that.&lt;/p&gt;

&lt;p&gt;From Sofia Konobievska: &lt;a href="https://hackernoon.com/how-to-sell-a-technical-debt-from-a-devops-perspective" rel="noopener noreferrer"&gt;How to Sell Technical Debt from a DevOps Perspective?&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Thank you for reading, and enjoy your next day.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>learning</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>vcpkg - how to modify dependencies</title>
      <dc:creator>Seth T.T</dc:creator>
      <pubDate>Fri, 27 Sep 2024 18:17:56 +0000</pubDate>
      <link>https://dev.to/stickyfingies/vcpkg-how-to-modify-dependencies-fk5</link>
      <guid>https://dev.to/stickyfingies/vcpkg-how-to-modify-dependencies-fk5</guid>
      <description>&lt;h2&gt;
  
  
  Purpose
&lt;/h2&gt;

&lt;p&gt;This tutorial is made for existing projects that use vcpkg to manage their C++ dependencies.&lt;/p&gt;

&lt;p&gt;Sometimes, it becomes necessary to modify some elements of a C++ library that your project depends on.  Modifications can include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Changing compilation flags&lt;/li&gt;
&lt;li&gt;Changing installation strategies&lt;/li&gt;
&lt;li&gt;Changing source code&lt;/li&gt;
&lt;li&gt;Changing static data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This tutorial demonstrates how to apply these changes to a dependency installed with vcpkg in a way that's &lt;strong&gt;cheap,&lt;/strong&gt; &lt;strong&gt;shareable,&lt;/strong&gt; and &lt;strong&gt;permanent&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The full process can be completed in 15 minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Structure
&lt;/h2&gt;

&lt;p&gt;We'll use a mock project structure, like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project/
 |-- include/
 |-- src/
 |-- vcpkg/
 |-- CMakeLists.txt
 |-- README.md
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we'd likely set up the vcpkg CLI utility, like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# pwd: at project root&lt;/span&gt;
&lt;span class="nb"&gt;chmod&lt;/span&gt; +x ./vcpkg/bootstrap-vcpkg.sh
./vcpkg/bootstrap-vcpkg.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step (1 of 4): Create a Local Registry
&lt;/h2&gt;

&lt;p&gt;The first change we'll make to the project structure is making a directory to hold our vcpkg portfiles.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A &lt;a href="https://learn.microsoft.com/en-us/vcpkg/concepts/ports#portfile-portfilecmake" rel="noopener noreferrer"&gt;Port&lt;/a&gt; is a small, cheap collection of metadata files which instruct vcpkg on how to download, configure, build, and install your dependencies.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;To customize our dependency, we're going to copy its portfiles and place them in our own custom registry.&lt;/p&gt;

&lt;p&gt;First, let's create a directory to hold our vcpkg portfiles:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# pwd: at project root&lt;/span&gt;
&lt;span class="nb"&gt;mkdir &lt;/span&gt;registry
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Call it whatever you'd like.  This tutorial refers to it as a &lt;strong&gt;local registry.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step (2 of 4): Copy the Port Files
&lt;/h2&gt;

&lt;p&gt;This tutorial will use the fake "foobaz" package as an example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# pwd: at project root&lt;/span&gt;
./vcpkg/vcpkg &lt;span class="nb"&gt;install &lt;/span&gt;foobaz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We're going to copy the &lt;code&gt;foobaz&lt;/code&gt; portfiles into our &lt;strong&gt;local registry&lt;/strong&gt; in order to apply our modifications in the future.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# pwd: at project root&lt;/span&gt;
&lt;span class="nb"&gt;cp&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt; ./vcpkg/ports/foobaz ./registry/foobaz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Take a look inside &lt;code&gt;./registry/foobaz&lt;/code&gt; and you'll probably see three files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;project/
 |-- registry/
 |    |-- foobaz/
 |    |    |-- build_fixes.patch
 |    |    |-- portfile.cmake
 |    |    |-- vcpkg.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let's examine each of them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;build_fixes.patch&lt;/code&gt; is a &lt;strong&gt;git diff&lt;/strong&gt; that vcpkg applies to your dependency's source tree before compiling and installing it.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;portfile.cmake&lt;/code&gt; is a &lt;strong&gt;cmake script&lt;/strong&gt; that tells vcpkg where to find your dependency's source tree, plus some other stuff.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;vcpkg.json&lt;/code&gt; is a &lt;strong&gt;metadata file&lt;/strong&gt; that's conceptually similar to a package.json file from the Node.js universe.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's recommended to keep &lt;code&gt;vcpkg.json&lt;/code&gt; the same.&lt;/p&gt;

&lt;p&gt;This tutorial is going to demonstrate how to generate a new &lt;code&gt;build_fixes.patch&lt;/code&gt; file, and it will contain the modifications you want to apply to the source code, build configuration, etc.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Please note&lt;/strong&gt; that &lt;code&gt;portfile.cmake&lt;/code&gt; is run in CMake's script mode, so we &lt;strong&gt;cannot&lt;/strong&gt; use this to change build parameters for our dependency.  Those must be modified from within the &lt;code&gt;build_fixes.patch&lt;/code&gt; instead.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step (3 of 4): Generating a Patch File
&lt;/h2&gt;

&lt;p&gt;Awesome, it's time to make some changes!&lt;/p&gt;

&lt;p&gt;First, clone the dependency's source tree, so we can make our changes.  This is a temporary folder that won't be checked into your git project.  I'm cloning inside of &lt;code&gt;registry/foobaz&lt;/code&gt; for convenience, but you may put it anywhere you'd like.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# pwd: at project/registry/foobaz&lt;/span&gt;
git clone https://github.com/username/foobaz.git &lt;span class="nb"&gt;source&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we're going to apply the existing &lt;code&gt;build_fixes.patch&lt;/code&gt; file on top of the source tree.  This puts our dependency's source into the state that vcpkg uses by default when you install it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# pwd: at project/registry/foobaz/source&lt;/span&gt;
git apply ../build_fixes.patch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, it's time to make your changes!  You can modify the &lt;code&gt;CMakeLists.txt&lt;/code&gt; to adjust build configuration, comment out source files, introduce new code, whatever the hell you want.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExazZsd2RmbHBrczBoYzlxcWdpYnkxdjgxcHhoZnJiZDhieHdhMWNqdSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2Fl0HlDUUzqPf4V17HO%2Fgiphy.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExazZsd2RmbHBrczBoYzlxcWdpYnkxdjgxcHhoZnJiZDhieHdhMWNqdSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2Fl0HlDUUzqPf4V17HO%2Fgiphy.webp" alt="Dancing Cat GIF"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After applying your modifications, create a new &lt;strong&gt;git diff&lt;/strong&gt; file.  This overwrites the existing &lt;code&gt;build_fixes.patch&lt;/code&gt; with the changes you've just made (plus whatever was already there).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# pwd: at project/registry/foobaz/source&lt;/span&gt;
git diff &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; ../build_fixes.patch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remove the source tree when you're done.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# pwd: at project/registry/foobaz&lt;/span&gt;
&lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &lt;span class="nb"&gt;source&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Finale (4 of 4): Use your Modified Dependency
&lt;/h2&gt;

&lt;p&gt;It is necessary to remove &lt;code&gt;foobaz&lt;/code&gt; from vcpkg so that we can re-install our modified version.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# pwd: at project/&lt;/span&gt;
./vcpkg/vcpkg remove foobaz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;From now on&lt;/strong&gt;, to make vcpkg download your modified dependency, the CLI tool must be invoked like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# pwd: at project/&lt;/span&gt;
./vcpkg/vcpkg &lt;span class="nb"&gt;install &lt;/span&gt;foobaz &lt;span class="nt"&gt;--overlay-ports&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;registry/foobaz
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Check it out!  &lt;strong&gt;You're done!&lt;/strong&gt; 🎈&lt;/p&gt;

&lt;p&gt;Find me on &lt;a href="https://github.com/stickyfingies" rel="noopener noreferrer"&gt;github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>vcpkg</category>
      <category>cpp</category>
      <category>cmake</category>
      <category>dependency</category>
    </item>
    <item>
      <title>My Struggle Learning Set Theory as a Programmer</title>
      <dc:creator>Seth T.T</dc:creator>
      <pubDate>Thu, 07 Dec 2023 06:31:33 +0000</pubDate>
      <link>https://dev.to/stickyfingies/my-struggle-learning-set-theory-as-a-programmer-23di</link>
      <guid>https://dev.to/stickyfingies/my-struggle-learning-set-theory-as-a-programmer-23di</guid>
      <description>&lt;p&gt;&lt;em&gt;Cover image from &lt;a href="https://commons.wikimedia.org/wiki/File:Padlock_and_chain_0675.jpg"&gt;Wikimedia Commons&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I'm Seth, an undergrad student with an established background in computer science.&lt;/p&gt;

&lt;p&gt;This article introduces the bare fundamentals of set theory, then compares mathematical sets with some common data structures and type systems found in computer science.&lt;/p&gt;




&lt;h2&gt;
  
  
  Sets
&lt;/h2&gt;

&lt;p&gt;Paraphrasing &lt;a href="https://en.wikipedia.org/wiki/Set_(mathematics)"&gt;Wikipedia&lt;/a&gt;,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A set is a collection of different things,&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A set contains elements which can be information of any kind: numbers, shapes, people, ...&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Okay, my bedroom is a collection of laundry and furniture, so &lt;code&gt;Room = {laptop charger, old sock, soft bed}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Next,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Sets are uniquely &lt;strong&gt;characterized by their elements.&lt;/strong&gt; Two sets that have precisely the same elements are equal.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This implies that any set containing exactly &lt;code&gt;{laptop charger, old sock, soft bed}&lt;/code&gt; &lt;em&gt;is literally my room.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This took me a while to understand!  Last thing,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Given two sets, &lt;code&gt;X&lt;/code&gt; is a subset of &lt;code&gt;Y&lt;/code&gt; if every element of &lt;code&gt;X&lt;/code&gt; is also an element of &lt;code&gt;Y&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, for example, the set &lt;code&gt;X = {1, 3}&lt;/code&gt; is a subset of &lt;code&gt;Y = {1, 2, 3}&lt;/code&gt; because &lt;code&gt;Y&lt;/code&gt; contains every element of &lt;code&gt;X&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now, let's see how pure mathematical sets compare with real-world computer data structures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data Structures
&lt;/h2&gt;

&lt;p&gt;Here's a few data structures that built my preconceptions about mathematical sets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;Array&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Set&amp;lt;T&amp;gt;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Being familiar with these data structures helped me tremendously while learning set theory, but later came to hinder me in some interesting ways.&lt;/p&gt;

&lt;p&gt;Computers are bound to certain time- and space- constraints that affect how data structures behave.  In conceptual math, there is no "computer" moving information around; the information just.. exists, hanging in a timeless void.&lt;/p&gt;

&lt;h3&gt;
  
  
  Arrays
&lt;/h3&gt;

&lt;p&gt;An array may contain duplicate information, unlike a mathematical set.  Otherwise, my intuition about arrays helped me a lot when learning set theory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// :(&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bad&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Sets
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Set_(abstract_data_type)"&gt;Set (data structure)&lt;/a&gt; introduces a guarantee of uniqueness.  But, a key distinction is that two mathematical sets containing identical elements are the same object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// These are identical sets,&lt;/span&gt;
&lt;span class="c1"&gt;// but not the same object.&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;A&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;B&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Consider that both &lt;code&gt;A&lt;/code&gt; and &lt;code&gt;B&lt;/code&gt; have unique memory addresses, effectively duplicating the contents of the set.  Mathematical sets don't allow such duplication.&lt;/p&gt;

&lt;p&gt;Armed with a proper intuition about how sets might behave on a computer, let's look at type systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Type Systems
&lt;/h2&gt;

&lt;p&gt;Consider the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;A&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, &lt;code&gt;number&lt;/code&gt; is a mathematical set containing all possible numeric values, and &lt;code&gt;A&lt;/code&gt; is a mathematical set containing &lt;code&gt;{1, 2, 3}&lt;/code&gt;.  Therefore, &lt;code&gt;A&lt;/code&gt; is a subset of &lt;code&gt;number&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This nicely demonstrates why programmers like using strongly-typed programming languages.&lt;/p&gt;

&lt;p&gt;A strongly typed programming language's compiler will strongly enforce that all of your variables are subsets of their type.&lt;/p&gt;

&lt;p&gt;So, you couldn't have code like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;A&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;because neither &lt;code&gt;1&lt;/code&gt;, &lt;code&gt;2&lt;/code&gt; nor &lt;code&gt;3&lt;/code&gt; exist in the set of all possible strings.&lt;/p&gt;

&lt;p&gt;But wait a minute! Both &lt;code&gt;number&lt;/code&gt; and &lt;code&gt;string&lt;/code&gt; are sets, but they don't consume memory in the way that &lt;code&gt;[1, 2, 3]&lt;/code&gt; does!  This property of "tangibility" is a key aspect of modern computer science, but mathematics has no such delineation between compile-time and run-time.&lt;/p&gt;

&lt;p&gt;While learning set theory, adapting this intuition was by far my biggest struggle.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Edge of Space
&lt;/h2&gt;

&lt;p&gt;Imagine the x-y coordinate plane (formally, a Cartesian product of the real numbers, ℝxℝ).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ov39sii6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p7vvyg9t36cw0cevb2qx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ov39sii6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p7vvyg9t36cw0cevb2qx.jpg" alt="x y plane" width="487" height="442"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The coordinate plane does not exist on some background-space.  It isn't &lt;em&gt;contained&lt;/em&gt; by anything.  Rather, the coordinate plane just.. exists.&lt;/p&gt;

&lt;p&gt;Computers, on the other hand, have a memory-space that contains everything.  Absurdly, every variable in every running program is a subset of that memory-space!&lt;/p&gt;

&lt;p&gt;Contrast this with types, like &lt;code&gt;number&lt;/code&gt;, &lt;code&gt;string&lt;/code&gt;, and &lt;code&gt;Dog&lt;/code&gt;.  These types are much more like the x-y coordinate plane: they don't really exist &lt;em&gt;anywhere&lt;/em&gt;, rather, they define a space on which everything else is allowed to exist.&lt;/p&gt;

&lt;p&gt;Such was my struggle when learning set theory from a CS-background.  I came from a place where data exists somewhere, consumes space, and takes time to create.  Pure math is timeless, beyond space, and honestly it fucking scares me.  I'll stick with code, please!&lt;/p&gt;

&lt;h2&gt;
  
  
  Addendum: Code Example
&lt;/h2&gt;

&lt;p&gt;I was building a little example while writing this article, and I decided to include it for fun.&lt;/p&gt;

&lt;p&gt;Given two sets, A and B:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// A is a set&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;A&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;span class="c1"&gt;// B is a set&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;B&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;we can define the subset function like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 * @typeParam X - A type, like number or string
 * @typeParam Y - A type, like number or string
 * @param a - Set containing values of type X
 * @param b - Set containing values of type Y
 * @return true if a is a subset of b
 **/&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;subset&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Y&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;X&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Y&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nf"&gt;subset&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;A&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;B&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// true&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we see that X and Y are types.  That makes them intangible sets (loose definition), because they consume no memory and you can't print them.  Rather, X and Y define the &lt;em&gt;possibility space&lt;/em&gt; of values which &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; are allowed to hold.&lt;/p&gt;

&lt;p&gt;Further, we see that &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; are variables.  That makes them tangible sets (by contrast), because they consume memory and can be interacted with.  The type system guarantees that &lt;code&gt;a&lt;/code&gt; is a subset of X, and &lt;code&gt;b&lt;/code&gt; is a subset of Y, but it cannot guarantee that &lt;code&gt;a&lt;/code&gt; is a subset of &lt;code&gt;b&lt;/code&gt;.  This computation, sadly, must be done at run-time.&lt;/p&gt;




&lt;p&gt;That's all I've got.&lt;/p&gt;

&lt;p&gt;Find me on &lt;a href="https://github.com/stickyfingies"&gt;github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devjournal</category>
      <category>computerscience</category>
      <category>math</category>
    </item>
    <item>
      <title>Creating a Market Simulator at Work</title>
      <dc:creator>Seth T.T</dc:creator>
      <pubDate>Tue, 05 Dec 2023 06:49:06 +0000</pubDate>
      <link>https://dev.to/stickyfingies/my-job-creating-a-market-simulator-171c</link>
      <guid>https://dev.to/stickyfingies/my-job-creating-a-market-simulator-171c</guid>
      <description>&lt;p&gt;&lt;em&gt;Cover image: Koondaiira on &lt;a href="https://www.deviantart.com/koondaiira/art/Pokeballs-874361728"&gt;DeviantArt&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Our team optimized and rebuilt a simulator for the futures and options (F&amp;amp;O) exchange.&lt;/p&gt;




&lt;h2&gt;
  
  
  What?
&lt;/h2&gt;

&lt;p&gt;The F&amp;amp;O exchange is a massive software product with many moving parts.  Cloud computers run multiple copies of the exchange simultaneously: some make up the real exchange that customers use, but most are just simulations.  Software engineers often use simulations to verify their work and try new things.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bRISyTxh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e2sywgipj3j0te3g9yc7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bRISyTxh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e2sywgipj3j0te3g9yc7.png" alt="Computers run code to simulate a program." width="800" height="696"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Simulations are VERY useful for lots of reasons.  We'll explore one in particular.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quality Assurance
&lt;/h2&gt;

&lt;p&gt;All customers &lt;strong&gt;&lt;em&gt;hate&lt;/em&gt;&lt;/strong&gt; buying shitty software, so it's mission-critical to fix every bug before selling your app or service.  But the futures&amp;amp;options exchange is &lt;em&gt;massive&lt;/em&gt;, and we're updating it all the time!  How do you manage to catch all the bugs in such a big piece of software?&lt;/p&gt;

&lt;p&gt;Automated testing is the answer.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lUcl9IoW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jzmujtumat3hrxpox1sz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lUcl9IoW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jzmujtumat3hrxpox1sz.png" alt="A series of testing suites validates market behavior using simulations." width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The F&amp;amp;O exchange is rigorously vetted by automated testing suites.  Each suite is powered by its own simulation, like in the picture.  Suites interact with the simulation and watch its behavior for defects.  This process automatically catches bugs, and it works quite well.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;My role was to build a testing suite that behaves like a trader.  The pretend-trader reads English descriptions of expected market behavior, then it trades on the simulated F&amp;amp;O exchange to ensure it's behaving as described.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Simulations for Sale
&lt;/h2&gt;

&lt;p&gt;The process of creating simulations has been automated for quite some time, since so many of them are needed for automated testing.  This production process is very intricate and brittle.&lt;/p&gt;

&lt;p&gt;Here is the visualized production line for mass-producing F&amp;amp;O simulations:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zAF1jksN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dz9s7olo7n7rse8cyeh4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zAF1jksN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dz9s7olo7n7rse8cyeh4.png" alt="A long and convoluted process to creating one simulation for the F&amp;amp;O exchange" width="800" height="265"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These simulations are bulky and expensive since producing one is complicated.  Developers spend a very long time reading deployment strategies, just trying to understand how simulations are made.  Part of our team's work is to de-clutter the process of deploying a simulation.  That way, (a) simulations are cheaper to produce, and (b) it's easier for devs to understand them.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;p&gt;I have hopes, goals, and aspirations for the project, but it's technically company property so I don't want to accidentally get in trouble.  With that being said, a one-click deployment process would be sick.  Just push a single button, and &lt;strong&gt;&lt;em&gt;bam!&lt;/em&gt;&lt;/strong&gt; - you have a live, running F&amp;amp;O exchange allllllll to yourself.  Kinda like a poke-ball for the F&amp;amp;O exchange.&lt;/p&gt;

&lt;p&gt;Find me on &lt;a href="https://github.com/stickyfingies"&gt;github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devjournal</category>
    </item>
    <item>
      <title>Fantasy story about coding</title>
      <dc:creator>Seth T.T</dc:creator>
      <pubDate>Wed, 22 Nov 2023 06:38:54 +0000</pubDate>
      <link>https://dev.to/stickyfingies/fantasy-story-about-coding-2l31</link>
      <guid>https://dev.to/stickyfingies/fantasy-story-about-coding-2l31</guid>
      <description>&lt;p&gt;Hi, I'm Seth!  I like interesting stuff.  Read my article or perish.&lt;/p&gt;




&lt;h2&gt;
  
  
  A Work of Fiction
&lt;/h2&gt;

&lt;p&gt;In ancient days, &lt;code&gt;authors&lt;/code&gt; used language to write books for other writers.  Education was scarce, and if you could read - you could write, too.  It was a valuable economic skill and would not be wasted merely &lt;em&gt;reading&lt;/em&gt; - &lt;strong&gt;create, goddamnit!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the years preceeding the Apocalyptic Gargoyle Invasion (aka A.G.I.), a new type of book was engineered that would transform the United Continents of Htrae forever: a magical vessel, imbued with the powers of lightning and fire.  The &lt;code&gt;author&lt;/code&gt;, now, had a new tool at their disposal; and thus became a new entity entirely: the &lt;code&gt;mage&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;mage&lt;/code&gt; was, ultimately, similar to an author because they used fancy books to describe problems for humans.  The biggest barrier of entry, however, was the language used to express their arcane ideas.  It was dissimilar to the common tongues of the time, full of strange symbols and vibrant colors.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;an&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;example&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nf"&gt;would&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;look&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;like&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;this&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Imagine writing a book that describes a large problem to your reader, except the book itself is able to solve the problem just given your description of it.&lt;/p&gt;

&lt;p&gt;The art of magecraft is to build literature such that the problems described are understandable by humans, but also lenient on the machines that run them.&lt;/p&gt;

&lt;p&gt;That is what separates a well-written book from a poor one; a wizened mage from the scrappy apprentice.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;In case you didn't catch it:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;authors are, literally, authors&lt;/li&gt;
&lt;li&gt;mages are programmers&lt;/li&gt;
&lt;li&gt;magic books are computers&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Ethics in Programming
&lt;/h2&gt;

&lt;p&gt;Its far too easy to assume that if the reader understands computer code, then they &lt;em&gt;must&lt;/em&gt; be able to simulate the workings of a computer inside their head.  Code doesn't have to be pretty, it just has to work.  This is prone to the same flaws as thick academic literature:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;it doesn't matter how interesting the topic is, nobody will find it interesting if they can't read it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;When writing (code), place the reader first.  Always.  To progress in your programming skills means to learn new patterns and structures that allow you to communicate large, complex ideas elegantly - while being lenient on the machine that is destined to run them.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Have I met the goal outlined in the previous section?  I don't know.  The article itself is thoroughly dense, and less accessible because of it.  My coding style is getting better, but still appears a garbled mess.&lt;/p&gt;

&lt;p&gt;This article is not a reflection of my employer's values, nor my status as a programmer.&lt;br&gt;
It is merely an expression of thought.&lt;/p&gt;

&lt;p&gt;If you found this interesting let me know.&lt;br&gt;
You can find me on github at &lt;a href="https://github.com/stickyfingies"&gt;https://github.com/stickyfingies&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>devjournal</category>
    </item>
    <item>
      <title>DevOps: my faulty perspective</title>
      <dc:creator>Seth T.T</dc:creator>
      <pubDate>Wed, 22 Nov 2023 06:31:19 +0000</pubDate>
      <link>https://dev.to/stickyfingies/devops-my-faulty-perspective-3p2n</link>
      <guid>https://dev.to/stickyfingies/devops-my-faulty-perspective-3p2n</guid>
      <description>&lt;h3&gt;
  
  
  Overview
&lt;/h3&gt;

&lt;p&gt;Hello!  My name is Seth, a third-year university student.  I have nine years of independent coding experience, and have worked in software 'professionally' for approximately six months now  (it's how I pay my rent).&lt;/p&gt;

&lt;p&gt;Until recently, Developer Operations was a foreign topic to me.  But, know it or not, DevOps is a huge part of how &lt;strong&gt;everybody&lt;/strong&gt; writes code - and you do, too!  (Unless you don't code....  that's cool, I guess.)&lt;/p&gt;

&lt;p&gt;This article will help you understand DevOps from an "I've been there" perspective.  I want you to understand internet articles about DevOps, and feel like you can learn something from Reddit conversations in those areas.  It belongs to you -- own it!&lt;/p&gt;




&lt;h3&gt;
  
  
  A Weird Analogy
&lt;/h3&gt;

&lt;p&gt;Physical products are bound to some rules of economics.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5MvpJGbJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ajvniyezjz7o7l31fzod.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5MvpJGbJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ajvniyezjz7o7l31fzod.png" alt="Parts being manufactured into a thing" width="800" height="674"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Small, reusable parts are regionally mass-produced.  Big trucks ship parts between factories, where they combine to become larger, stronger parts.&lt;/p&gt;

&lt;p&gt;This process may repeat itself.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Yekzdg45--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/36m3h1r07i6x8l23psgh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Yekzdg45--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/36m3h1r07i6x8l23psgh.png" alt="Things being manufactured into a product, one thing being sold" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sometimes parts are sold directly, but other times they are shipped for further assembly and manufacturing.&lt;/p&gt;

&lt;p&gt;Software (and other virtual products) share similar infrastructure, where small reusable classes or functions combine to form stronger, more capable libs or apps.  Code is scanned, compiled, pushed, and pulled.  It's a physical resource that moves between areas.&lt;/p&gt;

&lt;p&gt;Here is what a software dev does for work:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yJyGSlw2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bxze1ewlndzapjv6bown.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yJyGSlw2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bxze1ewlndzapjv6bown.png" alt="Simple coding process" width="800" height="117"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Except it actually looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p57lcTa4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tbxpq48xbmpmlxaqjdhc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p57lcTa4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tbxpq48xbmpmlxaqjdhc.png" alt="Actual coding process" width="800" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Big projects have longer assembly lines.  Sometimes, it's so long that a human simply can't do it all.  So it's mechanized, automated, and computerized - and what better way to accomplish this?  You guessed it: using code.&lt;/p&gt;




&lt;h3&gt;
  
  
  Code Stuff
&lt;/h3&gt;

&lt;p&gt;Let's look at our coding process:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SctutXVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1f2fdyws2v0k165bqz8y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SctutXVd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1f2fdyws2v0k165bqz8y.png" alt="Code becomes product" width="800" height="110"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some code becomes part of the final product, after going through a factory.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vZtK_Tpd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x43f7oeknzwtfpe0dsw5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vZtK_Tpd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x43f7oeknzwtfpe0dsw5.png" alt="Code becomes factory" width="800" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some code &lt;strong&gt;&lt;em&gt;becomes the fucking factory.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;DevOps is, ultimately, the art and craft of understanding how code becomes a product.  It can be hard to notice in smaller projects because there simply isn't much manufacturing infrastructure to begin with.  It grows by necessity.&lt;/p&gt;

&lt;p&gt;Things you probably do&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Manually test code (by logging "foo" and "bar")&lt;/li&gt;
&lt;li&gt;Compile code and push to git&lt;/li&gt;
&lt;li&gt;Deploy a website or change your download link&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Things DevOps probably does&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatically test code&lt;/li&gt;
&lt;li&gt;Compile binaries through git hooks&lt;/li&gt;
&lt;li&gt;Deploy-after-merge&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Rest of article is TODO. I wrote this in twenty minutes and now I am going to bed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Find me on &lt;a href="https://github.com/stickyfingies/"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>Event-driven cognitive framework</title>
      <dc:creator>Seth T.T</dc:creator>
      <pubDate>Tue, 21 Nov 2023 02:17:11 +0000</pubDate>
      <link>https://dev.to/stickyfingies/event-driven-cognitive-framework-4am5</link>
      <guid>https://dev.to/stickyfingies/event-driven-cognitive-framework-4am5</guid>
      <description>&lt;h3&gt;
  
  
  Thought Constructs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Everything is &lt;code&gt;information&lt;/code&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;An &lt;code&gt;event&lt;/code&gt; is information about something that happened, or something that  changed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A set of &lt;code&gt;causes&lt;/code&gt; and a set of &lt;code&gt;effects&lt;/code&gt; are associated with each event.  Causes can be partially described at the time of the event.  Some effects may be impossible to associate with their event, even after its time.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Code Constructs
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data&lt;/strong&gt; is tangible and manipulable information.  Everything is data.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{};&lt;/span&gt;
&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;123&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Let &lt;strong&gt;&lt;code&gt;Event&lt;/code&gt;&lt;/strong&gt; be a generic type of data for explicitly labeling events.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 * A generic type of data for explicitly labeling events.
 * @template What   - The type of data describing what happened.
 * @template Cause  - The type of data that caused this event.
 * @template Effect - The type of data which this event causes.
 **/&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Event&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;What&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Cause&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Effect&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// what happened?&lt;/span&gt;
    &lt;span class="na"&gt;what&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;What&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;// what caused it?&lt;/span&gt;
    &lt;span class="na"&gt;cause&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;C&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="c1"&gt;// what happens after?&lt;/span&gt;
    &lt;span class="na"&gt;effect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;E&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that not all events may be explicitly labeled.  Simple code can benefit from our vocabulary - we just need to think from a fresh perspective!&lt;/p&gt;

&lt;p&gt;Let's examine a common TypeScript function - &lt;code&gt;add(a, b)&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 * File: addition.ts
 * This code contains one system called `add`.
 **/&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code contains one system called &lt;code&gt;add&lt;/code&gt;.  The &lt;code&gt;add&lt;/code&gt; system has two inputs, called &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;, and it returns a single output.&lt;/p&gt;

&lt;p&gt;Recall that we defined an &lt;strong&gt;event&lt;/strong&gt; as information about something that happened, or something that changed.  It sounds obvious, but a computer system executing the &lt;code&gt;add&lt;/code&gt; function is - &lt;em&gt;you guessed it&lt;/em&gt; - something happening!&lt;/p&gt;

&lt;p&gt;Our &lt;code&gt;return a + b&lt;/code&gt; is actually an event happening!  Let's make this explicit using our &lt;code&gt;Event&lt;/code&gt; type from earlier.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="cm"&gt;/**
 * File: addition.ts
 * This code contains one system called `add`, and its corresponding event.
 **/&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;AddEvent&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Event&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;unknown&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="nx"&gt;AddEvent&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;what&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="na"&gt;cause&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="na"&gt;effect&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Obviously, this code is ugly and hard to read.  What it communicates, though, is that even simple computer operations can fit within this cognitive framework.&lt;/p&gt;

&lt;h3&gt;
  
  
  Quest: Using &lt;code&gt;effect&lt;/code&gt; to record the truth
&lt;/h3&gt;

&lt;p&gt;Notice the &lt;code&gt;effect&lt;/code&gt; section is empty.  That's because at this point in the program's execution, we don't know yet what effects this function has on the rest of the program.&lt;/p&gt;

&lt;p&gt;Let's fill our &lt;code&gt;AddEvent&lt;/code&gt; with effects.  Consider the following example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;AddEvent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./addition.ts&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;$add&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Output: 3&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;$add&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;what&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Since we did something with $add, let's record it&lt;/span&gt;
    &lt;span class="c1"&gt;// as an effect. Now, $add is a complete and accurate&lt;/span&gt;
    &lt;span class="c1"&gt;// record of all that occurred by calling 'add(a, b)'.&lt;/span&gt;
    &lt;span class="nx"&gt;$add&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;effect&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example adds unnecessary complexity to basic code operations for the sake of demonstration.&lt;/p&gt;

&lt;p&gt;This API design also enables mistakes, because effects must be tracked explicitly and might be forgotten.&lt;/p&gt;

&lt;p&gt;Conversely, tracing and understanding a program's causal chain is &lt;em&gt;fucking invaluable&lt;/em&gt;.  That's why developers log things.&lt;/p&gt;

&lt;p&gt;Can we alleviate these API issues?  What if a computer system could track it's own causal chain, &lt;em&gt;as data?&lt;/em&gt;  What if, indeed...&lt;/p&gt;

&lt;p&gt;Let's try it!&lt;/p&gt;

&lt;h3&gt;
  
  
  Quest: Using &lt;code&gt;effect&lt;/code&gt; to declare the truth
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ TODO&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;Thank you for reading my article :)&lt;br&gt;
&lt;a href="https://github.com/stickyfingies"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>devjournal</category>
      <category>programming</category>
      <category>computerscience</category>
    </item>
    <item>
      <title>Coding Adventure: Karma as a System</title>
      <dc:creator>Seth T.T</dc:creator>
      <pubDate>Fri, 06 Oct 2023 05:13:05 +0000</pubDate>
      <link>https://dev.to/stickyfingies/kaas-a-novel-mental-model-for-developers-595e</link>
      <guid>https://dev.to/stickyfingies/kaas-a-novel-mental-model-for-developers-595e</guid>
      <description>&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%2F61fy7fvep64i4dw8eda7.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%2F61fy7fvep64i4dw8eda7.png" alt="Computer rendering of a human head with spiraling gears" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;center&gt;How can I use software to model Karma?&lt;/center&gt;




&lt;h2&gt;
  
  
  KaaS
&lt;/h2&gt;

&lt;p&gt;Karma-as-a-System is a computer program that emulates the mechanisms of &lt;a href="https://en.wikipedia.org/wiki/Karma"&gt;&lt;strong&gt;Karma&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Wikipedia —&lt;/em&gt; Karma is a concept of action, work or deed, and its effect or consequences.[1] In Indian religions, the term more specifically refers to a principle of cause and effect, often descriptively called the principle of karma, wherein intent and actions of an individual (cause) influence the future of that individual (effect):[2] Good intent and good deeds contribute to good karma and happier rebirths, while bad intent and bad deeds contribute to bad karma and bad rebirths.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let's design KaaS.  Imagine you're taking a cyber philosophy class - what are you submitting for this?&lt;/p&gt;




&lt;center&gt;&lt;b&gt;My Design&lt;/b&gt;&lt;/center&gt;




&lt;p&gt;I'll start by transforming the given Wikipedia quote into a vocabulary about computer systems, to get a sense of what we'll be building.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Karma describes &lt;em&gt;processes&lt;/em&gt; and their &lt;em&gt;outputs&lt;/em&gt;.&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;"Karma is a concept of action, work or deed, and its effect or consequences." — Wikipedia&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A system's &lt;em&gt;state+outputs&lt;/em&gt; influence its future &lt;em&gt;state&lt;/em&gt;.&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;"Indian religions, the term more specifically refers to ... the principle of karma, wherein intent and actions of an individual (cause) influence the future of that individual (effect)" — Wikipedia&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;A system's &lt;em&gt;state+outputs&lt;/em&gt; influence its future &lt;em&gt;inputs&lt;/em&gt;.&lt;/strong&gt;&lt;br&gt;
I've substituted "state" with "inputs" because a computer system's state is &lt;em&gt;always&lt;/em&gt; a function of its input. Runtime state is computed from user inputs, and compile-time state (or "hard-coded state") is determined by developer inputs.  Importantly, every state change comes from an associated input.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Qualities&lt;/em&gt; of a system's output influence the &lt;em&gt;qualities&lt;/em&gt; of its inputs.&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;"Good intent and good deeds contribute to good karma ..., while bad intent and bad deeds contribute to bad karma..." — Wikipedia&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Putting this all together, let's define the system we want to build once and for all.&lt;/p&gt;




&lt;center&gt;Karma is the mechanism by which the qualities of a system's outputs may eventually influence the qualities of its inputs.&lt;/center&gt;




&lt;p&gt;Let's implement this system as a &lt;a href="https://en.wikipedia.org/wiki/Graph_(abstract_data_type)"&gt;Graph&lt;/a&gt; of nodes and lines, where lines transport information ("state") between nodes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// TypeScript&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Node&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* ... */&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Line&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Node&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;Graph&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;nodes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Node&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;lines&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Set&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Line&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/**
 * This function defines the mechanism
 * by which nodes send+receive information.
 *
 * Some might prefer for Node to have object-oriented
 * send() &amp;amp; receive() methods. I prefer functional style.
 */&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;transmit&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="nx"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;right&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt; &lt;span class="nx"&gt;Line&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// "right" receives information through "c"&lt;/span&gt;
    &lt;span class="c1"&gt;//    ^&lt;/span&gt;
    &lt;span class="c1"&gt;//    |  "left" emits information through "a" and "b"&lt;/span&gt;
    &lt;span class="c1"&gt;//    |        ^        ^&lt;/span&gt;
    &lt;span class="c1"&gt;//    |        |        |&lt;/span&gt;
    &lt;span class="nx"&gt;right&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;left&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To become karmic, nodes emitting information through lines will &lt;em&gt;eventually&lt;/em&gt; have their outputs returned to them as inputs. This must abstract excellently across different kinds of information. Ex:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;After sending some object &lt;strong&gt;&lt;em&gt;O&lt;/em&gt;&lt;/strong&gt; with functional properties &lt;strong&gt;&lt;em&gt;P&lt;/em&gt;&lt;/strong&gt;, one should expect to &lt;em&gt;eventually&lt;/em&gt; receive some object(s) &lt;em&gt;qualitatively similar&lt;/em&gt; to &lt;strong&gt;&lt;em&gt;O&lt;/em&gt;&lt;/strong&gt;, or with properties functionally similar to &lt;strong&gt;&lt;em&gt;P&lt;/em&gt;&lt;/strong&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Increasing|decreasing the frequency of similar outputs will &lt;em&gt;eventually&lt;/em&gt; affect the input frequency of &lt;em&gt;qualitatively similar&lt;/em&gt; inputs.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let us define some things.&lt;/p&gt;

&lt;h3&gt;
  
  
  Eventually?
&lt;/h3&gt;

&lt;p&gt;An event &lt;strong&gt;&lt;em&gt;E&lt;/em&gt;&lt;/strong&gt; happens 'eventually' if other events are permitted to happen first.&lt;/p&gt;

&lt;p&gt;Let's model this in &lt;code&gt;transmit&lt;/code&gt; as an asynchronous function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;transmit&lt;/span&gt;&lt;span class="p"&gt;(...)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="cm"&gt;/* same as before */&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Qualitatively similar?
&lt;/h3&gt;

&lt;p&gt;Personal experience strongly determines how you interpret this.&lt;/p&gt;

&lt;p&gt;Simple examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Red is qualitatively similar to maroon&lt;/li&gt;
&lt;li&gt;Oranges are qualitatively similar to clementines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hard examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An ant is qualitatively similar to a pebble (think: size)&lt;/li&gt;
&lt;li&gt;An ant is qualitatively &lt;strong&gt;dis&lt;/strong&gt;similar to a pebble (think: alive/dead)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Controversial examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pornography is qualitatively similar to a cigarette&lt;/li&gt;
&lt;li&gt;The color gray is qualitatively similar to unseasoned food&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do you disagree with these?  Can you think of more?&lt;/p&gt;




&lt;p&gt;In KaaS, we expect qualities (...whatever that means) to eventually return to the system that caused them. But clearly, qualities can be perspective-dependent!  What even &lt;em&gt;is&lt;/em&gt; a quality?  We still have not answered that question.&lt;/p&gt;

&lt;p&gt;This is a challenging problem, because in order to proceed with our implementation of KaaS, we need a way to define:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;What a quality is&lt;/li&gt;
&lt;li&gt;What a perspective is&lt;/li&gt;
&lt;li&gt;What a perceived quality is&lt;/li&gt;
&lt;li&gt;... and so on.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Well guess what?  Not a problem :) programming languages are &lt;em&gt;cool&lt;/em&gt;, man, and I'd like to show you how.&lt;/p&gt;




&lt;p&gt;Let's define a function to represent a system of inputs and outputs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;system&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;I&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;O&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;I&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;O&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// &amp;lt;scope&amp;gt;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;foo&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;input&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;bar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;output&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;O&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="c1"&gt;// &amp;lt;/scope&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;perspective&lt;/strong&gt; of the system is, literally, the scope of the function.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;perceived qualities&lt;/strong&gt; of the system's inputs and outputs are, literally, whatever information it can access within that scope.&lt;/p&gt;

&lt;p&gt;Feels like magic, right?  We've hardly even done any real coding, yet we have all the definitions we need to proceed with developing KaaS.&lt;/p&gt;




&lt;p&gt;Sorry :( This is where I ran out of steam.  The purpose of this post isn't to actually design a system (spoiler alert!) - it's really just to make you think.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Questions:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As you've grown spiritually, did it evolve your perspectives on how systems interact?  Further, what did you notice about your new mental models in your professional life?&lt;/p&gt;

&lt;p&gt;If you have a computer science brain, and are interested in spirituality, then it's important for you to recognize the mechanical overlap between the two disciplines.&lt;/p&gt;

&lt;p&gt;:~)&lt;/p&gt;

</description>
      <category>devjournal</category>
      <category>programming</category>
      <category>computerscience</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
