<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Rob Durst</title>
    <description>A minimalist, colloqualist, exploratationist rambling of my adventures in the world of coding, adventuring, surfing, and living.</description>
    <link>https://robdurst.com</link>
    
      
        <item>
          <title>OpenClaw - Hello Bob! - A First Take.</title>
          <description>&lt;p&gt;&lt;em&gt;“This is a piece of garbage… are you sure you want it”&lt;/em&gt; - IT at a startup firesale as I try to pay $50 for one of the weathered Mac Minis.&lt;/p&gt;

&lt;p&gt;Well, more than 8 years later, it turns out not only does &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ubuntu&lt;/code&gt; run well on it, it’s actually got sufficient specs to run an &lt;a href=&quot;https://openclaw.ai/&quot;&gt;OpenClaw&lt;/a&gt; assistant.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hardware Specifics:&lt;/strong&gt; Mac Mini 2012 (A1347) - Intel Core i5-3210M, 4GB RAM, 98GB disk&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Operating System:&lt;/strong&gt; Ubuntu 22.04 LTS&lt;/p&gt;

&lt;p&gt;So the goal here was to:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;see what all the hype is about&lt;/li&gt;
  &lt;li&gt;see if maybe this is the one thing I’ve always needed to actually adopt Trello…&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;My setup.&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Primary model:&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;anthropic/claude-opus-4-6&lt;/code&gt; (&lt;em&gt;edit recently downgraded&lt;/em&gt;)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Fallback model:&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;openai/gpt-5.2&lt;/code&gt; (&lt;em&gt;edit recently downgraded&lt;/em&gt;)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Web search:&lt;/strong&gt; Brave Search API&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Task management:&lt;/strong&gt; Trello&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Messaging:&lt;/strong&gt; Telegram bot (locked to a single allowed user ID)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Orchestration:&lt;/strong&gt; Docker Compose, running as a single gateway container&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;some-lessons&quot;&gt;Some Lessons&lt;/h2&gt;

&lt;p&gt;Probably 1k+ blog posts about “how OpenClaw is a game changer”, “OpenClaw just replaced &lt;em&gt;__&lt;/em&gt;”, etc. This is not a hype post, just a random list of things I learned setting this up this weekend.&lt;/p&gt;

&lt;h3 id=&quot;lesson-1-you-need-cost-controls-on-day-one&quot;&gt;Lesson #1: You Need Cost Controls on Day One&lt;/h3&gt;

&lt;p&gt;Within the first 24 hours I burned roughly $20 in Anthropic API credits - I told Opus 4.6 to “do research” on some topics. Opus is powerful but expensive and when you give it open-ended research tasks, it happily spawns tool calls, reads files, searches the web, and generates long responses. &lt;strong&gt;I keep heavy tasks to other interfaces: ChatGPT, Claude UI, or Claude Code (I have the max subscription).&lt;/strong&gt; Also attempted to codify this within the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TOOLS.md&lt;/code&gt; file: &lt;em&gt;“Be lean with Anthropic API. Minimize tool calls, batch operations, avoid reading huge files unnecessarily. Spawn sub-agents for heavy research instead of doing it inline.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Basically:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;API Keys + Tokens != Claude Code Max&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;IDK why, but this initially caught me off guard.&lt;/p&gt;

&lt;h3 id=&quot;lesson-2-rate-limits-and-fallback-are-not-plug-and-play&quot;&gt;Lesson #2: Rate Limits and Fallback are Not Plug-and-Play&lt;/h3&gt;

&lt;p&gt;Model fallback didn’t work out of the box. Had some hacking to get this to work. I &lt;em&gt;may&lt;/em&gt; have just misconfigured things. Always a possibility.&lt;/p&gt;

&lt;p&gt;According to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Claude&lt;/code&gt;, this is a three layer system.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Model config&lt;/strong&gt; in &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;openclaw.json&lt;/code&gt; (which model + fallbacks)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Auth profile cooldowns&lt;/strong&gt; (exponential backoff per provider)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Gateway-level rate limiting&lt;/strong&gt; (10 attempts/minute, 5-minute lockout)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Actually still failing me today as I tried to set up a research and aggregate type morning brief related to my technical interests and it failed to run.&lt;/p&gt;

&lt;p&gt;Still much to do to figure this out. The two dimensions of (a) rate limits and (b) token budgets was an unexpected hurdle.&lt;/p&gt;

&lt;h3 id=&quot;lesson-3-hardening&quot;&gt;Lesson #3: Hardening&lt;/h3&gt;

&lt;p&gt;There’s been a &lt;a href=&quot;https://fortune.com/2026/02/12/openclaw-ai-agents-security-risks-beware/&quot;&gt;lot of security scrutiny&lt;/a&gt; around OpenClaw recently: exposed instances leaking API keys, malicious skills on ClawHub, etc. Beyond the basics (fresh/wiped machine, limit access to credentials, don’t expose to the public internet), I set my Claude Code agents on hardening the Docker setup: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cap_drop: ALL&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;read_only: true&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;no-new-privileges&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;non-root user&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;gateway bound to 127.0.0.1 only&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Not a security expert, but &lt;em&gt;yet-another-reminder&lt;/em&gt; to take this stuff seriously is never a bad thing.&lt;/p&gt;

&lt;h3 id=&quot;lesson-4-cron&quot;&gt;Lesson #4: Cron!&lt;/h3&gt;

&lt;p&gt;Still a ways to go here, but I set up, among others, a couple useful columns in my Trello setup: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Today&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tomorrow&lt;/code&gt;. Every morning my OpenClaw assistant will merge these and then send me an update on what to do today. Not 100% sure yet this message is useful, but automated board management is something that feels very appealing and worth exploring more fully.&lt;/p&gt;

&lt;hr /&gt;

&lt;p&gt;Will follow up here after more experimentation, especially if this is something I continue to tune and it works its way into being a critical process for keeping myself organized.&lt;/p&gt;

&lt;p&gt;Stay tuned!&lt;/p&gt;

</description>
          <pubDate>2026-02-16T00:00:00-08:00</pubDate>
          <link>https://robdurst.com/building-a-personal-ai-assistant-on-a-50-mac-mini</link>
          <guid isPermaLink="true">https://robdurst.com/building-a-personal-ai-assistant-on-a-50-mac-mini</guid>
        </item>
      
    
      
        <item>
          <title>My First Gleam Community Contribution ⭐️</title>
          <description>&lt;p&gt;By no means am I a newcomer to the world of open source (&lt;a href=&quot;https://robdurst.com/First-Open-Source-Contribution&quot;&gt;first contribution was January 4, 2018&lt;/a&gt;):&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;I have contributed to numerous repos across the &lt;a href=&quot;https://stellar.org/foundation&quot;&gt;Stellar&lt;/a&gt; ecosphere including &lt;a href=&quot;https://github.com/stellar/stellar-core/graphs/contributors&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;stellar-core&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;I implemented the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;prompt io&lt;/code&gt; method for &lt;a href=&quot;https://pyret.org/&quot;&gt;pyret lang&lt;/a&gt; - (&lt;a href=&quot;https://github.com/brownplt/pyret-lang/pull/1688&quot;&gt;PR&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;some friends and I launched an ice cream store on the Bitcoin Lightning Network - first of its kind (&lt;a href=&quot;https://github.com/BlockAndJerrys/block-and-jerrys&quot;&gt;link&lt;/a&gt;)&lt;/li&gt;
  &lt;li&gt;I even contributed a couple PRs to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;wasm-bindgen&lt;/code&gt; &lt;a href=&quot;https://github.com/wasm-bindgen/wasm-bindgen/pulls?q=is%3Apr+author%3ArobertDurst+is%3Aclosed&quot;&gt;many years ago&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, &lt;em&gt;this first&lt;/em&gt; is extra special because it’s for the &lt;a href=&quot;https://gleam.run/&quot;&gt;Gleam programming language&lt;/a&gt; community, a language I’m super excited about and &lt;a href=&quot;(https://gleamgathering.com/)&quot;&gt;will even be speaking about in a few months&lt;/a&gt;.&lt;/p&gt;

&lt;figure style=&quot;text-align:center&quot;&gt;
  &lt;img src=&quot;/assets/images/first_gleam_contribution.png&quot; /&gt;
  &lt;figcaption&gt;All contributors to the Gleam website this month... including me!&lt;/figcaption&gt;
&lt;/figure&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/gleam-lang/website/pull/577&quot;&gt;Here is my PR - “[Typo/Bug] Fix Link Reference in Hello Gleam Post”&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Funny enough, my first foray into Stellar core was also &lt;a href=&quot;https://github.com/stellar/stellar-core/pull/1564&quot;&gt;a small documentation fix&lt;/a&gt; 😁.&lt;/p&gt;

&lt;p&gt;Excited for the future and to continue to dive in deeper and deeper to the Gleam ecosystem, not just as a user but also as a contributor.&lt;/p&gt;
</description>
          <pubDate>2025-11-23T00:00:00-08:00</pubDate>
          <link>https://robdurst.com/first-gleam-contribution</link>
          <guid isPermaLink="true">https://robdurst.com/first-gleam-contribution</guid>
        </item>
      
    
      
        <item>
          <title>My Experience at SRECon EMEA ‘25</title>
          <description>&lt;p&gt;My talk is live (&lt;a href=&quot;https://www.youtube.com/watch?v=f3lKbV32dyg&quot;&gt;YouTube link&lt;/a&gt;)! My slides can also be found &lt;a href=&quot;https://www.usenix.org/conference/srecon25emea/presentation/durst&quot;&gt;here&lt;/a&gt; and I blogged about my experience &lt;a href=&quot;https://medium.com/spring-health-engineering/my-experience-at-srecon-emea-25-e09db8b3e2b0&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;
</description>
          <pubDate>2025-11-11T00:00:00-08:00</pubDate>
          <link>https://robdurst.com/srecon-emea-my-experience</link>
          <guid isPermaLink="true">https://robdurst.com/srecon-emea-my-experience</guid>
        </item>
      
    
      
        <item>
          <title>Gleam Gathering 2025: Talk Proposal Accepted 🎉</title>
          <description>&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;/assets/images/me_gleam_gather_2025_speaker.png&quot; /&gt;&lt;/div&gt;

&lt;p&gt;Super excited to announce that I was selected as a speaker for the first ever Gleam programming language conference! The conference will take place at the &lt;a href=&quot;https://originworkspace.co.uk/&quot;&gt;Origin Workspace&lt;/a&gt; in Bristol on February 21, 2026. Check out the &lt;a href=&quot;https://gleamgathering.com/&quot;&gt;conference website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Without giving too much away, I’ll be discussing my experience leveraging Gleam to develop the &lt;a href=&quot;https://caffeine-lang.run/&quot;&gt;caffeine language&lt;/a&gt; compiler for internal reliability tooling at &lt;a href=&quot;https://www.springhealth.com/&quot;&gt;Spring Health&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Ever since joining the Rust community at their &lt;a href=&quot;https://2018.rustconf.com/&quot;&gt;third annual conference&lt;/a&gt; in Portland, Oregon in 2018, I’ve been seeking that early programming language community experience and the opportunities that come with it. While my formal PL background is limited to brief research, independent studies, podcast binging, and hobby language hacking, I look forward to the day when I can find a way to make working on a compiler with a bunch of awesome, fun, like-minded people my day job.&lt;/p&gt;
</description>
          <pubDate>2025-11-06T00:00:00-08:00</pubDate>
          <link>https://robdurst.com/gleam-gathering-accepted</link>
          <guid isPermaLink="true">https://robdurst.com/gleam-gathering-accepted</guid>
        </item>
      
    
      
        <item>
          <title>Contextualizing Reliability</title>
          <description>&lt;p&gt;Spend a few minutes in the SRE community and you will surely hear: &lt;em&gt;“reliability is the most feature.”&lt;/em&gt; From the &lt;a href=&quot;https://sre.google/workbook/reaching-beyond/&quot;&gt;Google SRE Workbook&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;assets/images/reliability_is_the_most_important_feature.png&quot; alt=&quot;SRE Book on Reliability&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The argument is sound and, as stated, &lt;em&gt;“people don’t normally disagree.”&lt;/em&gt; However, what does this look like in practice?&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media1.giphy.com/media/v1.Y2lkPTc5MGI3NjExeXo5bmU1OWg3azJvcWk0dGdya2pjaXM5OHF4aGpocHJjeGdsODdrbyZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/ne3xrYlWtQFtC/giphy.gif&quot; alt=&quot;doing math&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This morning I spent some time contextualizing this argument with numbers.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;setting-the-scene&quot;&gt;Setting the Scene&lt;/h3&gt;

&lt;p&gt;Consider a typical web service. This service has users and we’ll make the following assumptions:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;we aim to serve 100% of users&lt;/li&gt;
  &lt;li&gt;users are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;aware of&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;have access to&lt;/code&gt; the site&lt;/li&gt;
  &lt;li&gt;while users have their own reliability issues (i.e. network outages, slow connections, etc.), we’ll ignore those for now&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;basic-definitions&quot;&gt;Basic Definitions&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Intent&lt;/strong&gt;: the user has the intention, or desire, to use the site.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Able&lt;/strong&gt;: the user, when navigating to the site, has the ability to accomplish their goals and extract value from it. Here &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;able&lt;/code&gt; will function as a synonym for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reliable&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;the-interplay-of-intent-and-ability&quot;&gt;The Interplay of Intent and Ability&lt;/h3&gt;

&lt;p&gt;As it stands, we have the ideal, 100%, and then reality, the combination of those with intent and the ability to use the site: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;100%&lt;/code&gt; of those aware and with access
can use the site, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;X%&lt;/code&gt; of those have the intent to use the site, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Y%&lt;/code&gt; of those are able to use the site.&lt;/p&gt;

&lt;p&gt;Mathematically this looks like this:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ACCESS: 100%
INTENT:   X% = ACCESS - THOSE_WITHOUT_INTENT
ABLE:     Y% = X% - THOSE_WITHOUT_ACCESS
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Visually:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;assets/images/total_intent_able_chart.png&quot; alt=&quot;total, intent, able chart&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Which is based on the following truth table:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;assets/images/intent_access_truth_table.png&quot; alt=&quot;intent, able truth table&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Considering the extreme cases, lack of intent or lack of ability, we get:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No ability:&lt;/strong&gt; if 0% of those with intent have the ability, 0% will access. Thus, even if 100% of users have the intent (i.e. design, marketing, engineering, etc. have done their job exceptionally well), no one can access the site.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;No intent:&lt;/strong&gt; if 0% of users have the intent of using the site, 0% will access. Thus, even if the site is completely reliable, if no one wants to access it, no one will.&lt;/p&gt;

&lt;p&gt;In reality we have some combination of the two.&lt;/p&gt;

&lt;h3 id=&quot;the-dont-leave-any-money-on-the-table-principle&quot;&gt;The Don’t Leave Any Money on the Table Principle&lt;/h3&gt;

&lt;p&gt;At the end of the day, we live in a capitalist society. &lt;em&gt;Most&lt;/em&gt; web services provide some value to the user in exchange for time and/or money (which then, in turn, pays your salary). So, business leaders desire to convert as much of their addressable market to customers. In business lingo, it’s something like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;assets/images/tam_sam_business.png&quot; alt=&quot;tam, sam, som visual&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://blog.hubspot.com/marketing/tam-sam-som&quot;&gt;Image source.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However, converting 100% of users with access to 100% with access and intent is a challenging (and maybe impossible?) endeavor. It would involve turning the following triangle into a square? 🤔&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;assets/images/user_funnel.png&quot; alt=&quot;user funnel&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.resultics.com/optimizing-performance-digital-funnel-google-analytics/&quot;&gt;Image source.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As a site reliability engineer, designing an effective user funnel is outside my wheelhouse.&lt;/p&gt;

&lt;p&gt;However, I do believe the following.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;If we’ve invested the time and money to achieve a decent conversion rate, we are, up to a certain point, wasting resources if we leave any users with intent unable to access our site.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;No site is perfectly reliable. In fact you don’t want it to be (&lt;a href=&quot;https://thenewstack.io/the-hidden-costs-of-chasing-five-nines-in-availability/&quot;&gt;each extra nine of reliability is exponentially expensive&lt;/a&gt;). However, there is a threshold of level of service that your users expect, which, if not met, results in missed business. Defining that threshold (&lt;a href=&quot;https://en.wikipedia.org/wiki/Service-level_objective&quot;&gt;service level objective&lt;/a&gt;) based on a decent proxy of the user experience (&lt;a href=&quot;https://en.wikipedia.org/wiki/Service_level_indicator&quot;&gt;service level indicator&lt;/a&gt;) is not easy (&lt;a href=&quot;https://www.oreilly.com/library/view/implementing-service-level/9781492076803/&quot;&gt;heck… there is a whole book about this stuff&lt;/a&gt;). However, as hard as it is, &lt;a href=&quot;https://sre.google/sre-book/table-of-contents/&quot;&gt;service reliability engineering&lt;/a&gt; is a &lt;em&gt;science&lt;/em&gt;. There are principles, best practices, patterns, and existing precedents (across industry domains, &lt;a href=&quot;https://relyence.com/2024/08/19/what-is-reliability-engineering/&quot;&gt;medicine&lt;/a&gt;, &lt;a href=&quot;https://www.fhwa.dot.gov/bridge/pubs/hif19093.pdf&quot;&gt;bridges&lt;/a&gt;, &lt;a href=&quot;https://sassofia.com/blog/the-role-of-reliability-engineering-in-aviation-maintenance-systems/&quot;&gt;airplanes&lt;/a&gt;) we can follow.&lt;/p&gt;

&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;Based on the above, any discrepancy between the level of user intent and the level of user ability is, in my opinion, &lt;strong&gt;money on the table&lt;/strong&gt;. So, circling back to our original point of investigation, reliability is &lt;em&gt;the most important feature&lt;/em&gt;: without it, the rest of your organization’s work loses its effectiveness and momentum and in the worst case, is &lt;em&gt;completely wasted&lt;/em&gt;.&lt;/p&gt;
</description>
          <pubDate>2025-07-07T00:00:00-07:00</pubDate>
          <link>https://robdurst.com/contextualizing-reliability</link>
          <guid isPermaLink="true">https://robdurst.com/contextualizing-reliability</guid>
        </item>
      
    
      
        <item>
          <title>SRECon Emea 2025 Accepted!</title>
          <description>&lt;h1 id=&quot;-accepted-&quot;&gt;🎊 Accepted 🎊&lt;/h1&gt;

&lt;p&gt;Obligatory email screenshot.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;assets/images/srecon_emea_25_acceptance.png&quot; alt=&quot;SRECon Emea &apos;25 Acceptance Email&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;a-spoiler-&quot;&gt;A Spoiler 👀&lt;/h2&gt;

&lt;h3 id=&quot;talk-short-description&quot;&gt;Talk Short Description&lt;/h3&gt;

&lt;p&gt;Scaling a site-reliability culture from the ground up at a hyper-growth, resource-constrained startup is a uniquely challenging endeavor: plenty of playbooks exist, yet every startup’s socio-technical reality is its own puzzle. And while “reliability is the most important feature” rings true, tight deadlines and shifting priorities often sideline proactive reliability initiatives. Thus, since these cycles are a precious commodity, ensuring their success is paramount.&lt;/p&gt;

&lt;p&gt;By retracing our SLO adoption journey, highlighting failures, missteps, and near wins en route to our eventual breakthrough, we uncover an effective litmus test for gauging readiness, or recognizing when a team isn’t quite there yet.&lt;/p&gt;

&lt;p&gt;Today, this readiness framework guides how we assess the timing of reliability investments at Spring Health. It also serves as a practical tool for teams in fast-growing engineering orgs still early in their reliability journey, especially those navigating similar constraints.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;en-route-to-becoming-an-active-member-of-the-global-sre-community&quot;&gt;En Route to Becoming an Active Member of the Global SRE Community&lt;/h2&gt;

&lt;p&gt;In preparation for becoming a more active participant in the SRE community, working on my &lt;em&gt;personal brand&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Socials (short form)&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.linkedin.com/in/robertdurst&quot;&gt;Linkedin (peep the new headshot)&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://x.com/grumpy_sre&quot;&gt;Twitter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Blogging (medium form)&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Futhermore, while I have done some blogging here in the past:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://spaced-out-thoughts-development-foundation.org/&quot;&gt;Spaced Out Thoughts Development Foundation ‘24&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://medium.com/spring-health-engineering/the-birth-of-the-performance-lab-at-spring-health-76b768c9c967&quot;&gt;Spring Health ‘22&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.docusign.com/blog/developers/my-experience-why-defensive-coding-matters&quot;&gt;Docusign ‘21&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I will be working to publish more, especially on the things I learn and build at &lt;em&gt;Spring Health&lt;/em&gt; and from my side independent research work at &lt;a href=&quot;https://www.zen.sre.studio/&quot;&gt;Zen SRE Studio&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Publications (long form)&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;I setup my &lt;a href=&quot;https://orcid.org/0009-0008-7180-2648&quot;&gt;Orcid&lt;/a&gt; which will be used for my talk for the conference. Also linked my contribution (not authorship) from some undergrad work in 2020 (&lt;a href=&quot;https://www.software-lab.org/publications/icse2022_Nessie.pdf&quot;&gt;Nessie: Automatically Testing JavaScript APIs with Asynchronous Callbacks&lt;/a&gt;).&lt;/p&gt;
</description>
          <pubDate>2025-07-01T00:00:00-07:00</pubDate>
          <link>https://robdurst.com/SRECon-Accepted</link>
          <guid isPermaLink="true">https://robdurst.com/SRECon-Accepted</guid>
        </item>
      
    
      
        <item>
          <title>SRECon Emea 2025 Submission</title>
          <description>&lt;h2 id=&quot;i-am-now-an-sre&quot;&gt;I Am Now An SRE&lt;/h2&gt;

&lt;p&gt;After starting the team and helping lead the development of Spring Health’s in-house provider availability system (a story that deserves its own post), I officially transitioned into an SRE role in mid-2024. My mission: to make Observability Driven Development the default. It’s an ambitious culture shift and one that leans more on the socio than the technical. That makes it a challenge, but also a rich learning opportunity (all problems are people problems at the end of the day, right???).&lt;/p&gt;

&lt;p&gt;As part of this move, I’ve been leading our internal effort to adopt SLOs. This is actually our fourth attempt. Since I already used my learning budget on &lt;a href=&quot;https://www.localfirstconf.com/&quot;&gt;Local First Conf&lt;/a&gt;, I needed a different path to get to &lt;a href=&quot;https://www.usenix.org/conference/srecon25emea&quot;&gt;SRECon Emea 2025&lt;/a&gt;. So I’m going the speaker route and leveraging this story of &lt;em&gt;our journey to SLO Readiness&lt;/em&gt; as my way to get there.&lt;/p&gt;

&lt;p&gt;Today I officially submitted my talk proposal! While I very well might not be accepted, it’s the first step in the journey towards becoming a speaker and really a participant in not just SRE at Spring, but the entire SRE community. Excited!&lt;/p&gt;

&lt;p&gt;While &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Hope is Not a Strategy&lt;/code&gt; may be &lt;em&gt;the&lt;/em&gt; SLO saying, hopefully I follow up soon with good news… wish me luck!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Will post the details of the submission here later following the review period.&lt;/strong&gt;&lt;/p&gt;
</description>
          <pubDate>2025-05-21T00:00:00-07:00</pubDate>
          <link>https://robdurst.com/SRECon-Proposal-Submission</link>
          <guid isPermaLink="true">https://robdurst.com/SRECon-Proposal-Submission</guid>
        </item>
      
    
      
        <item>
          <title>Digicus Whitepaper</title>
          <description>&lt;h1 align=&quot;center&quot;&gt;&lt;span align=&quot;center&quot; style=&quot;font-size: 2em;&quot;&gt;Scratch for Smart Contracts&lt;/span&gt;&lt;/h1&gt;

&lt;div align=&quot;center&quot;&gt;
Rob Durst&lt;br /&gt;
me[at]robdurst[dot]com
&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;With it’s launch in 2015, Ethereum &lt;sup id=&quot;fnref:1&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:1&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;1&lt;/a&gt;&lt;/sup&gt; brought smart contracts to the forefront of the blockchain ecosystem. These smart contracts were based on the (original?) definition laid out by Nick Szabo in 1996 &lt;sup id=&quot;fnref:2&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:2&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;2&lt;/a&gt;&lt;/sup&gt;: &lt;em&gt;“[a] smart contract is a set of promises, specified in digital form, including protocols within which the parties perform on these promises.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;As implemented today, smart contracts are typically turing complete and rely on a VM coupled with the underlying blockchain nodes. Like any typical VM, a “smart contract handling VM” handles some set of instructions, typically byte code, charging fees for execution, storage, etc. Contracts may be written in a “blockchain native” language like Solidity &lt;sup id=&quot;fnref:3&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:3&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;3&lt;/a&gt;&lt;/sup&gt; or a pre-existing language that is compiled to a format the VM supports (i.e. Rust compiled to WASM which may run on Stellar’s Soroban &lt;sup id=&quot;fnref:4&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:4&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;4&lt;/a&gt;&lt;/sup&gt;). While these smart contract development ecosystems have matured greatly over the past few years, writing a non-trivial, secure, correct smart contract is not easy (&lt;em&gt;Google smart contract hack and you’ll see a plethora of examples&lt;/em&gt;). Today, various tools exist to solve this problem. Grouped generally, there are a few approaches:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Allow folks to use the programming language they are most familiar with (Hyperledger Fabric &lt;sup id=&quot;fnref:5&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:5&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;5&lt;/a&gt;&lt;/sup&gt;)&lt;/li&gt;
  &lt;li&gt;Give folks the best developer experience possible&lt;/li&gt;
  &lt;li&gt;Provide a set of re-usable, well vetted, well tested, and well understood boiler-plate, templated smart contracts (OpenZepplin &lt;sup id=&quot;fnref:6&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:6&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;6&lt;/a&gt;&lt;/sup&gt;)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We propose a fourth approach: &lt;em&gt;making the smart contract language itself more approachable&lt;/em&gt;. Fundamentally, the barriers to entry are overwhelmingly numerous. For example, in order to be a competent smart contract developer on the Stellar’s Soroban, you need to be familiar with how blockchains work, have a strong foundation in smart contracts, and be functional in the Rust programming language. Expecting non-technical participation &lt;em&gt;and&lt;/em&gt; a painless onboarding experience for newcomer developers is not realistic. We believe a blockchain agnostic, visual, block-based programming environment will facilitate a more accessible onboarding experience for all. Specifically, we’ve built Digicus, an intuitive, simple, Lego-like IDE, backed by Digit, a compiler plugin framework for seamless transpilation between existing smart contract languages (i.e. Solidity) and frameworks (i.e Stellar’s Soroban Rust SDK) and our intermediate representation (DTR: Digicus Textual Representation). Digicus is the blockchain ecosystem’s Scratch &lt;sup id=&quot;fnref:7&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:7&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;7&lt;/a&gt;&lt;/sup&gt;, a smart contract 101 platform that will help onboard newcomers into our world, aiding their journey to &lt;em&gt;“smart contract 201”&lt;/em&gt; and beyond.&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;table-of-contents&quot;&gt;&lt;strong&gt;&lt;u&gt;Table of Contents&lt;/u&gt;&lt;/strong&gt;&lt;/h1&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;#table-of-contents&quot;&gt;Table of Contents&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#existing-work-and-inspiration&quot;&gt;Existing Work and Inspiration&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#solution&quot;&gt;Solution&lt;/a&gt;&lt;br /&gt;
    - &lt;a href=&quot;#an-overview&quot;&gt;An Overview&lt;/a&gt;&lt;br /&gt;
    - &lt;a href=&quot;#the-digicus-ide&quot;&gt;The Digicus IDE&lt;/a&gt;&lt;br /&gt;
    - &lt;a href=&quot;#a-compiler-plugin-framework&quot;&gt;A Compiler Plugin Framework&lt;/a&gt;&lt;br /&gt;
    - &lt;a href=&quot;#digicus-textual-representation&quot;&gt;Digicus Textual Representation&lt;/a&gt;&lt;br /&gt;
    - &lt;a href=&quot;#supported-instructions&quot;&gt;Supported Instructions&lt;/a&gt;&lt;br /&gt;
    - &lt;a href=&quot;#instruction-execution-flow&quot;&gt;Instruction Execution Flow&lt;/a&gt;&lt;br /&gt;
    - &lt;a href=&quot;#valid-types&quot;&gt;Valid Types&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#conclusion&quot;&gt;Conclusion&lt;/a&gt;&lt;br /&gt;
    - &lt;a href=&quot;#latest-status&quot;&gt;Latest Status&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#grant-acknowledgements&quot;&gt;Grant Acknowledgements&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;existing-work-and-inspiration&quot;&gt;&lt;strong&gt;&lt;u&gt;Existing Work and Inspiration&lt;/u&gt;&lt;/strong&gt;&lt;/h1&gt;

&lt;p&gt;The idea of a platform like Digicus is not a completely novel idea.&lt;/p&gt;

&lt;p&gt;A 2021 paper titled &lt;em&gt;SmartBuilder: A Block-based Visual Programming Framework for Smart Contract Development&lt;/em&gt; states &lt;sup id=&quot;fnref:8&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:8&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;8&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In this paper, we introduce SmartBuilder, a block-based visual programming framework for building smart contracts using extended Google Blockly libraries. It allows Hyperledger Fabric smart contract (also known as Chaincode) development learners or non-expert users to build smart contracts using visual blocks without writing a single code&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This solution claims to have developed a commercial application of their proposed framework for the Aergo blockchain &lt;sup id=&quot;fnref:9&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:9&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;9&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;A second paper, &lt;em&gt;Scilla: a Smart Contract Intermediate-Level LAnguage&lt;/em&gt; focuses on the idea of a smart contract intermediate language &lt;sup id=&quot;fnref:10&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:10&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;10&lt;/a&gt;&lt;/sup&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;This paper outlines key design principles of Scilla—an intermediate-level language for verified smart contracts. Scilla provides a clean separation between the communication aspect of smart contracts on a blockchain, allowing for the rich interaction patterns, and a programming component, which enjoys principled semantics and is amenable to formal verification. Scilla is not meant to be a high-level programming language, and we are going to use it as a translation target for high-level languages, such as Solidity, for performing program analysis and verification, before further compilation to an executable bytecode. We describe the automata-based model of Scilla, present its programming component and show how contract definitions in terms of automata streamline the process of mechanised verification of their safety and temporal properties&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This paper focuses on verification, not ease of development (however, a very interesting idea Digicus might be able to adopt later).&lt;/p&gt;

&lt;p&gt;Furthermore, the idea of a compiler framework is heavily influenced by LLVM &lt;sup id=&quot;fnref:11&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:11&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;11&lt;/a&gt;&lt;/sup&gt;.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;LLVM defines a common, low-level code representation in Static Single Assignment (SSA) form, with several novel features: a simple, language-independent type-system that exposes the primitives commonly used to implement high-level language features; an instruction for typed address arithmetic; and a simple mechanism that can be used to implement the exception handling features of high-level languages (and setjmp/longjmp in C) uniformly and efficiently. The LLVM compiler framework and code representation together provide a combination of key capabilities that are important for practical, lifelong analysis and transformation of programs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The beauty of LLVM as a general target for high level languages allows language developers to get (a) a bunch of optimizations and (b) a whole host of backends for free. Its importance to the compiler ecosystem cannot be understated.&lt;/p&gt;

&lt;p&gt;Digicus is a novel combination of these ideas, designed practically with the intention of developing a production application.&lt;/p&gt;

&lt;hr /&gt;
&lt;h1 id=&quot;solution&quot;&gt;&lt;strong&gt;&lt;u&gt;Solution&lt;/u&gt;&lt;/strong&gt;&lt;/h1&gt;

&lt;h4 id=&quot;an-overview&quot;&gt;&lt;strong&gt;&lt;u&gt;An Overview&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;

&lt;p&gt;Our solution requires three distinct pieces of technology:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;an IDE (a visual programming language)&lt;/li&gt;
  &lt;li&gt;a compiler plugin framework&lt;/li&gt;
  &lt;li&gt;a well-defined intermediate representation language&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The IDE is where a user will spend most of their time viewing and modifying smart contracts. The IDE is integrated with Digit, our compiler plugin framework which is responsible for transpiling between source language(s), DTR, and target language(s). Within Digit resides an implementation of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dtr_core&lt;/code&gt;, a Ruby gem that adheres to the DTR specification. While &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dtr_core&lt;/code&gt; is effectively the reference implementation, based on our appreciation of Rob Pike &lt;sup id=&quot;fnref:12&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:12&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;12&lt;/a&gt;&lt;/sup&gt; and his acknowledgement of the importance of the Go spec &lt;sup id=&quot;fnref:13&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:13&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;13&lt;/a&gt;&lt;/sup&gt;, please consider the specification of DTR to be the source of truth and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dtr_core&lt;/code&gt; to be &lt;em&gt;just an implementation&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Visual Programming Language&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The smart contract developer tooling community has yet to find PMF for a tool to aid novice developers in the creation of secure and performant smart contracts. While we don’t naively believe this is due to a lack of effort, we instead attribute it to implementations focused on the wrong level of abstraction.&lt;/p&gt;

&lt;p&gt;Today, there are &lt;em&gt;more-or-less&lt;/em&gt; three levels of abstraction:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;high level programming languages (i.e. Solidity)&lt;/li&gt;
  &lt;li&gt;visual programming languages that syntactically mirror source code&lt;/li&gt;
  &lt;li&gt;well-vetted template libraries (i.e. OpenZepplin)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Thus far, Digicus (and many of the earlier VPL attempts in this space) have been focused on (2). While not yet fully formed, designed, or even really described in this specification document, we believe there is a 2.5. In such a world, we will design an abstraction over high level source code which eliminates known security violations and/or performance degradations, guiding the novice developer towards a &lt;em&gt;happy path&lt;/em&gt; solution (we call this a “shift left” solution” as we’re shifting the addressing of security and performance closer to the beginning of the SDLC).&lt;/p&gt;

&lt;p&gt;[August 2024] We don’t yet know what this looks like. We’re engaging in conversations across our network in pursuit of a solution… stay tuned!&lt;/p&gt;

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

&lt;center&gt;&lt;img src=&quot;../../images/revamped_architecture_doc.png&quot; alt=&quot;current architecture diagram&quot; /&gt;&lt;/center&gt;

&lt;p&gt;Our compiler plugin framework is leveraged by Digit via the Bean Stock Compiler Plugin (pod) Hub &lt;sup id=&quot;fnref:14&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:14&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;14&lt;/a&gt;&lt;/sup&gt;. Bean Stock sources pods via &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;git submodules&lt;/code&gt;, where each submodule has a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bean_stock_manifest.yaml&lt;/code&gt; file describing the pod. Here is an example:&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;soroban_rust_frontend&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;backend&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;0.16.1&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;description&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;Frontend for Soroban Rust SDK. Compiles Rust to DTR.&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;command&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;make run FILEPATH&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;author&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;rob | me@robdurst.com&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;https://github.com/spaced-out-thoughts-dev-foundation/soroban_rust_frontend&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The Digit server’s Dockerfile can then fetch and compile/setup each submodule upon &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;docker build&lt;/code&gt; based on the manifest. Wthi this in place, Digit will be able to handle various transpilations at runtime as requested by Digicus.&lt;/p&gt;

&lt;h4 id=&quot;the-digicus-ide&quot;&gt;&lt;strong&gt;&lt;u&gt;The Digicus IDE&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;

&lt;p&gt;Below is an initial mockup of the MVP user interface.&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;img src=&quot;../../images/digicus-ide-mockup.png&quot; alt=&quot;Digit Overview&quot; /&gt; 
&lt;/div&gt;

&lt;p&gt;When developing with Digicus, users will be able to name the contract, drag and drop block components into the interactive function creator, and then they will be able to perform minimal, chain agnostic testing of the contract. The UI/UX for this will be based heavily off of the well-tested, mature Scratch programming platform. Furthermore, a plethora of features will be supported to make this a first class smart contract development interface, including but not limited to:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;common vulnerability detection&lt;/li&gt;
  &lt;li&gt;autocomplete (&lt;em&gt;eventually&lt;/em&gt; some sort of Copilot-esque flavor as well &lt;sup id=&quot;fnref:15&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:15&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;15&lt;/a&gt;&lt;/sup&gt;)&lt;/li&gt;
  &lt;li&gt;realtime syntax/semantic error recognition with sensible warnings and recommendations for improvement&lt;/li&gt;
  &lt;li&gt;chain specific integration testing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The IDE will support two workflows: (1) upload and modify and (2) net new creation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Workflow #1: Upload and Modify:&lt;/strong&gt; users will be able to upload a smart contract from one of the supported smart contract programming languages/frameworks. Once uploaded, users can modify as they wish.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Workflow #2: Net New Creation:&lt;/strong&gt; users will be able to create a generic smart contract from scratch. However, they will not always need to start from scratch; a library of common templates will be available for bootstrapping.&lt;/p&gt;

&lt;p&gt;While a full IDE is the goal of this work, we anticipate the visualization feature to be immediately useful with the possibility to embed within existing smart contract analysis/explorer/etc. software today.&lt;/p&gt;

&lt;h4 id=&quot;a-compiler-plugin-framework&quot;&gt;&lt;strong&gt;&lt;u&gt;A Compiler Plugin Framework&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;

&lt;p&gt;Digit, Digicus’s compiler plugin framework, enables the ambitious software developer to add support for their blockchain smart contract programming language (or framework) of choice. To do so requires the development of a bidirectional transpiler, from source to DTR and DTR to source. We aid this development by way of example plugins and a central repository for hosting these such that they are discoverable and &lt;em&gt;auto-magically&lt;/em&gt; integratable with the IDE.&lt;/p&gt;

&lt;p&gt;A plugin is an executable binary with two methods:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;to_dtr(source_language: String) --&amp;gt; String
from_dtr(dtr: String) --&amp;gt; String
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The Spaced Out Thoughts Development Foundation aims to initially support:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Stellar’s &lt;a href=&quot;https://github.com/stellar/rs-soroban-sdk&quot;&gt;Soroban Rust SDK&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We’re biased, we love Stellar and given the novelty of their solution to global cross border payments, a strong technical foundation, and the very recent launch of Soroban, focusing here was a no brainer.&lt;/p&gt;

&lt;p&gt;However, given the flexibility of the compiler plugin designed, one day, Digit will be able to support the following:&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;img src=&quot;../../images/digit_overview.png&quot; alt=&quot;Digit Overview&quot; /&gt; 
&lt;/div&gt;

&lt;p&gt;Digit enables the seamless translation of contracts not only from source to DTR, but from source A to Target B. There are numerous ecosystem examples of targeted transpilation libraries &lt;sup id=&quot;fnref:16&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:16&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;16&lt;/a&gt;&lt;/sup&gt; and even blockchain interoperability&lt;sup id=&quot;fnref:17&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:17&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;17&lt;/a&gt;&lt;/sup&gt;. Digicus aims to go one step further, the generalization of smart contracts as whole. &lt;em&gt;We believe this is layer 3 at its finest!&lt;/em&gt;&lt;/p&gt;

&lt;h4 id=&quot;digicus-textual-representation&quot;&gt;&lt;strong&gt;&lt;u&gt;Digicus Textual Representation&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;

&lt;p&gt;DTR is defined by ASCII text files with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.dtr&lt;/code&gt; ending. Each file contains the definition for a single contract and consists of five sections:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;Contract&lt;/strong&gt;: where the name of the contract is specified&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;State&lt;/strong&gt;: where we define the type and initial data for each variable&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;UDTS&lt;/strong&gt;: where we define user defined types&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Interface&lt;/strong&gt;: where we define each externally visible method (name, input, output, body)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Helpers&lt;/strong&gt;: where we define each internal method (name, input, output, body)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Non-translatables:&lt;/strong&gt; some source languages are more expressive than the target language. Thus, in an effort to allow &lt;em&gt;easier&lt;/em&gt; transpilation back, we’ve included an optional section to store relevant metadata unique to the source.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If a section is omitted, it will be assumed to be non-existent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Overall structure&lt;/strong&gt;:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Contract]: CONTRACT_NAME

[State]:
  * STATE_DEFINITION
  ...
  * STATE_DEFINITION
:[State]

[UDTs]:
  * UDT_DEFINITION
  ...
  * UDT_DEFINITION
:[UDTs]

[Interface]:
  * FUNCTION_DEFINITION
  ...
  * FUNCTION_DEFINITION
:[Interface]

[Helpers]:
  * FUNCTION_DEFINITION
  ...
  * FUNCTION_DEFINITION
:[Helpers]

[NonTranslatable]:
   TEXT_IN_ANY_FORMAT
:[NonTranslatable]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;STATE_DEFINITION&lt;/strong&gt;:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  [STATE_NAME]:
    * Type: TYPE_NAME
    * Initial Value: VALUE
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;TYPE_NAME&lt;/code&gt; can be any &lt;a href=&quot;#valid-types&quot;&gt;valid type&lt;/a&gt;. (TBD) do we want a 1-to-1 mapping of Rust types to .dtr types? Yes for MVP, but maybe as we implement this it will be (a) easier to generalize and/or (b) clear that new users need not care about this and so we can make &lt;em&gt;smart&lt;/em&gt; decisions for them. Eventually we may rethink this when we expand to other frontend targets.&lt;/p&gt;

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

&lt;p&gt;All user defined types are objects. An object is a named entity with zero or more typed fields.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Foo]:
  * Bar: Integer
  * Baz: String
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Enums are fairly typical. Consider how we might represent the two flavors of Rust enums as objects.&lt;/p&gt;

&lt;p&gt;Typical enum:&lt;/p&gt;

&lt;div class=&quot;language-rs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Rust&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;enum&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TrafficLight&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Red&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Green&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Yellow&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Digicus&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// UDT&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TrafficLight&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Kind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Integer&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Function&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;TrafficLightValue&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Input&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;traffic_light&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;TrafficLight&lt;/span&gt;
  &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Output&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Boolean&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Instructions&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;instruction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;conditional_jump&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;greater_than&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;traffic_light&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;.Kind&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;instruction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;False&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;instruction&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;input&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;scope&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;err&quot;&gt;$&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;


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

&lt;p&gt;Enum variant:&lt;/p&gt;

&lt;div class=&quot;language-rs highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Rust&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;enum&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Shape&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;Circle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;f64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
    &lt;span class=&quot;nf&quot;&gt;Rectangle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;f64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;f64&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;o&quot;&gt;...&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// Digicus&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Circle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Tuple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Float&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;*&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Rectangle&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Tuple&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Float&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;Float&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;FUNCTION_DEFINITION&lt;/strong&gt;:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  [FUNCTION_NAME]:
    * Input:
      {
        INPUT_NAME: TYPE_NAME,
        ...
        INPUT_NAME: TYPE_NAME
      }
    * Output: TYPE_NAME
    * Instructions:
      $
        { id: UUID, instruction: INSTRUCTION_NAME, input: (VALUE_NAME: VALUE,..., VALUE_NAME: VALUE), assign: ASSIGN_NAME, scope: SCOPE_LEVEL },
        ...
        { id: UUID, instruction: INSTRUCTION_NAME, input: (VALUE_NAME: VALUE,..., VALUE_NAME: VALUE), assign: ASSIGN_NAME, scope: SCOPE_LEVEL }
      $
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Note:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;the input section is optional&lt;/li&gt;
  &lt;li&gt;the output section is optional&lt;/li&gt;
  &lt;li&gt;output may be at most one value&lt;/li&gt;
  &lt;li&gt;an instruction need not have an input nor an output&lt;/li&gt;
  &lt;li&gt;an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASSIGN_NAME&lt;/code&gt; is a local variable which may be referenced by following instructions&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;INSTRUCTION_NAME&lt;/code&gt; is the name of a subset of supported rust expressions &lt;a href=&quot;#supported-instructions&quot;&gt;see supported instructions&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SCOPE_LEVEL&lt;/code&gt; is an unsigned integer detailing which level of accessibility an instruction is executed within. It is required&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&quot;supported-instructions&quot;&gt;&lt;strong&gt;&lt;u&gt;Supported Instructions&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;

&lt;p&gt;Defining a set of common instructions across &lt;em&gt;all&lt;/em&gt; blockchains is challenging. Thus, it is likely this list will be in flux;until otherwise stated, this list may be incomplete.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Operation Name&lt;/th&gt;
      &lt;th&gt;Inputs&lt;/th&gt;
      &lt;th&gt;Assign&lt;/th&gt;
      &lt;th&gt;Category&lt;/th&gt;
      &lt;th&gt;Description&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;assign&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;Required&lt;/td&gt;
      &lt;td&gt;Basic&lt;/td&gt;
      &lt;td&gt;given some input value, assign to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASSIGN_NAME&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;evaluate&lt;/td&gt;
      &lt;td&gt;&amp;gt;1&lt;/td&gt;
      &lt;td&gt;Optional&lt;/td&gt;
      &lt;td&gt;Basic&lt;/td&gt;
      &lt;td&gt;given a method name and 0 or more inputs, execute method. At this time, evaluate is a fairly loose catch-all for not explicitly defined operations&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;print&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;None&lt;/td&gt;
      &lt;td&gt;Basic&lt;/td&gt;
      &lt;td&gt;given some value, print it to standard out&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;exit_with_message&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;None&lt;/td&gt;
      &lt;td&gt;Terminating&lt;/td&gt;
      &lt;td&gt;immediately end execution, returning message&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;return&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;None&lt;/td&gt;
      &lt;td&gt;Terminating&lt;/td&gt;
      &lt;td&gt;return from function with input value&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;and&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Required&lt;/td&gt;
      &lt;td&gt;Logical&lt;/td&gt;
      &lt;td&gt;assign to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASSIGN_NAME&lt;/code&gt; result of “and-ing” two values&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;or&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Required&lt;/td&gt;
      &lt;td&gt;Logical&lt;/td&gt;
      &lt;td&gt;assign to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASSIGN_NAME&lt;/code&gt; result of “or-ing” two values&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;goto&lt;/td&gt;
      &lt;td&gt;1+&lt;/td&gt;
      &lt;td&gt;None&lt;/td&gt;
      &lt;td&gt;Control Flow&lt;/td&gt;
      &lt;td&gt;conditional if two inputs. In this case, first input is the condition to evaluate. If that is true, or there is only one input, move in code to the first input (an instruction id)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;jump&lt;/td&gt;
      &lt;td&gt;1+&lt;/td&gt;
      &lt;td&gt;None&lt;/td&gt;
      &lt;td&gt;Control Flow&lt;/td&gt;
      &lt;td&gt;conditional if two inputs. In this case, first input is the condition to evaluate. If that is true, or there is only one input, jump to scope level&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;end_of_iteration_check&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;Required&lt;/td&gt;
      &lt;td&gt;Control Flow&lt;/td&gt;
      &lt;td&gt;check on input to see if at end of iteration. Return result to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASSIGN_NAME&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;field&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Optional&lt;/td&gt;
      &lt;td&gt;Object&lt;/td&gt;
      &lt;td&gt;access a field on an object and assign result to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASSIGN_NAME&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;instantiate_object&lt;/td&gt;
      &lt;td&gt;1+&lt;/td&gt;
      &lt;td&gt;Optional&lt;/td&gt;
      &lt;td&gt;Object&lt;/td&gt;
      &lt;td&gt;initialize an object by first passing in the &lt;em&gt;type&lt;/em&gt; of object and the passing in each initial values for its fields. Supported types here include: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dictionary&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;List&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Range&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tuple&lt;/code&gt;, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;UDT&lt;/code&gt;. For UDTs, the second input is the name of the UDT.&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;add&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Required&lt;/td&gt;
      &lt;td&gt;Binary&lt;/td&gt;
      &lt;td&gt;assign to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASSIGN_NAME&lt;/code&gt; result of adding two value&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;subtract&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Required&lt;/td&gt;
      &lt;td&gt;Binary&lt;/td&gt;
      &lt;td&gt;assign to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASSIGN_NAME&lt;/code&gt; result of subtracting two value&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;multiply&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Required&lt;/td&gt;
      &lt;td&gt;Binary&lt;/td&gt;
      &lt;td&gt;assign to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASSIGN_NAME&lt;/code&gt; result of multiplying two value&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;divide&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Required&lt;/td&gt;
      &lt;td&gt;Binary&lt;/td&gt;
      &lt;td&gt;assign to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASSIGN_NAME&lt;/code&gt; result of dividing two value&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;try_assign&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Required&lt;/td&gt;
      &lt;td&gt;Basic&lt;/td&gt;
      &lt;td&gt;assign to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ASSIGN_NAME&lt;/code&gt; the result of the attempted assign of input index 0 to input index 1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;increment&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;None&lt;/td&gt;
      &lt;td&gt;Unary&lt;/td&gt;
      &lt;td&gt;An operation to increment the input (however that may be implemented)&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;unary&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;Optional&lt;/td&gt;
      &lt;td&gt;Unary&lt;/td&gt;
      &lt;td&gt;Basic unary operations like &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;!&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-&lt;/code&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;break&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;None&lt;/td&gt;
      &lt;td&gt;Control Flow&lt;/td&gt;
      &lt;td&gt;Breaks out of the current execution flow.&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;h4 id=&quot;instruction-execution-flow&quot;&gt;&lt;strong&gt;&lt;u&gt;Instruction Execution Flow&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;

&lt;p&gt;Instruction flow is determined by two main factors:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;the top to bottom position of the instruction within the collection&lt;/li&gt;
  &lt;li&gt;the scope of the instruction&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Much like traditional computing, instructions here, are executed in the order defined, from top to bottom. However, the &lt;em&gt;instruction pointer&lt;/em&gt; &lt;sup id=&quot;fnref:18&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:18&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;18&lt;/a&gt;&lt;/sup&gt; is scope-aware; thus, if the current scope is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;7&lt;/code&gt;, but the instruction pointed at is a scope of anything besides &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;7&lt;/code&gt;, the &lt;em&gt;instruction pointer&lt;/em&gt; will transition to the next instruction in the collection. Scopes help us isolate functional blocks of logic and as we move through the execution of a program, we simulate a stack frame based on these scopes.&lt;/p&gt;

&lt;p&gt;To illustrate, consider the representation of an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;if-else&lt;/code&gt; block in DTR:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;// ====== scope 0 ======
// CONDITONAL_RESULT_1 = x &amp;gt; 10
{ instruction: evaluate, input: (greater_than, x, 10), assign: CONDITONAL_RESULT_1, scope: 0 }
// if CONDITONAL_RESULT_1, scope =&amp;gt; 2
{ instruction: jump, input: (CONDITONAL_RESULT_1, 2), scope: 0 }
// else, scope =&amp;gt; 3
{ instruction: jump, input: (3), scope: 0 }

// ====== scope 2 ======
// print(&quot;we are in scope 2&quot;)
{ instruction: print, input: (&quot;we are in scope 2&quot;), scope: 2 }
// scope =&amp;gt; 0
{ instruction: jump, input(0), scope: 2}

// ====== scope 3 ======
// print(&quot;we are in scope 3&quot;)
{ instruction: print, input: (&quot;we are in scope 3&quot;), scope: 3 }
// scope =&amp;gt; 0
{ instruction: jump, input(0), scope: 3}

// ====== scope 0 ======
{ instruction: print, input: (&quot;we are back in scope 0&quot;), scope: 2 }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We start by evaluating &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x &amp;gt; 10&lt;/code&gt;. If it is true, we navigate to scope 2, print “we are in scope 2”, then navigate back to scope 0 where we print “we are in scope 0”. If x is less than or equal to 10, then we navigate to scope 3, print “we are in scope 3”, finally navigating back to scope 0 where we print “we are in scope 0”.&lt;/p&gt;

&lt;p&gt;Equivalent ruby code would look like this:&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;x&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;we are in scope 2&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
  &lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;we are in scope 3&quot;&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;print&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;we are in scope 0&quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Going “backwards” to &lt;em&gt;repeat&lt;/em&gt; ourselves&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are times where it might be useful to repeat some logic. In most programming languages, you can accomplish this with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;loop&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-rust highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;nd&quot;&gt;println!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Before loop&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;..&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;42&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;nd&quot;&gt;println!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Iteration: {}&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nd&quot;&gt;println!&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;After loop&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;With only the basic scope-based sequential execution we’ve laid out thus far, the only way to replicate the above looping logic is by loop unrolling &lt;sup id=&quot;fnref:19&quot; role=&quot;doc-noteref&quot;&gt;&lt;a href=&quot;#fn:19&quot; class=&quot;footnote&quot; rel=&quot;footnote&quot;&gt;19&lt;/a&gt;&lt;/sup&gt;. However, that is not practical. Thus, we’ve introduced the concept of an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;instruction id&lt;/code&gt; and a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;goto&lt;/code&gt; instruction type. The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;goto&lt;/code&gt; instruction (as outline in the table of the preceding section) accepts a single input, the instruction id to navigate to. Thus, we can replicate the above code with the following collection of DTR instructions.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;{ id: 0, instruction: &quot;print&quot;, input: (&quot;Before loop&quot;), scope: 0 }
{ id: 1, instruction: assign, input: (0), assign: i, scope: 0 }
{ id: 2, instruction: evaluate, input: (less than, i, 42), assign: LOOP_CHECK, scope: 0 }
{ id: 3, instruction: jump, input: (LOOP_CHECK, 1), scope: 0 }

{ id: 4, instruction: &quot;print&quot;, input: (&quot;Iteration: {}&quot;, i), scope: 1 }
{ id: 5, instruction: &quot;increment&quot;, input: (i), scope: 1}
{ id: 6, instruction: &quot;goto&quot;, input: (3), scope: 1}

{ id: 7, instruction: &quot;print&quot;, input: (&quot;After loop&quot;, scope: 0) }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here we assign &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt;. Then we check if &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;i&lt;/code&gt; is less than &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;42&lt;/code&gt;. If so, we navigate to scope 1. In scope 1, we print our message, increment i, then navigate back to the loop check. This code will continue executing until we fail the loop check. Once we fail, we don’t jump to scope 1 and so instructions with the ids of 4, 5, and 6 are skipped. Thus, we print “After loop” and the program terminates.&lt;/p&gt;

&lt;p&gt;At this point, we’ve outlined the basics of instruction execution flow for DTR.&lt;/p&gt;

&lt;h4 id=&quot;valid-types&quot;&gt;&lt;strong&gt;&lt;u&gt;Valid Types&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;Basic Types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A.K.A. primitive types.&lt;/p&gt;

&lt;p&gt;Digicus supports the following:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Address&lt;/li&gt;
  &lt;li&gt;BigInteger&lt;/li&gt;
  &lt;li&gt;Boolean&lt;/li&gt;
  &lt;li&gt;Float&lt;/li&gt;
  &lt;li&gt;Integer&lt;/li&gt;
  &lt;li&gt;String&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Container Types&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Types that contain types.&lt;/p&gt;

&lt;p&gt;Digicus supports the following:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;List:&lt;/strong&gt; homogenous, single unary (ex. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;List&amp;lt;Integer&amp;gt;&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Dictionary:&lt;/strong&gt; homogenous in dimension, binary arity (ex. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Dictionary&amp;lt;String, Integer&amp;gt;&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Range:&lt;/strong&gt; an iterator over some values (ex. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Range&amp;lt;Integer&amp;gt;&lt;/code&gt;)&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Tuple&lt;/strong&gt;: n-ary arity (ex. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Tuple&amp;lt;Integer, Integer, String&amp;gt;&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;conclusion&quot;&gt;&lt;strong&gt;&lt;u&gt;Conclusion&lt;/u&gt;&lt;/strong&gt;&lt;/h1&gt;

&lt;p&gt;We believe Digicus will revolutionize the way budding smart contract newcomers onboard into this powerful and wonderful ecosystem. Furthermore, as with scratch &lt;strong&gt;we expect folks to eventually graduate from Digicus native smart contracts to leveraging the core programming language of their blockchain of choice&lt;/strong&gt;. At this point, Digicus will become a &lt;em&gt;sidecar&lt;/em&gt; IDE; opened in a window adjacent to their text editor, smart contract developers will be able to leverage the incredible tooling of Digicus to &lt;em&gt;enhance&lt;/em&gt; their current development flow.&lt;/p&gt;

&lt;p&gt;Presented visually, we believe the evolution of Digicus will look like this:&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;img src=&quot;../../images/stairway_to_success.png&quot; alt=&quot;Digicus Stairway to Success&quot; /&gt; 
&lt;/div&gt;

&lt;p&gt;As time goes on, we will work with developers to solicit feedback and conduct surveys in order to ensure we have the greatest possible positive impact on this community. These survey results will be posted on &lt;a href=&quot;https://spaced-out-thoughts-dev-foundation.github.io/&quot;&gt;our website&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Until then, please feel free to follow &lt;a href=&quot;https://github.com/spaced-out-thoughts-dev-foundation&quot;&gt;our coding journey here&lt;/a&gt; and experiment with &lt;a href=&quot;https://ide.digicus.dev/&quot;&gt;the IDE here&lt;/a&gt;.&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;references&quot;&gt;&lt;strong&gt;&lt;u&gt;References&lt;/u&gt;&lt;/strong&gt;&lt;/h1&gt;

&lt;div class=&quot;footnotes&quot; role=&quot;doc-endnotes&quot;&gt;
  &lt;ol&gt;
    &lt;li id=&quot;fn:1&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://ethereum.org/content/whitepaper/whitepaper-pdf/Ethereum_Whitepaper_-_Buterin_2014.pdf&quot;&gt;Ethereum: A Next-Generation Smart Contract and Decentralized Application Platform. By Vitalik Buterin (2014)&lt;/a&gt; &lt;a href=&quot;#fnref:1&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:2&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://www.truevaluemetrics.org/DBpdfs/BlockChain/Nick-Szabo-Smart-Contracts-Building-Blocks-for-Digital-Markets-1996-14591.pdf&quot;&gt;Smart Contracts: Building Blocks for Digital Markets - Nick Szabo 1996 (partial rewrite of original)&lt;/a&gt; &lt;a href=&quot;#fnref:2&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:3&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://soliditylang.org/&quot;&gt;Solidity: A statically-typed curly-braces programming language designed for developing smart contracts that run on Ethereum&lt;/a&gt; &lt;a href=&quot;#fnref:3&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:4&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://stellar.org/soroban&quot;&gt;Soroban Smart Contracts&lt;/a&gt; &lt;a href=&quot;#fnref:4&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:5&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://www.hyperledger.org/participate/basics-v2&quot;&gt;Hyperledge Foundation: Learn the Basics&lt;/a&gt; &lt;a href=&quot;#fnref:5&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:6&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://www.openzeppelin.com/&quot;&gt;OpenZepplin: Securely Code, Deploy and Operate your Smart Contracts&lt;/a&gt; &lt;a href=&quot;#fnref:6&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:7&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://web.media.mit.edu/~mres/papers/Scratch-CACM-final.pdf&quot;&gt;Scratch: Programming for All &lt;/a&gt; &lt;a href=&quot;#fnref:7&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:8&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://ieeexplore.ieee.org/document/9680565&quot;&gt;SmartBuilder: A Block-based Visual Programming Framework for Smart Contract Development: Mpyana Mwamba Merlec; Youn Kyu Lee; Hoh Peter In&lt;/a&gt; &lt;a href=&quot;#fnref:8&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:9&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://www.aergo.io&quot;&gt;Aergo blockchain&lt;/a&gt; &lt;a href=&quot;#fnref:9&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:10&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/1801.00687&quot;&gt;Scilla: a Smart Contract Intermediate-Level LAnguage: Ilya Sergey, Amrit Kumar, Aquinas Hobor&lt;/a&gt; &lt;a href=&quot;#fnref:10&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:11&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://llvm.org/pubs/2004-01-30-CGO-LLVM.pdf&quot;&gt;LLVM: A Compilation Framework for Lifelong Program Analysis &amp;amp; Transformation: Chris Lattner, Vikram Adve&lt;/a&gt; &lt;a href=&quot;#fnref:11&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:12&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Rob_Pike&quot;&gt;Rob Pike - Wikipedia&lt;/a&gt; &lt;a href=&quot;#fnref:12&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:13&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=yE5Tpp2BSGw&quot;&gt;Rob Pike - What We Got Right, What We Got Wrong, GopherConAU 2023&lt;/a&gt; &lt;a href=&quot;#fnref:13&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:14&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://github.com/spaced-out-thoughts-dev-foundation/bean-**stock**&quot;&gt;Bean Stock Compiler Plugin Hub&lt;/a&gt; &lt;a href=&quot;#fnref:14&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:15&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://github.com/features/copilot&quot;&gt;Giuthub Copilot&lt;/a&gt; &lt;a href=&quot;#fnref:15&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:16&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://github.com/hyperledger/solang&quot;&gt;Solang: Solidity to Solana&lt;/a&gt; &lt;a href=&quot;#fnref:16&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:17&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://polkadot.network/features/technology/&quot;&gt;Polkadot: any type of data across any type of blockchain&lt;/a&gt; &lt;a href=&quot;#fnref:17&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:18&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Program_counter&quot;&gt;Program Counter - Wikipedia&lt;/a&gt; &lt;a href=&quot;#fnref:18&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
    &lt;li id=&quot;fn:19&quot; role=&quot;doc-endnote&quot;&gt;
      &lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Loop_unrolling&quot;&gt;Loop unrolling - Wikipedia&lt;/a&gt; &lt;a href=&quot;#fnref:19&quot; class=&quot;reversefootnote&quot; role=&quot;doc-backlink&quot;&gt;&amp;#8617;&lt;/a&gt;&lt;/p&gt;
    &lt;/li&gt;
  &lt;/ol&gt;
&lt;/div&gt;
</description>
          <pubDate>2024-10-10T00:00:00-07:00</pubDate>
          <link>https://robdurst.com/Digicus-Whitepaper</link>
          <guid isPermaLink="true">https://robdurst.com/Digicus-Whitepaper</guid>
        </item>
      
    
      
        <item>
          <title>TypeScript&apos;s keyof and Structural Typing</title>
          <description>&lt;p&gt;As I explore the possible solution space for designing a type for the &lt;a href=&quot;https://pyret.org/&quot;&gt;Pyret programming language&lt;/a&gt; with &lt;a href=&quot;https://users.cs.utah.edu/~blg/&quot;&gt;Ben Greenman&lt;/a&gt;, I’ve spent some time grappling with the concept of structural type compatibility. Specifically, I am interested in TypeScript’s type system and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keyof&lt;/code&gt; operator. This blog post focuses on summarizing what I’ve learned thus far (&lt;em&gt;DISCLAIMER: this post might contain inaccuracies as I continue to refine my understanding&lt;/em&gt;).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If these concepts interest you, stay tuned. I plan to continue exploring these ideas and ultimately aim to answer questions like: can we leverage this concept within Pyret?&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;type-compatibility&quot;&gt;Type compatibility&lt;/h2&gt;

&lt;p&gt;We’ll use the term &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;type compatible&lt;/code&gt; throughout this post, so let’s take a moment to formally define it. As best summed up by &lt;a href=&quot;http://wiki.c2.com/?NominativeAndStructuralTyping&quot;&gt;Nominative and Structural Typing&lt;/a&gt;, type systems &lt;em&gt;must&lt;/em&gt; be able to answer two type compatibility questions:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;equivalence:&lt;/strong&gt; &lt;em&gt;given two type expressions T1 and T2, are T1 and T2 equivalent? In other words, are all objects of type T2 valid objects of type T1, and vice versa? Commonly written as T1 == T2&lt;/em&gt;&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;subtype:&lt;/strong&gt; &lt;em&gt;given two type expressions T1 and T2, is T1 a subtype of T2? In other words, are all objects of type T1 also objects of type T2? Commonly written as T1 &amp;lt;= T2&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Generally, there are two main approaches to answering these questions: structural typing and nominal typing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Structurally typed:&lt;/strong&gt; type compatibility is determined by the structure of the types&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nominally typed:&lt;/strong&gt; type compatibility is determined by the name of the types&lt;/p&gt;

&lt;p&gt;Consider the following example.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;foo {
    bar: () =&amp;gt; string
}

baz {
    bar: () =&amp;gt; string
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;In a nominally typed language, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;foo != bar&lt;/code&gt;, however in a structurally typed language, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;foo == bar&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What about Duck Typing?&lt;/strong&gt; Duck typing is dynamic type compatibility at runtime; both structural and nominative typing are static. Furthermore, typically at runtime we just care if an object has a specific property more so than if an object is really &lt;em&gt;some type&lt;/em&gt; (i.e. don’t care as much about the type’s name or &lt;em&gt;entire&lt;/em&gt; type structure).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Which is better?&lt;/strong&gt; Of course, &lt;em&gt;it depends&lt;/em&gt;: one of the main pros of nominal typing is differentiation between two types of the same structure, i.e. MeasurementInFeet and MeasurementInMeters. Structural typing is advantageous for its flexibility.&lt;/p&gt;

&lt;p&gt;While we’re comparing structural and nominal type systems, note that &lt;em&gt;hybrid&lt;/em&gt; systems (I don’t believe this is a technical term) exist.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;At a base level, C++ is nominatively typed–two classes with different names are not considered equivalent; and subtyping must be explicitly declared (via inheritance). However, the template system uses structural typing–any type can be an argument to any template; and the compiler won’t complain unless a particular instantiation of a template is incompatible with its declaration. – &lt;a href=&quot;http://wiki.c2.com/?NominativeAndStructuralTyping&quot;&gt;Nominal and Structural Typing&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is a nice table summarizing type compatibility for a large set of programming languages: &lt;a href=&quot;https://en.wikipedia.org/wiki/Comparison_of_programming_languages_by_type_system&quot;&gt;Comparison of programming languages by type system - Wikipedia&lt;/a&gt;.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;structural-typing&quot;&gt;Structural Typing&lt;/h2&gt;

&lt;p&gt;I have much more experience with nominally typed systems: C#, Python, Java, Rust (albeit a bit fuzzy), Haskell (which is &lt;em&gt;mostly nominal&lt;/em&gt;), etc. Thus, I will focus here on structurally typed languages.&lt;/p&gt;

&lt;h3 id=&quot;typescript&quot;&gt;TypeScript&lt;/h3&gt;

&lt;p&gt;TypeScript is a structurally typed programming language that transpiles to Javascript allowing for engineers to gradually introduce types to an existing, dynamic, duck typed, Javascript codebase and/or leverage the expansive JavaScript ecosystem with an additional layer of safety.&lt;/p&gt;

&lt;p&gt;Unless you’re already familiar with TypeScript’s type system, I’d recommend opening up a &lt;a href=&quot;https://www.typescriptlang.org/play&quot;&gt;TS Playground online editor&lt;/a&gt; in another screen as you read along.&lt;/p&gt;

&lt;p&gt;In a structurally typed language, since we care about structure, not about name, an analogous operator for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.class&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.type&lt;/code&gt; is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keyof&lt;/code&gt; (hand wavy, hand wavy), where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keyof&lt;/code&gt; returns a concatenated collection of object properties.&lt;/p&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Point&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// &quot;x&quot; | &quot;y&quot;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;P&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;keyof&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Point&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;TypeScript does have the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;typeof&lt;/code&gt; operator, however it is limited (&lt;a href=&quot;https://www.typescriptlang.org/docs/handbook/2/typeof-types.html#limitations&quot;&gt;see more on limitations here&lt;/a&gt;).&lt;/p&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Point&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nl&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// typeof pt = { x: number; y: number }&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Point&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;11&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;keyof-examples&quot;&gt;keyof Examples&lt;/h3&gt;

&lt;p&gt;So in what ways is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keyof&lt;/code&gt; useful? It may not be immediately obvious… it certainly wasn’t for me!&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;(1) accessing an object in a “safe” way via generic constraints&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kr&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Food&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;isTasty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;pizza&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;isTasty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;isMyAThing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;food&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Food&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;attribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;keyof&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Food&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;boolean&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;food&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;attribute&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;];&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;nx&quot;&gt;isMyAThing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pizza&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;isTasty&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;isMyAThing&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;pizza&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;isHealthy&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;// will fail&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;isMyAThing&lt;/code&gt; does two interesting things: (a) indexes properties of a type (b) constrains input of attribute to just being valid properties of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Food&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;(2) map over properties of an existing type&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Boolify&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;// read &quot;for each key in T translate to boolean&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;K&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;keyof&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;T&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;boolean&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; 

&lt;span class=&quot;kr&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;SomethingUseful&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;SomethingLessUseful&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Boolify&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;SomethingUseful&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;let&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;notHelpful&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;SomethingLessUseful&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;age&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Boolify&lt;/code&gt; maps all properties of the generic &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;T&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;boolean&lt;/code&gt;s,&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;(3) work in conjunction with utility types (i.e. Record, Pick, etc.) which manipulate the type (since its structural typing, that means manipulating the underlying properties)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Consider &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Record&lt;/code&gt;: which &lt;em&gt;constructs an object type whose property keys are Keys and whose property values are Type. This utility can be used to map the properties of a type to another type&lt;/em&gt;. More formally: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Record&amp;lt;Keys, Type&amp;gt;&lt;/code&gt; (&lt;a href=&quot;https://www.typescriptlang.org/docs/handbook/utility-types.html#recordkeys-type&quot;&gt;Record Type - TypeScript Handbook&lt;/a&gt;)&lt;/p&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Qualities&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;isTasty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;isHealthy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;calories&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kr&quot;&gt;interface&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Info&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;nl&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;string&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Food&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;Record&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;kr&quot;&gt;keyof&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Qualities&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Info&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;asparagus&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Food&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;isTasty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sometimes&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;isHealthy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;yes!&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;calories&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;idk&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;(4) create new types&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Food&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;isTasty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Decoration&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;isPretty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;boolean&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// intersection type: combination of all properties&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DecorativeFood&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Food&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Decoration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;weddingCake&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DecorativeFood&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;isTasty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;isPretty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// union type: one type _or_ the other&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DecorationOrFood&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Food&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Decoration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;bacon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DecorationOrFood&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;isTasty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;painting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DecorationOrFood&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;na&quot;&gt;isPretty&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// union type and keyof&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;type&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DecorationOrFoodDescription&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;keyof&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Food&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;|&lt;/span&gt; &lt;span class=&quot;kr&quot;&gt;keyof&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Decoration&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;bacon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DecorationOrFoodDescription&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;isTasty&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;painting&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DecorationOrFoodDescription&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;  &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;isPretty&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;With a basic understanding of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keyof&lt;/code&gt; and structural typing, the next question is &lt;em&gt;can we implement a similar &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keyof&lt;/code&gt; operator for Pyret?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Pyret’s core is written in JavaScript. Thus, we should be able to, more-or-less, translate &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keyof&lt;/code&gt; from TypeScript to JavaScript and implement it as a built-in method for Pyret. However this assumes that core types are implemented as objects in a fairly consistent way… if not, implementing &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keyof&lt;/code&gt; might be a heavier lift than expected.&lt;/p&gt;

&lt;p&gt;We’ll explore this in a following post.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Structural_type_system&quot;&gt;Structural Typing - Wikipedia&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Nominal_type_system&quot;&gt;Nominal Typing - Wikipedia&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.TypeScriptlang.org/docs/handbook/type-compatibility.html&quot;&gt;Type compatibility - TypeScript Handbook&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://wiki.c2.com/?NominativeAndStructuralTyping&quot;&gt;Nominal and Structural Typing&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/Microsoft/TypeScript/issues/202&quot;&gt;Nominal Typing Proposal TypeScript&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/https://www.oracle.com/technical-resources/articles/java/javareflection.html&quot;&gt;Comparison of Programming Languages by Type System - Wikipedia&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.oracle.com/technical-resources/articles/java/javareflection.html&quot;&gt;Using Reflection in Java&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.typescriptlang.org/docs/handbook/2/keyof-types.html&quot;&gt;KeyOf TypeScript&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blog.bitsrc.io/type-vs-interface-in-typescript-cf3c00bc04ae&quot;&gt;Types vs. Interface in TypeScript&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://blog.logrocket.com/how-to-use-keyof-operator-typescript/&quot;&gt;How to use KeyOf Operator in TypeScript&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://byby.dev/ts-keyof&quot;&gt;5 ways to use &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;keyof&lt;/code&gt; operator in TypeScript&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/57337598/in-typescript-what-do-extends-keyof-and-in-keyof-mean&quot;&gt;Stackoverflow question about &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;extend keyof&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;in keyof&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://mariusschulz.com/blog/keyof-and-lookup-types-in-typescript&quot;&gt;keyof and Lookup Types in TypeScript&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://mariusschulz.com/blog/mapped-types-in-typescript#modeling-object-freeze-with-mapped-types&quot;&gt;Mapped Types in TypeScript&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.cis.upenn.edu/~bcpierce/tapl/&quot;&gt;Types and Programming Languages - Benjamin C. Pierce - 19.3&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.typescriptlang.org/docs/handbook/utility-types.html&quot;&gt;Utility Type - TypeScript Handbook&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.typescriptlang.org/docs/handbook/unions-and-intersections.html&quot;&gt;Unions and Intersection Types - TypeScript Handbook&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
          <pubDate>2023-07-17T22:00:00-07:00</pubDate>
          <link>https://robdurst.com/KeyOf</link>
          <guid isPermaLink="true">https://robdurst.com/KeyOf</guid>
        </item>
      
    
      
        <item>
          <title>Napkin Math at Work</title>
          <description>&lt;p&gt;I am about four months into my journey at &lt;a href=&quot;https://springhealth.com&quot;&gt;Spring Health&lt;/a&gt; and it’s been a great learning experience thus far! Besides learning the ins-and-outs of Rails, a coworker and I have set up a load testing environment and utilized this to bring forth a few notable perf wins. Those stories are worthy of the official Spring Health Engineering Blog… stay tuned!&lt;/p&gt;

&lt;p&gt;However, here’s a sneak peak.&lt;/p&gt;

&lt;h2 id=&quot;system-awareness&quot;&gt;System Awareness&lt;/h2&gt;

&lt;p&gt;Ice hockey is a rather complex sport. Towards the end of my &amp;gt;15 year “career” playing ice hockey, I became a penalty kill specialist; I specialized in ensuring my team did not give up a goal when playing down a man (or two).&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;keep your head on a swivel&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/xT9IgtgWuP0irJKq8E/giphy.gif&quot; alt=&quot;head on a swivel&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Knowing where everyone was in relation to the player with the puck, or &lt;em&gt;keeping your head on a swivel&lt;/em&gt;, while deducing the opposing team’s system (Brad on defense, the middle of the umbrella powerplay system,  always turns up the shot while Pete, the top goal scorer, keeps trying to sneak back door) required a great sense of situational awareness.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://www.crossicehockey.com/wp-content/uploads/2014/04/umbrella-pp.jpg&quot; alt=&quot;umbrella powerplay&quot; /&gt;&lt;/p&gt;

&lt;p&gt;At risk of sounding cheesy, I’ve found killing penalties fairly analogous to developing a performance engineering mindset. Both require proper observability practices (head on a swivel… or &lt;a href=&quot;https://www.datadoghq.com/&quot;&gt;Datadog&lt;/a&gt;). Both require an understanding of what’s typical (Brad never shoots… customers traffic load follows the business day). Both require a mental model of the system (three man high umbrella… frontend react, backend a combination of queues, databases, servers, etc.). And finally, both require some basic stats (on the penalty kill we will always be outnumbered…  5 million requests taking 100ms across 10 containers, etc., etc., etc.).&lt;/p&gt;

&lt;h2 id=&quot;some-basic-stats&quot;&gt;Some Basic Stats&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/4JVTF9zR9BicshFAb7/giphy.gif&quot; alt=&quot;math guy gif&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Yes, basic with a capital B. Basic stats and napkin math go a long way. Unconvinced? Consider the following…&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/SVL5Dws0bOSgE/giphy.gif&quot; alt=&quot;Bill Nye consider the following&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Let’s say a company expects to process 100 million records next week. Since this is a fairly expensive job, they do it in batched tasks using separate resources from their production environment. You observe that, as is, the processing takes so long that it will still be in progress as the next batch of records come the following week.&lt;/p&gt;

&lt;p&gt;Let’s add some more context.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;100 million records
1 task/container at a time
100 records/task
4 containers (4 cores each)
400ms per processing per record
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Thus, we can quickly guestimate how long processing currently takes.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1 million tasks = 100 million records / 100 batch size
250,000 concurrently executing tasks = 1 million / 4 containers
40 sec = 400ms * 100 batch size
10,000,000 sec = 40 sec/task * 250,000 tasks

~16.5 weeks = 10,000,000 sec / (60 * 60 * 24 * 7)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Putting on your thinking cap, you dig in to the data your APM presents and discover the following:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;each separate record spends 175ms of processing time encrypting unused data&lt;/li&gt;
  &lt;li&gt;during processing, we batch 100 records at a time into a task, where each container can only execute one task at a time and each task is not that computationally expensive&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Is it worth the time to implement the possible changes we discovered above?&lt;/p&gt;

&lt;p&gt;Since we don’t need to encrypt the useless data, let’s cut that (and on a closer look, we actually encrypt two useless fields, so let’s cut both of those!!). The time to process a single record is now only 50ms! Furthermore, since each task is independent and computationally cheap, let’s reconfigure our cloud cpu resources to 16 containers, 1 core each.&lt;/p&gt;

&lt;p&gt;With this, let’s redo our math.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1 million tasks = 100 million / 100 batch size
62,500 concurrently executing tasks = 1 million / 16 containers
50 sec = 50ms * 100 batch size
312,000 sec = 5 sec/task * 62,500 tasks
~0.5 weeks = 312,500 sec / (60 * 60 * 24 * 7)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Not only do these minimal changes sound trivial to implement, it’s clearly worth our time. With just a bit of research and kindergarten level mathematics, we’ve made a broken process much cheaper, efficient, and bottomline… feasible.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Napkin math is an art - it requires knowing what’s important and what you can gloss over. Used effectively, it’s a great tool for determining potential performance wins, ballparking future server traffic load, and quickly checking someone else’s numbers. For me, it’s be helpful in justifying how I spend my free cycles at Spring; it’s a very quick way to determine the biggest bang for your buck!&lt;/p&gt;
</description>
          <pubDate>2022-08-12T10:00:00-07:00</pubDate>
          <link>https://robdurst.com/Napkin-Math-at-Work</link>
          <guid isPermaLink="true">https://robdurst.com/Napkin-Math-at-Work</guid>
        </item>
      
    
      
        <item>
          <title>RSS Feed Up and Running! How I did it.</title>
          <description>&lt;p&gt;Finally set up RSS feed so my followers can actually subscribe!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/73oSygWJFG9K1ha75z/giphy.gif&quot; alt=&quot;hit that subscribe button&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Turns out it’s quite easy to set up an RSS feed with &lt;a href=&quot;https://jekyllrb.com/&quot;&gt;Jekyll&lt;/a&gt;. It’s spelled out fairly well &lt;a href=&quot;https://www.r-bloggers.com/2019/12/creating-an-rss-feed-to-add-your-jekyll-github-pages-blog-to-r-bloggers/&quot;&gt;here&lt;/a&gt;, although it mostly focuses on getting set up with R Blogger. I will be paraphrasizing and focusing on a general RSS feed setup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;[First]&lt;/strong&gt;, set up your Jekyll blog. Add the gem &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;jekyll-feed&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Gemfile&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;*** abbreviated ***

gem &apos;jekyll-feed&apos;

*** abbreviated ***
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;_config.yml&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;*** abbreviated ***

plugins:
  - jekyll-feed

*** abbreviated ***
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;[Second]&lt;/strong&gt; run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bundle install&lt;/code&gt; to install locally. My local ruby env. is kinda messed up so I skipped this step. Test in prod right?!?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;[Third]&lt;/strong&gt; push to GitHub. Once it is pushed check that all is well by navigating to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;http://YOUR_PAGE/feed.xml&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;At first, if you do not have an RSS reader it may say something along the lines of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;No RSS reader installed.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;[Fourth]&lt;/strong&gt; install an RSS reader if you don’t have one.&lt;/p&gt;

&lt;p&gt;As an example, let’s say you downloaded the &lt;a href=&quot;https://chrome.google.com/webstore/detail/rss-feed-reader/pnjaodmkngahhkoihejjehlcdlnohgmp?hl=en&quot;&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;RSS Feed Reader&lt;/code&gt; Chrome extension&lt;/a&gt; and navigate to &lt;a href=&quot;https://robdurst.com/feed.xml&quot;&gt;my blog’s RSS feed&lt;/a&gt;, you should see something like this:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://imgur.com/TVkFevR.png&quot; alt=&quot;my blog as seen by RSS reader&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;[Fifth]&lt;/strong&gt; users should be able to subscribe to email alerts. While you could use the above Chrome extension, I am using &lt;a href=&quot;feedrabbit.com&quot;&gt;FeedRabbit&lt;/a&gt;. Not 100% sure how well it works because I believe it emails notifications daily (and I just set this up today), but I imagine it gets the job done.&lt;/p&gt;
</description>
          <pubDate>2022-04-15T10:00:00-07:00</pubDate>
          <link>https://robdurst.com/Setting-up-an-Rss-Feed-copy</link>
          <guid isPermaLink="true">https://robdurst.com/Setting-up-an-Rss-Feed-copy</guid>
        </item>
      
    
      
        <item>
          <title>Springing into a New Adventure</title>
          <description>&lt;p&gt;This announcement comes a bit pre-mature. While those close to me, my most immediate network, and my direct coworkers know, no one else does yet; I read online it’s common courtesy to wait until 2 weeks into your new gig to tell the world. Whatever. So. For anyone who follows my blog close enough to discover this post (good on you, there’s no RSS feed, so you must have wondered by here on your own accord), you get this announcement in advance (and with a bit of an explanation too).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;EDIT (4/16/22) I do now have an RSS feed!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In true Linkedin fashion…&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I am pleased to announce I have accepted a fulltime position as software engineer at Spring Health.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/nV92wySC3iMGhAmR71/giphy.gif&quot; alt=&quot;celebrate&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;immediate-reactions&quot;&gt;Immediate Reactions&lt;/h2&gt;

&lt;p&gt;Ok, Rob, so why?&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;DocuSign is a great company (&lt;a href=&quot;https://www.glassdoor.com/Reviews/DocuSign-Reviews-E307604.htm&quot;&gt;see here&lt;/a&gt;) among other awards/top ten lists they have been on.&lt;/li&gt;
  &lt;li&gt;My managers have been wonderful&lt;/li&gt;
  &lt;li&gt;The work is very interesting&lt;/li&gt;
  &lt;li&gt;The company (except for the “outlook” which Wall Street throws a temper tantrum…) has been performing incredible!&lt;/li&gt;
  &lt;li&gt;Paper signatures WILL lose out in the long term&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If anyone is considering DocuSign, it’s an absolutely fantastic company. Would recommend to anyone (and gladly help connect you with some of the platform folks doing technically interesting things).&lt;/p&gt;

&lt;p&gt;So please Rob, fill me in.&lt;/p&gt;

&lt;h2 id=&quot;my-career&quot;&gt;My Career&lt;/h2&gt;

&lt;p&gt;I’ve talked to ALOT of people in the past few months. To those of you I’ve talked to, thanks for the help! Special shoutout to my girlfriend and parents… thanks for understanding my back-and-forth-back-and-forth.&lt;/p&gt;

&lt;p&gt;Ultimately, I made a sort of thesis on what I was looking for. It largely stemmed from the following quote:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;“It is well known the drunken sailor who staggers to the left or right with n independent random steps will, on the average, end up about square root of n steps from the origin. But if there is a pretty girl in one direction, then his steps will tend to go in that direction and he will go a distance proportional to n. In a lifetime of many, many independent choices, small and large, a career with a vision will get you a distance proportional to n, while no vision will get you only the distance . In a sense, the main difference between those who go far and those who do not is some people have a vision and the others do not and therefore can only react to the current events as they happen.” ― Richard Hamming, The Art of Doing Science and Engineering: Learning to Learn&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Thus, it was time to take control of my career. But in order to take control of my career, I needed a vision.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Vision:&lt;/strong&gt; become the world’s best performance engineer for hyper-growth startups.&lt;/p&gt;

&lt;p&gt;From this vision I can derive some sub goals:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;[technical] understand the nuts of bolts of all kinds of complex systems (live in rabbit holes) AND how they fit together&lt;/li&gt;
  &lt;li&gt;[technical] hack together some open source tools to accelerate performance engineering field as a whole&lt;/li&gt;
  &lt;li&gt;[technical] give a talk about some of the super cool stuff I did at work at a conference&lt;/li&gt;
  &lt;li&gt;[financial] buy a house in 5 years (perf. eng. are in high demand and typically do well in this regard)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But, this all comes from the primary vision. So how do I get there?&lt;/p&gt;

&lt;p&gt;According to a conversation I had with the creator of the &lt;a href=&quot;https://github.com/Netflix/flamescope&quot;&gt;flamescope tool&lt;/a&gt;, there are three main avenues to improvement in this field (maybe we can abstract this to any field?):&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;experience&lt;/li&gt;
  &lt;li&gt;mentorship&lt;/li&gt;
  &lt;li&gt;reading&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This person whom I spoke with was a huge believer in (1). He pointed out his colleague, creator of &lt;a href=&quot;https://www.brendangregg.com/flamegraphs.html&quot;&gt;flamegraphs&lt;/a&gt; was very much a (3). Many of my coworkers at DocuSign pointed to (2) being incredibly important.&lt;/p&gt;

&lt;p&gt;So, Spring Health. I believe this offers the opportunity to get all 3:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;[experience] a startup with growing pains offers the opportunity to OWN systems which have performance issues&lt;/li&gt;
  &lt;li&gt;[mentorship] will be able to work with a previous manager who’s a “wizard” in perf things (as said by previous DocuSign coworkers)&lt;/li&gt;
  &lt;li&gt;[reading] I already have WAY too many books on my shelf to leaf through, (2) for me has provided a few reccomendations. Time to buckle down. Will probably dedicate a future blog post to however I figure out the best notetaking/knowledge retention strategy.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/l2Je2D0LnDmHux3TG/giphy.gif&quot; alt=&quot;my vision&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;but-rob-why-spring-health&quot;&gt;But Rob, Why Spring Health&lt;/h2&gt;

&lt;p&gt;Ok, ok, ok. So maybe there would be other places that could also offer 1-3. Why Spring Health?&lt;/p&gt;

&lt;p&gt;Here is a random laundry list of reasons why:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;one of the tech leads believes in blogging&lt;/li&gt;
  &lt;li&gt;I believe in the mission; I have dealt with mental health issues personally&lt;/li&gt;
  &lt;li&gt;financial compensation is on par with what lifestyle I’d like to live&lt;/li&gt;
  &lt;li&gt;company size is between Stellar Development Foundation (~50) and DocuSign (~6500) offering a new experience&lt;/li&gt;
  &lt;li&gt;at a smaller eng. org., I can, as a mid-level eng., own things and thus grow my career faster&lt;/li&gt;
  &lt;li&gt;culture of peer programming (my new manager has worked remotely for a decade)&lt;/li&gt;
  &lt;li&gt;eng. org. recently turned over, chance to make a big impact as culture develops (into hopefully a great technically curious &amp;amp; learning community like I loved in SF)&lt;/li&gt;
  &lt;li&gt;unlimited PTO to coordinate vacations and time off with my girlfriend&lt;/li&gt;
  &lt;li&gt;doing my work on a MacBook (did someone say 16 inch !!!!)&lt;/li&gt;
  &lt;li&gt;I won’t be penalized for working in Miami (and furthermore won’t be penalized for moving with my girlfriend when she starts fellowship in a little over a year)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/rlfucqTYiYu2QW04pe/giphy.gif&quot; alt=&quot;not bad&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;other-criteria&quot;&gt;Other Criteria&lt;/h2&gt;

&lt;p&gt;A couple previous coworkers at DocuSign gave me further advice, other criteria I could use to consider if this was a good fit. I also will work in a couple role models.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First Manager:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I am blanking a bit this AM, but his framework went something like this:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;em&gt;For:&lt;/em&gt; who is leading the company? What is the company doing?&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;What:&lt;/em&gt; what are you working on?&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;With:&lt;/em&gt; who do you work directly with?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Based on the number of these you can answer positively, you can determine how good the opportunity is:&lt;/p&gt;

&lt;p&gt;1 –&amp;gt; good &lt;br /&gt;
2 –&amp;gt; great&lt;br /&gt;
3 –&amp;gt; dream&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;Here is how I’d answer:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;TBH I don’t know a ton about the founders, but I do believe in the product and the mission, so let’s give this a 0.5&lt;/li&gt;
  &lt;li&gt;I will be able to own some perf things, so definitely a 1.&lt;/li&gt;
  &lt;li&gt;I get to work with an old manager, and a few others that seem like awesome coworkers based on my interview conversations, thus this is also a 1.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, we get somewhere between a 2 and 3, &lt;em&gt;passing this test&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mentor:&lt;/strong&gt; is this an outsized opportunity?&lt;/p&gt;

&lt;p&gt;According to (yet-another-coworker), startups offer the greatest opportunity to own the largest portion of a codebase. Thus, if I can work hard, produce, ship, and gain the trust of my peers, there’s enough work to do such that opportunities here nearly limitless (while of less scope than DocuSign for the time being).&lt;/p&gt;

&lt;p&gt;Thus, we also &lt;em&gt;pass this test&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Richard Hamming:&lt;/strong&gt; yes, another story from Hamming… sorry, not sorry.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Over on the other side of the dining hall was a chemistry table. I had worked with one of the fellows, Dave McCall; furthermore he was courting our secretary at the time. I went over and said, ‘‘Do you mind if I join you?’’ They can’t say no, so I started eating with them for a while. And I started asking, ‘‘What are the important problems of your field?’’ And after a week or so, ‘‘What important problems are you working on?’’ And after some more time I came in one day and said, ‘‘If what you are doing is not important, and if you don’t think it is going to lead to something important, why are you at Bell Labs working on it?’’ I wasn’t welcomed after that; I had to find somebody else to eat with! That was in the spring. In the fall, Dave McCall stopped me in the hall and said, ‘‘Hamming, that remark of yours got underneath my skin. I thought about it all summer, i.e. what were the important problems in my field. I haven’t changed my research,’’ he says, ‘‘but I think it was well worthwhile.’’ And I said, ‘‘Thank you Dave,’’ and went on. I noticed a couple of months later he was made the head of the department. I noticed the other day he was a Member of the National Academy of Engineering. I noticed he has succeeded. I have never heard the names of any of the other fellows at that table mentioned in science and scientific circles. They were unable to ask themselves, ‘‘What are the important problems in my field?’’ - Richard Hamming, You and Your Research&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So, am I doing important work at Spring Health?&lt;/p&gt;

&lt;p&gt;While this question is certainly asked more in a “researchy” sense, it is a fundamental question that gives this job (and maybe even life) meaning. I do believe by helping make the Spring Health platform more performant and usable, I will be able to aid more people in receiving the mental health care they require.&lt;/p&gt;

&lt;p&gt;Furthermore, I believe by improving my own engineering skills such that I can hop into ANY hyper-growth startup in the future and I can do some very important work in my lifetime; of course this will only happen after I see the Spring Health opportunity all the way through… I hope to be at Spring for a long while, 4+ years such that I can actually do some very interesting work… yet-another-docusign-coworker stressed nothing impressive or interesting happens until years 2+ or 3+ at a company.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steve Jobs:&lt;/strong&gt; ok, one last one.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;For the past 33 years, I have looked in the mirror every morning and asked myself: ‘If today were the last day of my life, would I want to do what I am about to do today.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;While this is certainly a “day-to-day” question I must ask myself, the answer today is a definite yes. This is the best move for me, my career, and most importantly my life, the life I want to live.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;So that is probably more of an explanation than I owe anyone. Maybe this is too personal to be shared online? Who knows?&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/JRhS6WoswF8FxE0g2R/giphy.gif&quot; alt=&quot;who knows&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is a personal blog after all (with almost no SEO). Hopefully if someone else is in a career rut or trying to find a course for their career/life, this post can provide some guidance or at least motivation.&lt;/p&gt;
</description>
          <pubDate>2022-04-09T10:00:00-07:00</pubDate>
          <link>https://robdurst.com/A-New-Adventure</link>
          <guid isPermaLink="true">https://robdurst.com/A-New-Adventure</guid>
        </item>
      
    
      
        <item>
          <title>From the Archives: Independent Study 2019 Summary</title>
          <description>&lt;p&gt;Was digging through old repos on GitHub and came across my write-up for my Fall 2019 Independent Study at Colby College. This is the work which will result in me being mentioned in &lt;em&gt;Nessie: Automatically Testing JavaScript APIs with Asynchronous Callbacks&lt;/em&gt; which is being presented at &lt;a href=&quot;https://conf.researchr.org/details/icse-2022/icse-2022-papers/69/Nessie-Automatically-Testing-JavaScript-APIs-with-Asynchronous-Callbacks&quot;&gt;the ICSE 2022 conference&lt;/a&gt;.&lt;/p&gt;

&lt;h1 id=&quot;independent-study-fall-2019&quot;&gt;Independent Study Fall 2019&lt;/h1&gt;

&lt;p&gt;In a thematic continuation of my Spring 2019 indepedent study, where I designed and implemented the &lt;a href=&quot;https://github.com/sailfish-lang/sailfishc&quot;&gt;Sailfish&lt;/a&gt; programming language, this Fall I undertook a research project, exploring the extension of a feedback-directed random test generation framework, called &lt;a href=&quot;http://software-lab.org/publications/oopsla2018_LambdaTester.pdf&quot;&gt;LambdaTester&lt;/a&gt;, such that it could work with asynchronous code. My personal goal for this research was two fold:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;explore an interest in a research-based career path&lt;/li&gt;
  &lt;li&gt;dive into JavaScript internals… stop saying “JavaScript is whack” and actually understand why it is the way it is&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To complete this research, I collaborated with &lt;a href=&quot;http://www.franktip.org/&quot;&gt;Professor Frank Tip&lt;/a&gt; of the &lt;a href=&quot;https://prl.ccs.neu.edu/&quot;&gt;Northeastern University Programming Language Lab&lt;/a&gt; and was advised by &lt;a href=&quot;http://www.cs.colby.edu/maxwell/&quot;&gt;Professor Bruce Maxwell&lt;/a&gt; of &lt;a href=&quot;http://cs.colby.edu/&quot;&gt;Colby College&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;what-is-lambdatester&quot;&gt;What is LambdaTester?&lt;/h2&gt;

&lt;p&gt;LambdaTester is a test generation framework that employs four different strategies for generating callbacks to higher order methods in JavaScript. It is comprised of a two part algorithm. The first stage is callback discovery. Callback discovery looks to “learn” which methods expect callbacks as input and at which position(s). It does this via a 100 trial and error algorithm, which attempts different combinations of random values and a simple callback that logs a message. If this method is executed and logs the message, the callback’s position is recorded. The second stage is the actual test generation phase. This takes a few different inputs, such as the result from the first stage, an output directory, and whether or not to utilize a feedback-directed approach. The crux of this stage is the callback generation phase. There are four types of callbacks generated:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;strong&gt;empty:&lt;/strong&gt; a baseline test&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;quick test:&lt;/strong&gt; using a haskell influenced library, generate random values to return&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;callback mining:&lt;/strong&gt; follows the basic style/structure of callbacks from a corpus of code&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;feedback-directed:&lt;/strong&gt; the most interesting and effective method, uses previously generated and derived values from outer scopes and previous tests&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This framework was well received at OOPSLA 2018 and achieved impressive results, demonstrating incompatibility between versions of many well used, open-source, NPM packages. To learn more, checkout the paper linked above.&lt;/p&gt;

&lt;h2 id=&quot;asynclambdatester-basics&quot;&gt;AsyncLambdaTester Basics&lt;/h2&gt;

&lt;p&gt;The extension I explored focused on asynchronous callbacks. What is the difference between an asynchronous callback is when the callback gets executed – either right away, or at some unspecified time in the future. Asynchronous code introduces complexity into code, breaking any sort of assumptions that can be placed on the order of execution of given statements. LambdaTester did not seek to introduce or generate asynchronous callbacks. Thus, an entire interesting area of possible errors was ignored. With asynchonous callback generation, ordering bugs and a whole new domain of faulty assumptions can really be tested. In order to implement this extension, I needed to implement two things:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;classification of expected callbacks as either asynchronous or synchronous&lt;/li&gt;
  &lt;li&gt;a strategy for nesting method callbacks and reusing previously calculated/derived values&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Unfortunately, due to extenuating circumstances (mostly job interview and prep) I was only able to finish the first step – I came up with an algorithm and partially implemented 2, but do not have enough concrete to present (or want to expose the secret sauce for in-progress research).&lt;/p&gt;

&lt;h2 id=&quot;a-failed-attempt-at-improving-callback-discovery-prediction&quot;&gt;A Failed Attempt at Improving Callback Discovery Prediction&lt;/h2&gt;

&lt;p&gt;Before I even started the process of implementing an async/sync classification algorithm, I decided to step back and see if I could improve the current callback discovery algorithm. The problem with the current algorithm is that it was not exhaustive, thus for methods that expected something like: number, number, number, callback, the callback was not being discovered. Thus I underwent an interesting, albeit unsuccessful delve down the type inference rabbit hole. You can read all about it here: &lt;a href=&quot;https://robdurst.com/JavaScriptTypeInference&quot;&gt;Adventures in PL: Inferring Function Signatures in JavaScript&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;classifying-callback-parameters&quot;&gt;Classifying Callback parameters&lt;/h2&gt;

&lt;p&gt;The most clever and novel part of my work this Fall was the design and implementation of a method for classifying callbacks as either asynchronous or synchronous. The intuition came for this during a deep dive into how the Node.js event loop works. Here is a good video for the less familiar: &lt;a href=&quot;https://www.youtube.com/watch?v=8aGhZQkoFbQ&quot;&gt;https://www.youtube.com/watch?v=8aGhZQkoFbQ&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As an example, consider the following code:&lt;/p&gt;
&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;foo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;setTimeout&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;A totally sensible guess into what the output may be is “A” then “B”… however, that is not the case. But how can that be??? The timeout is set to 0ms… Well, it turns out that the timeout fires and then throws its callback method onto the event loop. Then, the rest of the code in the call stack executes, so “B” is logged. Once the call stack is empty, the asynchronous method, foo, is called, and “A” is logged. Crazy right? Well, not so much once you get the hang of the event loop.&lt;/p&gt;

&lt;p&gt;We can use this to our advantage. Consider a setTimeout method that instead accepted a method that would be executed synchronously. Then we would get “A” and then “B” as expected. Thus, if we execute methods as follows:&lt;/p&gt;
&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;foo&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;someMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;foo&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;B&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;We can classify the callback as asynchronous or synchronous depending on the ordering of the logged messages. It turns out this worked wonderfully, as tested against modules within the Node.js standard libraries.&lt;/p&gt;

&lt;h2 id=&quot;one-caveat&quot;&gt;One Caveat&lt;/h2&gt;

&lt;p&gt;However there were some cases where my method above failed… some really interesting edge cases. It turns out sometimes callbacks may be classified as both asynchronous and synchronous. So how can a method be synchronous and asynchronous? When working with various methods in the &lt;em&gt;zlib&lt;/em&gt; module, AsyncLambdaTester classified methods as both asynchronous and synchronous:&lt;/p&gt;
&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Discovery phase...  
&lt;span class=&quot;o&quot;&gt;[{&lt;/span&gt;  
	name: &lt;span class=&quot;s1&quot;&gt;&apos;deflate&apos;&lt;/span&gt;,  
	positions: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&apos;2: sync&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;2: async&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;3: sync&apos;&lt;/span&gt;, &lt;span class=&quot;s1&quot;&gt;&apos;3: async&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;  
&lt;span class=&quot;o&quot;&gt;}]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Let’s dive into some source code!&lt;/p&gt;
&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// Convenience methods.  &lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;// compress/decompress a string or buffer in one step.  &lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;deflate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;createConvenienceMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;Deflate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;false&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Hmmm… so it turns out deflate is a sort of convenience method around a more general Deflate function that works on a Deflate object. Let’s jump to the convenience creator:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;createConvenienceMethod&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;ctor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;sync&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;c1&quot;&gt;// skipping to the interesting code...  &lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;  &lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;asyncBufferWrapper&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;opts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
		&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;typeof&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;opts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;function&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;opts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;opts&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{};&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;  
			&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;zlibBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;ctor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;opts&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
		&lt;span class=&quot;p&quot;&gt;};&lt;/span&gt;  
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here we can see that an asynchronous method is created. If options are given, then the callback is the third method, otherwise it is the second. Let’s jump to the zlibBuffer method and see what’s going on there:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;function&lt;/span&gt;  &lt;span class=&quot;nx&quot;&gt;zlibBuffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
	&lt;span class=&quot;c1&quot;&gt;// skipping to the interesting code...  &lt;/span&gt;
	&lt;span class=&quot;nx&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;cb&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;callback&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;  
	&lt;span class=&quot;nx&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;data&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;zlibBufferOnData&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
	&lt;span class=&quot;nx&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;error&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;zlibBufferOnError&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
	&lt;span class=&quot;nx&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;zlibBufferOnEnd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
	&lt;span class=&quot;nx&quot;&gt;engine&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;end&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;buffer&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ah! So here we see that the callback is invoked in three different scenarios by an engine object (the zlib engine, &lt;a href=&quot;https://github.com/nodejs/node/tree/8b4af64f50c5e41ce0155716f294c24ccdecad03/deps/zlib&quot;&gt;a project dependency&lt;/a&gt;). Thus, the callback is not immediately pushed to the event loop to be invoked asynchronously, but actually may be called earlier. Let’s experiment! Consider the following test code:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;zlib&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;zlib&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  

&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;f&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;  
	&lt;span class=&quot;k&quot;&gt;return&lt;/span&gt;  &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`cb: #&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;${&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;`&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;  
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;  

&lt;span class=&quot;nx&quot;&gt;zlib&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;deflate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;  
&lt;span class=&quot;nx&quot;&gt;zlib&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;deflate&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;f&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;));&lt;/span&gt;  
&lt;span class=&quot;nx&quot;&gt;console&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;log&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;A&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;When we execute the above, we get:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;cb: &lt;span class=&quot;c&quot;&gt;#1  &lt;/span&gt;
A  
cb: &lt;span class=&quot;c&quot;&gt;#2&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ah ha! We have found the source of our confusion. Based on the realization of the zlib engine above, we see that if we give deflate the wrong type for the first parameter, the callback executes immediately – it is not pushed onto the event loop to be executed asynchronously. However, if deflate gets the correct type, even if the value is nonsensical/incorrect, it will execute asynchronously as expected.&lt;/p&gt;

&lt;h2 id=&quot;some-implementation-details---to-typescript-we-go&quot;&gt;Some Implementation Details - To Typescript We Go&lt;/h2&gt;

&lt;p&gt;An unanticipated sub goal that I accomplished during this study was gaining some familiarity with TypeScript. A rather lengthy and largely unnecessary, yet learning filled part of this study was cleaning up the LambdaTester codebase and writing all my extensions in TypeScript. This required, learning TypeScript, using linters to enforce code style,  and restructuring the code into OOD-esque classes (much easier done in TypeScript than Node.js). Ultimately this turned out to be a wonderful use of my time as I handed off the project to another student at NEU. Instead of a jumble of attempts to generate asynchronous tests, I left a well commented, clean, organized codebase. As they say: “&lt;em&gt;Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.&lt;/em&gt;”&lt;/p&gt;

&lt;h1 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;Ultimately my independent study was a success, although maybe not quite in the way I originally hoped. For one, I certainly learned much more about how Node.js works internally. However, I did not finish my implementation of AsyncLambdaTester and also decided not to follow the research career path. That being said, I owe Professor Tip and Professor Maxwell for allowing me to pursue this project! Even though it did not quite work out as hoped, I am glad I will be able to look back and say “at least I tried it” and not have doubts about my journey directly into industry!&lt;/p&gt;
</description>
          <pubDate>2022-01-18T04:19:21-08:00</pubDate>
          <link>https://robdurst.com/From-The-Archives-Fall-2019-Independent-Study</link>
          <guid isPermaLink="true">https://robdurst.com/From-The-Archives-Fall-2019-Independent-Study</guid>
        </item>
      
    
      
        <item>
          <title>Microsoft&apos;s Coyote vs. Async Server: Repro&apos;ing Race Condition &amp; Generating Test Corpus to Prove Fix</title>
          <description>&lt;p&gt;A few months ago at DocuSign, I was part of an effort to make some server code fully asynchronous. We’d gone down the async rabbit hole and during load testing, witnessed throughput limited by an async deadlock induced bottleneck. This was the final step to full asynchrony for a dependent service (SPOA, my primary focus at the time). While a coworker wrote the first 98% of the PR to make the server fully async, I was tasked with bringing the changes over the line.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/VQ77RNKX0nyaA/giphy.gif&quot; alt=&quot;checkered flag&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In doing so, I ran into some challenges, the most devious being an interesting race condition in the server’s graceful close behavior due to Linq querying it’s state to wait on a collection of Tasks while the data structure itself is still writable.&lt;/p&gt;

&lt;h3 id=&quot;some-psuedocode&quot;&gt;Some Psuedocode&lt;/h3&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;State:
	- ConcurrentDictionary&amp;lt;Connection_Handler_ID, Task&amp;gt;

Connection_Acceptance:
	1. Accept the connection
	2. Handle connection asynchronously and add Task to ConcurrentDictionary

Connection_Acceptance_Loop (THREAD 1):
	1. while (true) { Connection_Acceptance }

Close (THREAD 2):
	1. Stop TCP Listener
	2. Get state from ConcurrentDictionary
	3. Wait for Tasks from ConcurrentDictionary to complete
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;the-problem&quot;&gt;The Problem&lt;/h3&gt;

&lt;p&gt;Due to Close and Connection_Acceptance_Loop being executed on separate threads, it’s possible to end up with the following execution sequence:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Call Close&lt;/li&gt;
  &lt;li&gt;Accept a new connection&lt;/li&gt;
  &lt;li&gt;Stop TCP Listener&lt;/li&gt;
  &lt;li&gt;Get state from ConcurrentDictionary&lt;/li&gt;
  &lt;li&gt;Handle Connection Async and add Task to ConcurrentDictionary&lt;/li&gt;
  &lt;li&gt;Wait for Tasks from ConcurrentDictionary to complete&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Bug:&lt;/strong&gt; &lt;em&gt;here we end up not waiting for the task handled in (5) to complete since we grabbed a snap shot of the state from the ConcurrentDictionary in (4)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Conceptually its not too hard to come up with a solution. However, getting it right took a couple tries at finding the right synchronization primitive and was somewhat complicated by our desire to keep the main code path lockless.&lt;/p&gt;

&lt;p&gt;While I could try to simulate all the possible states in my head or on paper, I came across a really cool Microsoft research project called &lt;a href=&quot;https://www.microsoft.com/en-us/research/project/coyote/&quot;&gt;Coyoyte&lt;/a&gt;. Coyote does exactly this, simulates all (or at least many) of the possible code execution sequences, saving the executed sequences in order to be able to repro interesting ones on, say, failure.&lt;/p&gt;

&lt;p&gt;Thus, instead of just proving to myself and code reviewers that my solution made sense, I could intentionally create the failure scenario then run my solution against it to make sure it worked.&lt;/p&gt;

&lt;h3 id=&quot;setup---hello-world&quot;&gt;Setup - Hello World&lt;/h3&gt;

&lt;p&gt;While this tool sounds great in theory, I had no idea how to make it work. So, I started with a minimally useful hello world example to make sure everything is functioning.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;// Program.cs
public class Public
{
  public static void Main(string[] args) { }

  [Microsoft.Coyote.SystematicTesting.Test]
  public static void Foo()
  {
    NUnit.Framework.Assert.AreEqual(1, 1);
  }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;// Project.csproj
&amp;lt;Project Sdk=&quot;Microsoft.NET.Sdk&quot;&amp;gt;

  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;TargetFramework&amp;gt;netcoreapp3.1&amp;lt;/TargetFramework&amp;gt;
	&amp;lt;OutputType&amp;gt;exe&amp;lt;/OutputType&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;

  &amp;lt;ItemGroup&amp;gt;
    &amp;lt;PackageReference Include=&quot;Microsoft.Coyote&quot; Version=&quot;1.2.8&quot; /&amp;gt;
    &amp;lt;PackageReference Include=&quot;Microsoft.Coyote.Test&quot; Version=&quot;1.2.8&quot; /&amp;gt;
    &amp;lt;PackageReference Include=&quot;NUnit&quot; Version=&quot;3.13.2&quot; /&amp;gt;
  &amp;lt;/ItemGroup&amp;gt;

&amp;lt;/Project&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Testing with Coyote:&lt;/em&gt;&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;dotnet publish -r win-x64 -c Release -p:PublishSingleFile=true --self-contained true
coyote rewrite .\bin\Release\netcoreapp3.1\win-x64\some_project.dll
coyote test .\bin\Release\netcoreapp3.1\win-x64\some_project.dll -m Foo -i 100
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;By packaging as a single file we get the .dll with all dependencies included/linked. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-m&lt;/code&gt; here is method and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-i&lt;/code&gt; here is iterations.&lt;/p&gt;

&lt;h3 id=&quot;setup---async-server&quot;&gt;Setup - Async Server&lt;/h3&gt;

&lt;p&gt;Unfortunately there are some limitations we must work around to use Coyote:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;forced to mock TCP connect&lt;/li&gt;
  &lt;li&gt;cannot use SemaphoreSlim (part of testing code in Core/Core)&lt;/li&gt;
  &lt;li&gt;unable to Sleep.Thread (hacky but would have been helpful in mocking)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, I boiled down the behavior to a minimum example that hopefully captures most of the interesting logic at play.&lt;/p&gt;

&lt;h3 id=&quot;coyote-to-the-rescue&quot;&gt;Coyote to the Rescue!&lt;/h3&gt;

&lt;p&gt;With an understanding of Coyote and a mocked async server, I sought to repro the ConcurrentDictionary LINQ query race. To do so, I created the following test method:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[Microsoft.Coyote.SystematicTesting.Test]
public static async System.Threading.Tasks.Task Foo()
{
    var expected = 0;

    MockServer server = new MockServer(() =&amp;gt; Interlocked.Increment(ref expected));

    server.Open();

    server.Connect();
    server.Connect();
    server.Connect();

    var countTask = server.CloseAsync();

    server.Connect();
    server.Connect();
    server.Connect();

    var count = await countTask;

    Assert.IsTrue(expected &amp;lt;= count);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Here I connect 3 times before calling close and 3 times after. Since I don’t delete connections from the dictionary (if a connection is finished and we await on it, it’s just some extra CPU cycles), I’d expect the number of handled connections to be less than the number of connections we seek to await on.&lt;/p&gt;

&lt;p&gt;intentionally using faulty logic, I get the following:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;. Testing .\bin\Release\netcoreapp3.1\win-x64\test_test_shit.dll
... Method Foo
... Started the testing task scheduler (process:33436).
... Created &apos;1&apos; testing task (process:33436).
... Task 0 is using &apos;random&apos; strategy (seed:1792470991).
... Telemetry is enabled, see http://aka.ms/coyote-telemetry.
..... Iteration #1
..... Iteration #2
..... Iteration #3
..... Iteration #4
..... Iteration #5
..... Iteration #6
..... Iteration #7
..... Iteration #8
..... Iteration #9
..... Iteration #10
..... Iteration #20
..... Iteration #30
..... Iteration #40
... Task 0 found a bug.
... Emitting task 0 traces:
..... Writing .\bin\Release\netcoreapp3.1\win-x64\Output\test_test_shit.dll\CoyoteOutput\test_test_shit_0_12.txt
..... Writing .\bin\Release\netcoreapp3.1\win-x64\Output\test_test_shit.dll\CoyoteOutput\test_test_shit_0_12.schedule
... Elapsed 2.3007777 sec.
... Testing statistics:
..... Found 1 bug.
... Scheduling statistics:
..... Explored 45 schedules: 45 fair and 0 unfair.
..... Found 2.22% buggy schedules.
..... Number of scheduling points in fair terminating schedules: 6 (min), 20 (avg), 66 (max).
... Elapsed 3.9781934 sec.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Investigating the cause of the bug I see:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;lt;TelemetryLog&amp;gt; Telemetry is enabled, see http://aka.ms/coyote-telemetry.
&amp;lt;TestLog&amp;gt; Running test &apos;Public.Foo&apos;.
&amp;lt;ErrorLog&amp;gt; Unhandled exception. NUnit.Framework.AssertionException:   Expected: True
  But was:  False

   at NUnit.Framework.Assert.ReportFailure(String message)
   at NUnit.Framework.Assert.ReportFailure(ConstraintResult result, String message, Object[] args)
   at NUnit.Framework.Assert.That[TActual](TActual actual, IResolveConstraint expression, String message, Object[] args)
   at NUnit.Framework.Assert.IsTrue(Boolean condition)
   at Public.Foo() in C:\Users\Robert.Durst\Desktop\test_test_shit\UnitTest1.cs:line 148
&amp;lt;StackTrace&amp;gt;    at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.&amp;lt;&amp;gt;c.&amp;lt;.cctor&amp;gt;b__274_0(Object obj)
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task&amp;amp; currentTaskSlot, Thread threadPoolThread)
   at System.Threading.Tasks.Task.ExecuteEntryUnsafe(Thread threadPoolThread)
   at System.Threading.Tasks.Task.ExecuteFromThreadPool(Thread threadPoolThread)
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()


&amp;lt;StrategyLog&amp;gt; Found bug using &apos;random&apos; strategy.
&amp;lt;StrategyLog&amp;gt; Testing statistics:
&amp;lt;StrategyLog&amp;gt; Found 1 bug.
&amp;lt;StrategyLog&amp;gt; Scheduling statistics:
&amp;lt;StrategyLog&amp;gt; Explored 45 schedules: 45 fair and 0 unfair.
&amp;lt;StrategyLog&amp;gt; Found 2.22% buggy schedules.
&amp;lt;StrategyLog&amp;gt; Number of scheduling points in fair terminating schedules: 6 (min), 20 (avg), 66 (max).
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This means that we handled more requests than we were waiting for!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;With the scenario I was interested in repro’d, I now had a corpus of tests to prove my solution against.&lt;/strong&gt;&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;While it was somewhat trivial to map out all the interesting execution sequences for this code, it was very helpful to test my hypothesis and confirm the solution worked against more rigorous testing. Coyote is actually a fairly easy to use tool and I didn’t even use it very rigorously or test out its feature set to the fullest (can open failing tests in the Visual Studio Debugger). One take away for sure is that concurrency code is hard to get correct - it took more hours than I’d like to admit to get a reasonable mock working. If I come across some non-trivial concurrency code with few dependencies that I’d have to mock, I won’t second guess taking Coyote out for a second spin.&lt;/p&gt;
</description>
          <pubDate>2022-01-12T04:19:21-08:00</pubDate>
          <link>https://robdurst.com/coyote-versus-async</link>
          <guid isPermaLink="true">https://robdurst.com/coyote-versus-async</guid>
        </item>
      
    
      
        <item>
          <title>My experience: Why defensive coding matters</title>
          <description>&lt;p&gt;&lt;a href=&quot;https://www.docusign.com/blog/developers/my-experience-why-defensive-coding-matters&quot;&gt;See original post here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This blog post is part of an ongoing series, From the Inside, which highlights the interesting everyday work of performance and infrastructure platform engineers at DocuSign. Every month we sit down with an engineer and ask him/her/they to tell us about an interesting experience: a bug fix, feature shipped, or lesson learned. This week we sat down with software engineer Robert Durst of the Engineering Systems Crew (ESC) team to discuss an interesting performance investigation his team undertook.&lt;/em&gt;&lt;/p&gt;

&lt;h2 id=&quot;background&quot;&gt;Background&lt;/h2&gt;
&lt;p&gt;DocuSign currently uses a hardware load balancing provider and is in the process of exploring a software alternative, HAProxy. As part of this exploration, we introduced a Stream Processing Offloading Agent (SPOA) to the HAProxy stack in order to reach parity with its hardware counterpart. This is essential during an initial mixed-mode topology; as part of the gradual transition we have been running both load balancers simultaneously, sharing traffic between the two.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://www.docusign.com/sites/d8/files/styles/body_max_width/public/2021-08/Blog_FTIDefCodingMatters_fig1.png?itok=emHrF0b3&quot; alt=&quot;HAProxy with SPOA attached&quot; /&gt;
SPOA communicates with HAProxy’s Stream Processing Offloading Engine (SPOE) via the Stream Processing Offloading Protocol (SPOP) over TCP, and a single SPOA server sits sidecar to each HAProxy instance. SPOA intercepts and processes every incoming request, executing logic and dictating actions HAProxy should take, such as blocking a request due to a denylisted source IP address. Instead of opting for an existing open-source implementation, we built our own C# SPOA server that best fits our performance requirements.&lt;/p&gt;

&lt;h2 id=&quot;the-problem&quot;&gt;The problem&lt;/h2&gt;
&lt;p&gt;We ship SPOA as a Docker container on a Linux host. After noticing a spike in CPU usage on a machine running SPOA, we observed the following output from docker-stats:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;CONTAINER ID   NAME              CPU %     PIDS
7d44334e4f7f   spoaserver.8000   200.24%    23
Having 200%+ CPU usage is certainly unexpected and a significant blocker before SPOA can be deployed to production.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;collecting-traces-perfcollect&quot;&gt;Collecting traces: perfcollect&lt;/h2&gt;
&lt;p&gt;DocuSign is still early in its development of running C# services within Linux Docker containers, so we didn’t have an established process to investigate the problem.&lt;/p&gt;

&lt;p&gt;Our initial approach involved installing dotnet-trace on the Docker container, waiting for the problem to reproduce, then analyzing the trace. Unfortunately, we not only observed no obvious offender, we also found an inconsistency between dotnet-trace and docker-stats over the CPU utilization of the container. Since dotnet-trace describes just the dotnet process(es) and docker-stats describes the entire container, something else within the container must have been consuming CPU time.&lt;/p&gt;

&lt;p&gt;On Linux, Docker containers are simply isolated processes, forked from the main process and thus observable from the root operating system. So, what we needed was a tool which captured a trace across all processes and a way to tie Docker container processes and subprocesses together. Enter perfcollect, a Bash script developed and maintained by Microsoft that:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“leverages Linux Tracing Tookit-Next Generation (LTTng) to collect events written from the runtime or any EventSource, as well as perf to collect CPU samples of the target process.”&lt;/em&gt;&lt;/p&gt;

&lt;h2 id=&quot;visualizing-traces-flame-graphs&quot;&gt;Visualizing traces: flame graphs&lt;/h2&gt;
&lt;p&gt;Early on in my time at DocuSign, my manager, Aaron Tyler, introduced me to the blog of Brenden Gregg.  Soon thereafter, I bought Gregg’s Systems Performance book and became increasingly familiar with flame graphs. As per Gregg’s website:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Flame graphs are a visualization of profiled software, allowing the most frequent code-paths to be identified quickly and accurately… [t]he x-axis shows the stack profile population … the y-axis shows stack depth, counting from zero at the bottom. Each rectangle represents a stack frame. The wider a frame is, the more often it was present in the stacks. The top edge shows what is on-CPU, and beneath it is its ancestry. The colors are usually not significant, picked randomly to differentiate frames.”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It turns out Gregg’s FlameGraph generation scripts work perfectly with the output generated from executing the perfcollect script. Thus, we now had a process for collecting and displaying traces:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1. Run perfcollect from root OS       --&amp;gt; perfcollect.zip
2. Unzip (perfcollect.zip)            --&amp;gt; out.perf
3. Stackcollapse (out.perf)           --&amp;gt; out.folded
4. Generate flame graph (out.folded)  --&amp;gt; flamegraph
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; we run a slightly modified perfcollect script that gathers the PID of Docker processes to generate the .map files required for Docker process symbol resolution when generating flame graphs on a separate machine.&lt;/p&gt;

&lt;h2 id=&quot;analyzing-traces-an-unexpected-culprit&quot;&gt;Analyzing traces: an unexpected culprit&lt;/h2&gt;
&lt;p&gt;With the tooling in place, it was time to find the root cause. Here is the flame graph for the offending SPOA machine, zoomed in on the dotnet process within the Docker container:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://www.docusign.com/sites/d8/files/styles/body_max_width/public/2021-08/Blog_FTIDefCodingMatters_fig2.jpg?itok=VLzbttuD&quot; alt=&quot;Flame graph of processes on the SPOA server&quot; /&gt;
Reviewing the flame graph, it became clear that we spend a TON of time in DecodeString. This was certainly unexpected! Parsing through the source code, Aaron discovered that within the frame parsing code, we continuously read bytes until we read as many as explicitly defined by the incoming frame.&lt;/p&gt;

&lt;p&gt;From the SPOP spec:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;String := &amp;lt;LENGTH&amp;gt;&amp;lt;STRING_VALUE&amp;gt;
Thus, without any sort of defensive coding, we entered an infinite loop triggered by data that adhered to the SPOP protocol, yet violated our assumption of sane input: specifying a string length longer than the string data itself.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;With a probable root cause identified, it was time to identify the source of the buggy frames. We looked at our internal monitoring GUI, Kazmon, for help.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://www.docusign.com/sites/d8/files/styles/body_max_width/public/2021-08/Blog_FTIDefCodingMatters_fig3.png?itok=EcVrXLzc&quot; alt=&quot;Kazmon process trace showing increasing server load&quot; /&gt;
Every time we received a 128 frame type (UNEXPECTED FRAME, i.e. garbage) we saw another CPU get tied up. Furthermore, this happened at almost the exact same time every week.&lt;/p&gt;

&lt;p&gt;To further debug and test our infinite loop theory, I did the following:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1. logged IP of incoming messages, and
2. added an assertion that the expected string length should be &amp;lt;= remaining frame buffer length, allowing an early exit in case of receipt of the nonsense data described above.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Not only did we see the assertion throw, meaning we hit this code path, we no longer saw the CPU spikes:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://www.docusign.com/sites/d8/files/styles/body_max_width/public/2021-08/Blog_FTIDefCodingMatters_fig4.png?itok=iefpiE0T&quot; alt=&quot;Kazmon process trace following deploy of fix&quot; /&gt;
And we caught the offending sender red handed, identified by its IP address.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://www.docusign.com/sites/d8/files/styles/body_max_width/public/2021-08/Blog_FTIDefCodingMatters_fig5_0.png?itok=Beyv_tJw&quot; alt=&quot;Kazmon process showing the offending process fixed&quot; /&gt;
It turns out our vulnerability scanner was sending garbage to SPOA and we’d neglected to harden our implementation against legal, yet impractical message frames.&lt;/p&gt;

&lt;h2 id=&quot;takeaways&quot;&gt;Takeaways&lt;/h2&gt;
&lt;p&gt;It turns out dotnet-trace may have been the right tool for this investigation, the buggy code was within the dotnet process. However the ability to generate a flame graph from perfcollect’s output proved invaluable. From this investigation, I developed a rudimentary understanding of Docker container internals and also established a process for future performance investigations. Furthermore, I came away having learned the following lessons:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Defensive coding is essential to protect against unexpected data, especially data that still adheres to the protocol.&lt;/li&gt;
  &lt;li&gt;Flame graphs are an extremely helpful tool during performance investigations, offering an interactive, single-page visual that can be used to identify anomalies quickly.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you are interested in this type of work or distributed systems performance in general, check out the open role listings within my organization on the DocuSign careers page. We’re hiring!!&lt;/p&gt;
</description>
          <pubDate>2021-08-11T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/why-defensive-coding-matters</link>
          <guid isPermaLink="true">https://robdurst.com/why-defensive-coding-matters</guid>
        </item>
      
    
      
        <item>
          <title>Two Flavors of Pipes</title>
          <description>&lt;p&gt;On June 1, I started my journey at DocuSign. While starting remote has been a bit weird, I have had an incredible experience so far, shipped some code, learned some things, and even made a fool of myself a couple times. I am extremely grateful that I am able to find employment in these crazy times, especially meaningful and interesting employment. There is lots of C# at DocuSign, so I have been migrating away from C++ &amp;amp; Linux focused development into new, uncharted waters. A side effect of this is moving from Unix –&amp;gt; Powershell for some of the automated scripting. Just before I started at DocuSign, I gained a newfound appreciation for Unix (and Unix pipes) after reading Brian Kernighan’s latest book &lt;a href=&quot;https://www.cs.princeton.edu/~bwk/&quot;&gt;Unix: A History and Memoir&lt;/a&gt;. Never used pipes? Well, today is your lucky day! This post will show you how to use pipes in Unix and then how a similar effect can be created in powershell.&lt;/p&gt;

&lt;h2 id=&quot;pipes&quot;&gt;Pipes&lt;/h2&gt;

&lt;p align=&quot;center&quot;&gt;
  &lt;img src=&quot;https://media.giphy.com/media/9PzaDXcbo9a45a5Y22/giphy.gif&quot; /&gt;
&lt;/p&gt;

&lt;p&gt;Ah yes, so what is a pipe? This is a good place to start. Pipes, or more formally a pipeline, is basically a mechanism for chaining multiple processes together by feeding the output of one into the input of the next. A slightly more computer-sciency way of saying this is &lt;em&gt;“a set of processes chained together by their standard streams, so that the output text of each process (stdout) is passed directly as input (stdin) to the next one”&lt;/em&gt; - (&lt;a href=&quot;https://en.wikipedia.org/wiki/Pipeline_(Unix)&quot;&gt;Wikipedia&lt;/a&gt;). So yes, a pipeline is probably almost exactly what you thought it was.&lt;/p&gt;

&lt;p align=&quot;center&quot;&gt;
  &lt;img src=&quot;https://upload.wikimedia.org/wikipedia/commons/thumb/b/b9/Douglas_McIlroy.jpeg/220px-Douglas_McIlroy.jpeg&quot; /&gt;&lt;br /&gt;
  Douglas McIlroy
&lt;/p&gt;

&lt;p&gt;This concept that was first brought into the world of computing by &lt;a href=&quot;https://en.wikipedia.org/wiki/Douglas_McIlroy&quot;&gt;Douglas McIlroy&lt;/a&gt; at Bell Labs (and subsequently implemented into Unix by the mythical &lt;a href=&quot;https://en.wikipedia.org/wiki/Ken_Thompson&quot;&gt;Ken Thompson&lt;/a&gt;. Here is a fantastic quote about the invention of the pipe: &lt;em&gt;“His ideas were implemented in 1973 when (“in one feverish night”, wrote McIlroy) Ken Thompson added the pipe() system call and pipes to the shell and several utilities in Version 3 Unix. “The next day”, McIlroy continued, “saw an unforgettable orgy of one-liners as everybody joined in the excitement of plumbing.””&lt;/em&gt; (&lt;a href=&quot;https://en.wikipedia.org/wiki/Pipeline_(Unix)&quot;&gt;Wikipedia&lt;/a&gt;).&lt;/p&gt;

&lt;h2 id=&quot;pipes-in-unix&quot;&gt;Pipes in Unix&lt;/h2&gt;

&lt;p&gt;Ok, time for an example. For anyone running a version of Unix, MacOS, Ubuntu, any Linux derivative, etc. this one is for you (feel free to open up terminal and follow along - I ran each line of code as I wrote this so the examples should work). I will be creating an example very similar to Brian Kernighan’s favorite example - we will be determining the misspelled words in a text file.&lt;/p&gt;

&lt;p&gt;For starters, we have a textfile (text.txt):&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;I like to write commands using pipes and pipes are what I like to wriite
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;First, we want to read from the file. We can do this uisng &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cat&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; cat text.txt
I like to write commands using pipes and pipes are what I like to write
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then we want to lowercase all the words since our dictionary only has lowercase letters. To do this on the text from our text file, we use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;|&lt;/code&gt; to pipe the output from our first command to the input of our second command:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; cat text.txt | sed -e &apos;s/.*/\L&amp;amp;/g&apos;
i like to write commands using pipes and pipes are what i like to write
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt; command takes a regular expression, matches every occurance of this expression, and replaces these matches with the second expression. In this case our find expression is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;.*&lt;/code&gt; which says to match on everything and our replace expression is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;L&amp;amp;&lt;/code&gt; which turns all ascii characters to lowercase.&lt;/p&gt;

&lt;p&gt;Now, we want to put every word on its own line. Using the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;sed&lt;/code&gt; command again, we match against whitespace &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\s&lt;/code&gt; and we replace with a newline &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\n&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; cat text.txt | sed -e &apos;s/.*/\L&amp;amp;/g&apos; | sed -e &apos;s/\s/\n/g&apos;
i
like
to
write
commands
using
pipes
and
pipes
are
what
i
like
to
write
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The next step is to alphabetize our list and then remove duplicates. Removing duplicates allows us to perform fewer checks against our dictionary in the next step:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; cat text.txt | sed -e &apos;s/.*/\L&amp;amp;/g&apos; | sed -e &apos;s/\s/\n/g&apos; | sort | uniq
and
are
commands
i
like
pipes
to
using
what
wriite
write
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Finally, it is time to check for misspelled words. To do this, we want to check to see if each word is in the dictionary, if it is not, it must be misspelled. Assuming the computer has a textfile called dictionary, we will use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep&lt;/code&gt; command to do just that. The grep command is a unix command for searching for lines of text that match a certain pattern (regex again!!). By using this with some flags, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;v&lt;/code&gt; which returns the inversion, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt; a path to a file to match against, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x&lt;/code&gt; matching only against whole lines, we get the desired effect:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; cat text.txt | sed -e &apos;s/.*/\L&amp;amp;/g&apos; | sed -e &apos;s/\s/\n/g&apos; | sort | uniq | grep -xvf dictionary
wriite
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Yep, so next time you’re in a Zoom party with friends on a Friday night, share your screen and impress them with this.&lt;/p&gt;

&lt;h2 id=&quot;pipes-in-powershell&quot;&gt;Pipes in Powershell&lt;/h2&gt;

&lt;p&gt;Ok, so you run Windows but still want to impress your friends. How does the above translate? Are there pipes in the powershell? Questions, questions, questions.&lt;/p&gt;

&lt;p&gt;It turns out there are pipes, and have been for quite a while. However, they come with one small caveat… &lt;strong&gt;when piping in the powershell, output is formatted as objects, not just unformatted streams of text&lt;/strong&gt;. This actually turns out to be quite useful! Let’s dive in and see how we can recreate the above.&lt;/p&gt;

&lt;p&gt;To start with, we could use cat, but that seems like cheating… let’s use a powershell cmdlet! &lt;a href=&quot;https://docs.microsoft.com/en-us/powershell/scripting/developer/cmdlet/cmdlet-overview?view=powershell-7#:~:text=A%20cmdlet%20is%20a%20lightweight,them%20programmatically%20through%20PowerShell%20APIs.&quot;&gt;Cmdlets&lt;/a&gt; are powershell methods. Many useful ones are included with Windows and you can of course write your own as well.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; Get-Content text.txt
I like to write commands using pipes and pipes are what I like to wriite
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ok, so far so good. Now let’s expose what I meant by &lt;em&gt;passing objects instead of unstructured text&lt;/em&gt;. When we use the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Get-Content&lt;/code&gt; command here, we get a string. We can access this string in the next pipe via the special &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$_&lt;/code&gt; variable (variables in powershell are denoted by the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;$&lt;/code&gt;). Thus, we can actually combine the splitting of lines by whitespace and the lowercase conversion in one go (in a much friendlier, readable way… no regex!):&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; Get-Content text.txt | % {$_.Split(&quot; &quot;).ToLower()}
i
like
to
write
commands
using
pipes
and
pipes
are
what
i
like
to
wriite
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now it is time to sort and remove duplicates. Windows ships some similar commands to what we used in Unix: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Sort&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Get-Unique&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;  Get-Content text.txt | % {$_.Split(&quot; &quot;).ToLower()} | Sort | Get-Unique
and
are
commands
i
like
pipes
to
using
what
wriite
write
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Wow - this is almost a 1:1 translation so far and we even avoided regex! Ok, now it gets a little messy. Unlike &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;grep&lt;/code&gt; above, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Compare-Object&lt;/code&gt; does not show one-sided differences. As you may imagine, this is rather unfortunate when comparing against a large dictionary; it returns each difference with a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;SideIndicator&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;&amp;lt;=&lt;/code&gt; meaning only in left and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;=&amp;gt;&lt;/code&gt; meaning only in right. In our case we want the words which are unique to the input so we filter &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;=&amp;gt;&lt;/code&gt;:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;  Get-Content text.txt | % {$_.Split(&quot; &quot;).ToLower()} | Sort | Get-Unique | Compare-Object (Get-Content) dictionary) | Where-Object {$_.SideIndictor -eq &quot;=&amp;gt;}
InputObject SideIndicator
----------- -------------
wriite       =&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Ah, so we have what we want, but now it is in this wonky table. IMO, this is an unfortunate side-effect of powershell’s object approach. However, it is not that hard to transform the output into the desired format:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt; Get-Content text.txt | % {$_.Split(&quot; &quot;).ToLower()} | Sort | Get-Unique | Compare-Object (Get-Content) dictionary) | Where-Object {$_.SideIndictor -eq &quot;=&amp;gt;} | Select-Object &quot;InputObject&quot; | Format-Table -HideTableHeaders
wriite
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;My apologies, I realize that this one-liner is now flowing into the abyss off the right side of the code box. That being said, I actually believe this one-liner is much more readable than the unix one, albeit that takes away some of the fantastical magic that comes with it when you try to impress your friends.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;So, besides this being an interesting exercise, what’s the point? My point is that after two summers deep in the world of cryptocurrency in San Francisco, I was indoctrinated into a certain mindset. This mindset said things like:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;closed source evil&lt;/li&gt;
  &lt;li&gt;Microsoft bad, Linux good&lt;/li&gt;
  &lt;li&gt;do you use Rust? Why don’t you use Rust?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is of course a minor exaggeration. That being said, I am learning (or rather relearning if you talk to my 11th grade English professor) it is almost always best to take a nuanced approach - by considering the tradeoffs of a decision and both/all points of view, you end up with a much stronger, more comprehensive final outcome. In software this means using Linux when appropriate and Windows when it is not. In astrophotography, it means taking some wide-angle shots and some close-ups. In collegiate track and field 400m training, it means 1000m workouts and 50m speed work (yes 1k’s are no fun for short sprinters, but hey, I cut 4 sec off my 400 pr in one season, thanks &lt;a href=&quot;https://www.gocolbymules.com/sports/mtrack/coaches/Dave_Cusano?view=bio&quot;&gt;Dave&lt;/a&gt;). So, since I’ll probably be living in both Windows and Unix systems for the next X years of my software engineering career, it’ll pay off to understand both.&lt;/p&gt;
</description>
          <pubDate>2020-06-27T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/Powershell-and-Unix</link>
          <guid isPermaLink="true">https://robdurst.com/Powershell-and-Unix</guid>
        </item>
      
    
      
        <item>
          <title>Brush off the Bitwise</title>
          <description>&lt;p&gt;A singular bit is the most atomic form of information. Yes, no. Is, isn’t. True, false. 1, 0; a singular bit may be interpret in many different ways depending on context. Consider now a collection of bits: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0110&lt;/code&gt;. Collections of bits are often interpreted as binary numbers. The numbers you and I use everyday are base 10, or decimals. Binary numbers are base 2, calculated right-to-left, where we increment an exponential factor of 2, starting with 0, multiplying this by the 1 or 0 bit and then summing up the results. I.e for &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;0110&lt;/code&gt;, we start on the right, calculating &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2^0 * 0&lt;/code&gt; and move to the left:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2^0 * 0 + 2^1 *1 + 2^2 *1 + 2^3 + 0 = 4&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;These bits may be manipulated by operations, known as &lt;em&gt;bitwise operations&lt;/em&gt;.&lt;/p&gt;

&lt;h2 id=&quot;bitwise-operations&quot;&gt;Bitwise Operations&lt;/h2&gt;

&lt;p&gt;The following are six, fundamental bitwise operators. I’ll accompany the definitions with some python code which may be executed and experimented to better grasp the concepts. Python is nice because you can just open up an interpreter.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NOT:&lt;/strong&gt; not is a unary operator, also known as the compliment, which &lt;em&gt;flips a bit&lt;/em&gt;, i.e. 0 –&amp;gt; 1 and 1 –&amp;gt; 0.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; ~1
-2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now this may seem odd, and did stump me for a second. However, it makes sense when you consider how &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt; is represented here. In python, 1 is an integer, specifically a member of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Int&lt;/code&gt; class. This class has a useful &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bin&lt;/code&gt; method which returns the binary representation of the number.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; bin(1)
&apos;0b1&apos;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This makes sense. However, consider the following:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; bin(-2)
&apos;-0b10&apos;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Negative two is represented in &lt;a href=&quot;https://en.wikipedia.org/wiki/Two%27s_complement&quot;&gt;two compliment&lt;/a&gt; form. It turns out that, in order to keep things symmetric, all numbers are interpreted in two’s compliment. Therefore we get the following:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; ~-2
1
&amp;gt;&amp;gt;&amp;gt; ~1
-2
&amp;gt;&amp;gt;&amp;gt; 0
-1
&amp;gt;&amp;gt;&amp;gt; ~-1
0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which makes sense if you investigate the binary representations:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; bin(0)
&apos;0b0&apos;
&amp;gt;&amp;gt;&amp;gt;bin(-1)
&apos;-0b1&apos;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;TLDR: not just flips the bits, however it may be unintuitive at first when used in your favorite higher level programming language depending on how the numerical value is represented. For a little more wtf fun, try &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;~False&lt;/code&gt; in python.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AND:&lt;/strong&gt; given two bits, returns 1 only if both bits are 1. AND, along with the rest of the bitwise operators, are usually performed on bit patterns, or collections of bits.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; 1 &amp;amp; 1
1
&amp;gt;&amp;gt;&amp;gt; 1 &amp;amp; 0
0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;OR:&lt;/strong&gt; given two bits, returns 1 if either bit is 1.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; 1 | 1
1
&amp;gt;&amp;gt;&amp;gt; 0 | 1
1
&amp;gt;&amp;gt;&amp;gt; 0 | 0
0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;XOR:&lt;/strong&gt; given two bits, returns 1 only if 1 of the two bits is 1.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; 1 ^ 1
0
&amp;gt;&amp;gt;&amp;gt; 1 ^ 0
1
&amp;gt;&amp;gt;&amp;gt; 0 ^ 1
1
&amp;gt;&amp;gt;&amp;gt; 0 ^ 0
1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Shift Left:&lt;/strong&gt; given a collection of bits, slides all the bits left, padding the back with zeros. Thus, for the number 3 (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;11&lt;/code&gt;) we get 6 (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;110&lt;/code&gt;). Left shift is the equivalent of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x * 2^n&lt;/code&gt; for some &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x&lt;/code&gt; shifted &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; bits, i.e. for 3 shifted 1 to the left we get &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3 * 2^1&lt;/code&gt; = 6.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; 3 &amp;lt;&amp;lt; 1
6
&amp;gt;&amp;gt;&amp;gt; 10 &amp;lt;&amp;lt; 3
80
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Shift Right:&lt;/strong&gt; given a collection of bits, slides all the bits right, padding the front with zeros. Thus for the number 3 (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;11&lt;/code&gt;) we get 1 (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt;). right shift is the equivalent of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x / 2^n&lt;/code&gt; for some &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;x&lt;/code&gt; shifted &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; bits, i.e. for 3 shifted 1 to the right we get &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;3 / 2^1&lt;/code&gt; = 1. Notice how we round down here, thus the formula is only an approximate.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; 3 &amp;gt;&amp;gt; 1
1
&amp;gt;&amp;gt;&amp;gt; 10 &amp;gt;&amp;gt; 3
1
&amp;gt;&amp;gt; 4 &amp;gt;&amp;gt; 1
2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;applications-of-bitwise-operations&quot;&gt;Applications of Bitwise Operations&lt;/h2&gt;

&lt;p&gt;It turns out we can combine these operators in interesting and useful ways. In computers, we cannot access bits directly, instead we must access them in collections of 8, as a &lt;strong&gt;byte&lt;/strong&gt;. Therefore, if we want to represent data as a boolean True or False value, we end up wasting 7 bits. However, with bitwise operators, we can pack eight booleans into a byte and reclaim this wasted space. Consider the following bit-packed boolean collection: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;10101101&lt;/code&gt;. Let’s pretend the 4th from the left, i.e. the 3rd index in normal cs terms, indicates the current state of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shelter-in-place&lt;/code&gt; for your hometown. How can we access this value?&lt;/p&gt;

&lt;p&gt;The basic intuition here is we want to determine if the bit we are interested in is &lt;em&gt;“on”&lt;/em&gt;. To do this we can use &lt;strong&gt;AND&lt;/strong&gt; with the 4th from left bit as the only &lt;em&gt;“on”&lt;/em&gt; bit as the comparison. Then we shift that value 4 places to the right so that it is either a 1 or a 0. See here:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; 173 &amp;amp; 16 &amp;gt;&amp;gt; 4
0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;For a more complex example, let’s say Governor Newsom decides to only lift the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shelter-in-place&lt;/code&gt; restrictions if his neighbors are also lifted. It turns out we can do the check and also flip California’s bit (4th from left) all in one go.&lt;/p&gt;

&lt;p&gt;First check if the left neighbor is lifted:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; 173 &amp;amp; 32 &amp;gt;&amp;gt; 5
1 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Then check if the right neighbor is lifted:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; 173 &amp;amp; 8 &amp;gt;&amp;gt; 3
1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now combine this and shift to the 4th index, representing whether California should lift the restrictions:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; ((173 &amp;amp; 32 &amp;gt;&amp;gt; 5) &amp;amp; (173 &amp;amp; 8 &amp;gt;&amp;gt; 3)) &amp;lt;&amp;lt; 4
16
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now toggle California’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;shelter-in-place&lt;/code&gt; to on (technically this would toggle it off if it was already on).&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&amp;gt;&amp;gt;&amp;gt; 173 ^ (((173 &amp;amp; 32 &amp;gt;&amp;gt; 5) &amp;amp; (173 &amp;amp; 8 &amp;gt;&amp;gt; 3)) &amp;lt;&amp;lt; 4)
189
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It turns out querying and turning on/off certain bits is super useful. This is called &lt;a href=&quot;https://en.wikipedia.org/wiki/Mask_(computing)&quot;&gt;masking&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;conways-game-of-life&quot;&gt;Conway’s Game of Life&lt;/h2&gt;

&lt;p&gt;Conway’s Game of Life, a simulation of cellular automata, is a classic and also a project in Colby College’s Data Structures and Algorithms class. However, complex data structures are a bit overkill for this simple simulation. In fact, if we use bitwise operators, we can use a &lt;em&gt;bit-packed array&lt;/em&gt; as our data structure. Using an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unsigned long&lt;/code&gt;, or a 64-bit integer, I did just that.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://imgur.com/xPsxfSj.png&quot; alt=&quot;Game of Life&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You can check out &lt;a href=&quot;https://github.com/robertDurst/GameOfLife&quot;&gt;the source code here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://stackoverflow.com/questions/791328/how-does-the-bitwise-complement-operator-tilde-work&quot;&gt;Compliment Confusion&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Bitwise_operation&quot;&gt;Bitwise Operations&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Boolean_algebra&quot;&gt;Boolean Algebra&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://bitstorm.org/gameoflife/&quot;&gt;Conway’s Game of Life&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
          <pubDate>2020-05-19T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/Bitwise</link>
          <guid isPermaLink="true">https://robdurst.com/Bitwise</guid>
        </item>
      
    
      
        <item>
          <title>A Semester of Coding Music</title>
          <description>&lt;h1 id=&quot;a-semester-of-coding-music&quot;&gt;A Semester of Coding Music&lt;/h1&gt;
&lt;p&gt;&lt;img src=&quot;https://camo.githubusercontent.com/49ea68b032c773999c5e3fffb414d00df2f3d692/68747470733a2f2f6d656469612e67697068792e636f6d2f6d656469612f3236756635666438417a73656a36776a432f67697068792e676966&quot; alt=&quot;&quot; /&gt;
There’s a quote by Jim Rohn that goes &lt;em&gt;“you are the average of the five people you spend the most time with.”&lt;/em&gt; Considering I spent the last two summers deep in Silicon Valley’s blockchain scene, surrounded by people immersed in cutting edge tech always planning for the next Burning Man, it was nearly inevitable that I enroll in a class called &lt;em&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Algorave&quot;&gt;algorave&lt;/a&gt;&lt;/em&gt; (offered for the first time this year at Colby College). This course was Silicon Valley in a nutshell: experimental electronic music via pure, functional programming (Haskell). While I’ve never dabbled in creating music or designing visuals my final performance this afternoon ended up pretty ok.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=Uv6cllge8sk&amp;amp;feature=youtu.be&quot;&gt;Here is a link to my performance&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;what-is-an-algorave&quot;&gt;What is an Algorave?&lt;/h2&gt;

&lt;p&gt;An algorave, algorithm plus rave, is:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;an event where people dance to music generated from algorithms, often  using live coding techniques. Algoraves can include a range of styles,  including a complex form of minimal techno, and the movement has been described as a meeting point of hacker philosophy, geek culture, and clubbing. - Wikipedia&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There are many different platforms and languages allowing for a variety of techniques for music creation. In my class, we focused on using &lt;a href=&quot;https://tidalcycles.org/index.php/Welcome&quot;&gt;TidalCycles&lt;/a&gt;, a Haskell DSL that allows users (even the musically challenged) to create cool patterns via the &lt;a href=&quot;https://github.com/musikinformatik/SuperDirt&quot;&gt;SuperDirt&lt;/a&gt; synth.&lt;/p&gt;

&lt;h3 id=&quot;the-tldr-of-tidalcycles&quot;&gt;The TLDR of TidalCycles&lt;/h3&gt;

&lt;p&gt;Below is a sampling of what you can do with TidalCycles, a.k.a. Tidal. In general, Tidal has four components:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;samples&lt;/li&gt;
  &lt;li&gt;functions&lt;/li&gt;
  &lt;li&gt;effects&lt;/li&gt;
  &lt;li&gt;transitions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To play a simple bass drum &lt;strong&gt;sample&lt;/strong&gt;, you would type: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d1 $ s &quot;bd&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This takes the sample &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bd&lt;/code&gt; and plays it once every cycle. I don’t formally know music, but if you do, you can &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setcps&lt;/code&gt;, set the cycles per second, to match what you may expect in terms of beats per second.&lt;/p&gt;

&lt;p&gt;To reverse some samples every 2 cycles, we can use the every &lt;strong&gt;function&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d1 $ every 2 rev $ s &quot;bd bd hh&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For this part of Tidal, Haskell works wonderfully, as you compose functions in a typical Haskell style. Consider the following which  reverses, then slows, then increments the selection of the first sample every 2 cycles:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d1 $ every 2 ((|+ n &quot;2&quot;) . slow 2 . rev) $ s &quot;[bd bd hh]&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;note:&lt;/strong&gt; samples like bd or hh often have multiple varieties which can be specified by &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;bd:2&lt;/code&gt; or &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;s &quot;bd&quot; # n &quot;2&quot;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To make things more interesting, we can apply &lt;strong&gt;effects&lt;/strong&gt; to samples. The following will randomly pan the sample:&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;d1 $ s &quot;bd&quot; # pan rand&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Finally, let’s assume you are playing a set and want to have a spiffy fade in of a nice percussion kick. With &lt;strong&gt;transitions&lt;/strong&gt; you can do just that. The following fades in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;reverbkick&lt;/code&gt; sample gradually over the course of 10 cycles onto synth input 1.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;xFadeIn 1 10 $ s &quot;reverbkick&quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;There is certainly a lot more you can do with Tidal… the above is just a small taste :) To learn more &lt;a href=&quot;https://tidalcycles.org/&quot;&gt;checkout the website and the docs&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;my-takeaways&quot;&gt;My Takeaways&lt;/h2&gt;

&lt;p&gt;As a computer science major and coding enthusiast, I came into this class from a coding perspective: I viewed this class as coding music, not creating music via code. However, coding in this &lt;em&gt;unconventional&lt;/em&gt; way taught me a few unexpected lessons.&lt;/p&gt;

&lt;h2 id=&quot;lesson-1-code-is-merely-a-tool&quot;&gt;Lesson 1: Code is Merely a Tool&lt;/h2&gt;

&lt;p&gt;During the 2017-2018 school year, I took a gap year where I spent the majority of my time in San Francisco. The first part of this year was spent at a coding bootcamp, where I learned fullstack JavaScript (MERN stack). From there I got the programming language bug and very quickly doubled the languages I could write basic projects in from three to six. However, at this time my focus was on learning languages for the sake of learning languages. It turns out this approach was largely not beneficial in the long run… even though I read an entire book on Rust and listened to the wonderful &lt;a href=&quot;https://newrustacean.com/&quot;&gt;New Rustacean Podcast&lt;/a&gt;, if you held a gun to my head right now and said &lt;em&gt;“write me a proper linked list in Rust”&lt;/em&gt; I would surely fail.&lt;/p&gt;

&lt;p&gt;Skip ahead a couple years. I am now learning Haskell for the second (third?) time, but this time in the context of a DSL for live coding music. I am focused much more on composing functions to create cool sounds than all the fun and fancy lingo like monads, functors, etc. One weekend I decide to try to tackle &lt;a href=&quot;https://www.cs.nott.ac.uk/~pszgmh/monparsing.pdf&quot;&gt;a paper&lt;/a&gt; that has been confusing me for a while (the last two times I tried to learn Haskell I could not make it through). This time it was easy - it all clicked - it all made sense. The next weekend I even implemented a parser in Haskell based on the principles from this paper. It ended up being 78% smaller than the equivalent C++ parser I wrote last year and certainly more than 78% easier to reason about.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://imgur.com/XrgJmZ2.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;lesson-2-build-for-yourself-first&quot;&gt;Lesson 2: Build For Yourself First&lt;/h2&gt;

&lt;p&gt;One of my personal epiphanies, realized during the course of this quarantine is I have succumbed to what I’m calling &lt;em&gt;“toy project syndrome.”&lt;/em&gt; I am not sure if this was inspired by religiously following programming Reddit + HackerNews or if it was an emulation of the blockchain hype train. Either way, it goes something like this:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;find a cool new topic in computer science&lt;/li&gt;
  &lt;li&gt;learn just enough to build a toy &lt;strong&gt;X&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;write a blog post about toy &lt;strong&gt;X&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;reap the gratification of telling the world about toy &lt;strong&gt;X&lt;/strong&gt;&lt;/li&gt;
  &lt;li&gt;go back to 1, neglecting the more intellectually challenging and thought provoking journey of creating a real world &lt;strong&gt;X&lt;/strong&gt; or contributing to an established open source &lt;strong&gt;X&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While the intentions of this syndrome come from a genuine desire to maximize breadth of knowledge, at some point, there is a need to progress beyond the beginner stages of some topic.&lt;/p&gt;

&lt;p&gt;Thus, for this class, when I wanted to dive into visual creation and needed a tool for easier, stateful handlers, I silently dived head first into the code, &lt;strong&gt;creating something that was useful first.&lt;/strong&gt; Besides ensuring nothing out there like this already existed, I did not tell the world about my idea before having written any code; only once I had a product that I used myself did I share.&lt;/p&gt;

&lt;p&gt;This solves two things:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;creating something you actually use means it won’t just be thrown out at the end of the process&lt;/li&gt;
  &lt;li&gt;building isn’t done for the gratification from upvotes, but the joy of actually creating something that solves your own problems&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, while yes, this is me promoting what I built, and yes I did learn a heck of a lot more building my own programming language than this simple JavaScript API wrapper, my language is dead and this library is not.&lt;/p&gt;

&lt;h3 id=&quot;hydrafriend&quot;&gt;HydraFriend&lt;/h3&gt;

&lt;p&gt;Ok, a little bit of self promotion. I can not resist. &lt;a href=&quot;https://github.com/ojack/hydra&quot;&gt;Hydra&lt;/a&gt; is a wonderful tool built by &lt;a href=&quot;https://github.com/ojack&quot;&gt;Olivia Jack&lt;/a&gt; that allows for live coding of visuals. Often times, &lt;a href=&quot;https://www.youtube.com/watch?v=tY8BmTnlUA0&amp;amp;feature=youtu.be&quot;&gt;people will pair up&lt;/a&gt; where one person codes music and the other visuals - it turns out it is a bit hard to do this solo. Seeing that it is possible to hook-up SuperCollider to Hydra and capture music events, I figured it would be helpful to have structures for maintaining state in order to create more complex visual patterns. To better understand why this is helpful, consider the following &lt;em&gt;vanilla&lt;/em&gt; Hydra (&lt;a href=&quot;https://github.com/ojack/hydra-examples/blob/master/8-osc-tidal-supercollider.js&quot;&gt;taken from examples&lt;/a&gt;):&lt;/p&gt;
&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;// state&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;freq&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;numSides&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// &quot;event handler&quot;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;msg&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;on&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;/play2&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
	&lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;tidal&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;parseTidal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tidal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;sd&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
		&lt;span class=&quot;nx&quot;&gt;freq&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;freq&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;10&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;tidal&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;s&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;===&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;bd&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;){&lt;/span&gt;
		&lt;span class=&quot;nx&quot;&gt;numSides&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;numSides&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// visual&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;osc&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;freq&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;0.8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;kaleid&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;numSides&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
	&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;out&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;You can only imagine how complex this may get if we wanted to build &lt;em&gt;an entire audio-reactive visual&lt;/em&gt; for more than two samples. What if we wanted the handler to also maintain more complicated state, like only triggering every 5th message, or cycling from 0 to 360? For this, we can define &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Handlers&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Shape Generators&lt;/code&gt;. The following is an example from the &lt;a href=&quot;https://github.com/robertDurst/HydraFriend&quot;&gt;HydraFriend&lt;/a&gt; wrapper I have started hacking together.&lt;/p&gt;
&lt;div class=&quot;language-js highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Handler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;HydraFriend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Shape&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;require&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;hydrafriend&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// define a new octagon shape&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;octagon&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Shape&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;sides&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;8&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// handle bd by inverting every 5&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;handle_bd&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;Handler&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;bd&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;octagon&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;invert&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;());&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;handle_bd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;every&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;// register all our handlers&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;hf&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;HydraFriend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;hf&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;register&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;handle_bd&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;While HydraFriend is not yet complete, it is already much easier to create a solo visual + audio set when reasoning about and preparing visuals in this manner.&lt;/p&gt;

&lt;h2 id=&quot;lesson-3-functional-programming-is-intuitive&quot;&gt;Lesson 3: Functional Programming is Intuitive&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://cdn-images-1.medium.com/max/1024/1*nCX6bsSNUF_v2hFKgnaQIA.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Over the past few years, I have been around numerous people in situations where they were first learning to code: from a coding bootcamp (JavaScript), to tutoring CS100 classes (Python), to this music class (Haskell). If I were to ask you, “hey, which of the following will probably lead to the most frustration?” you would almost certainly say &lt;em&gt;Haskell&lt;/em&gt;. However, in my experience, that is certainly not the case. My musically inclined peers, whom had never coded before and were self-proclaimed &lt;em&gt;not computer people&lt;/em&gt;, were able to easily create incredible music with Tidal, composing functions in ways that many graduating CS Majors would never even imagine. It was a truly incredible experience… one I continue to try to convey to the Colby CS department in hopes of the creation of a formal functional programming class.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Suffice it to say MU213 was an incredible class! I’d like to publicly thank my professor &lt;a href=&quot;http://www.colby.edu/directory/profile/ryan.maguire/&quot;&gt;Ryan Maguire&lt;/a&gt; for introducing us to this cutting edge field. Whether you’re a student at a large university, a small liberal arts school, or a graduated, life long learner, I’d totally recommend an &lt;em&gt;unconventional&lt;/em&gt; coding experience. You may be surprised at what you learn!&lt;/p&gt;

</description>
          <pubDate>2020-05-08T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/Algorave</link>
          <guid isPermaLink="true">https://robdurst.com/Algorave</guid>
        </item>
      
    
      
        <item>
          <title>To Categories From First Principles</title>
          <description>&lt;p&gt;Welcome! Somehow you have managed to find the first post in my &lt;em&gt;Category Theory Series&lt;/em&gt;. Embarrassingly, my motivation for diving into Category Theory partially comes from a desire to understand the humor &lt;a href=&quot;https://www.youtube.com/watch?v=ADqLBc1vFwI&quot;&gt;in this video&lt;/a&gt;. Yet from the most innocent of beginnings, here I am, here you are. What’s this nonsense all about?&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://media.giphy.com/media/SSirUu2TrV65ymCi4J/giphy.gif&quot; /&gt;&lt;/div&gt;

&lt;h2 id=&quot;some-people-smarter-than-me-say-things-about-category-theory&quot;&gt;Some People Smarter than Me Say Things About Category Theory&lt;/h2&gt;

&lt;p&gt;So why is this stuff interesting? Since I have no clout here, I am just YAPB (yet-another-programming-blog) I will &lt;a href=&quot;https://www.youtube.com/watch?v=SpgVlTJibc0&quot;&gt;phone a friend&lt;/a&gt;, or well, just look for Category Theory quotes from really smart people.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Category theory is both an interesting object of philosophical study, and a potentially powerful formal tool for philosophical investigations of concepts such as space, system, and even truth.”&lt;/em&gt; - &lt;a href=&quot;https://plato.stanford.edu/entries/category-theory/&quot;&gt;Stanford Encyclopedia of Philosophy&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Category theory can be helpful in understanding Haskell’s type system.”&lt;/em&gt; - &lt;a href=&quot;https://wiki.haskell.org/Category_theory&quot;&gt;Haskell Wiki&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“In my opinion, category theory isn’t so much another country-on-the-map as it is a means of getting a bird’s-eye-view of the entire landscape. It’s what lifts our feet off the grass and provides us with a sweeping vista from the sky.”&lt;/em&gt; &lt;a href=&quot;https://www.math3ma.com/blog/what-is-category-theory-anyway&quot;&gt;Tai-Danae Bradley PhD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Category theory is becoming a central hub for all of pure mathematics…. We believe that it has the potential to be a major cohesive force in the world, building rigorous bridges between disparate worlds, both theoretical and practical.”&lt;/em&gt; - &lt;a href=&quot;http://math.mit.edu/~dspivak/teaching/sp18/7Sketches.pdf&quot;&gt;Seven Sketches in Compositionality: An Invitation to Applied Category Theory&lt;/a&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;to-categories-from-first-principles&quot;&gt;To Categories From First Principles&lt;/h1&gt;

&lt;h3 id=&quot;preface&quot;&gt;Preface&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;STOP:&lt;/strong&gt; do not read any further. Before beginning your journey here, you must first &lt;em&gt;unthink&lt;/em&gt; and &lt;em&gt;unknow&lt;/em&gt; any presumptions you may have about Category Theory, Sets, Math, the World, etc. Let’s begin with an absolutely clean slate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; this explanation is meant to be incredibly simple and for ANYONE of ANY background. Thus, some of the mathematical concepts, especially my negligence of Set Theory, are not 100% correct and may lead readers askew if they dive deeper into Category Theory without this knowledge (&lt;em&gt;edit after Reddit feedback&lt;/em&gt;).&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;object&quot;&gt;Object&lt;/h3&gt;

&lt;p&gt;We will start with an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;object&lt;/code&gt;. An object is simply a thing, yep, literally anything. This thing has no meaning. Here are some things:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;cat: 🐈&lt;/li&gt;
  &lt;li&gt;face: 😀&lt;/li&gt;
  &lt;li&gt;one: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;pizza: 🍕&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In your everyday life, these objects may have meaning. You may be able to also do things with them, like &lt;em&gt;eat a 🍕&lt;/em&gt; or &lt;em&gt;feed a 🐈&lt;/em&gt;. Unfortunately, that is not true in this world, at this time. These are objects, nothing more - do you get the point yet?&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;arrow&quot;&gt;Arrow&lt;/h3&gt;

&lt;p&gt;It may be desirable to transition, or &lt;em&gt;travel&lt;/em&gt;, from one object to another. In this world, that is possible via one way roads, called an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;arrow&lt;/code&gt;. We don’t know anything about these &lt;em&gt;one way roads&lt;/em&gt;. In real life, they could be bumpy, pristine, fast, slow, curvy, straight, etc. Here all we know is that the road goes from some object &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; to some object &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;. Consider the following arrows (➡️):&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt;: 🐈 ➡️ 🍕&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt;: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt; ➡️ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h&lt;/code&gt;: 😀 ➡️ 😀&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice how the last arrow goes from face to face. Don’t be confused. If you are confused, please reread the preface. All we can assume about an arrow is that it goes from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;. Also notice that these arrows are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;directed&lt;/code&gt; meaning &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt; ➡️ &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2&lt;/code&gt; goes from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2&lt;/code&gt;, but not &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;2&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1&lt;/code&gt;.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;set&quot;&gt;Set&lt;/h3&gt;

&lt;p&gt;Sometimes it’s pretty cool to have more than one of something (unless that thing is parking tickets). This collection of things exists in our world! We call it a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;set&lt;/code&gt;. Here are a few examples:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;A set of objects:&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;O&lt;/code&gt; = { 🍊, 🍋, 🍌 }&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;A set of arrows:&lt;/strong&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; = { &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h&lt;/code&gt; }&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;The empty set:&lt;/strong&gt; ∅ = {}&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; sets can come with some very helpful properties a la &lt;a href=&quot;https://plato.stanford.edu/entries/set-theory/&quot;&gt;Set Theory&lt;/a&gt;. While these are important and may be useful later, let’s ignore them for now. Instead, a set is simply a collection of things.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;graph&quot;&gt;Graph&lt;/h3&gt;

&lt;p&gt;By now, you’re probably wondering, &lt;em&gt;“what’s the point of any of this if I can’t do anything with it?”&lt;/em&gt; Well look no further. Consider a world called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;graph&lt;/code&gt; made up of a set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;O&lt;/code&gt; of objects and a set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; of arrows between these objects (some may call these &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;edges&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;vertices&lt;/code&gt;). &lt;br /&gt;
&lt;br /&gt;
A graph &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;G&lt;/code&gt; with: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;O&lt;/code&gt; = { 🍊, 🍋, 🍌 } and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; = { &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h&lt;/code&gt; } may look like this:&lt;br /&gt;&lt;/p&gt;
&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/Jdd6gxd.png&quot; /&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;
Let’s introduce some &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;operations&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;domain (dom)&lt;/strong&gt;: given an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;arrow&lt;/code&gt; return the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;object&lt;/code&gt; to its left&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;codomain (cod)&lt;/strong&gt;: given an &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;arrow&lt;/code&gt; return the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;object&lt;/code&gt; to its right&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;br /&gt;
&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;&lt;/p&gt;
&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/zdvYxir.png&quot; /&gt;&lt;/div&gt;

&lt;p&gt;While addition of these trivial operations may seem pointless, we are now able to &lt;em&gt;talk&lt;/em&gt; more about our world: &lt;em&gt;“this object is the domain of that arrow”&lt;/em&gt;. Before, while you and I could &lt;em&gt;see&lt;/em&gt; that two objects are related by an arrow, we had no way of formally describing which object was on which side of the directed arrow. These operations will be important as we continue to build up our world.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;axioms-vs-observations&quot;&gt;Axioms vs. Observations&lt;/h3&gt;

&lt;p&gt;In the next expansion of our world, &lt;em&gt;Category&lt;/em&gt;, we will begin to introduce some axioms about the system. Having not left my house for over 30 hours, I have entered a sort of (phsychadelic free) philosophical existence. If you’re not an experienced Mathematician, and even if you are, you may wonder the following:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;What is an observation?&lt;/li&gt;
  &lt;li&gt;What is an axiom?&lt;/li&gt;
  &lt;li&gt;What is the difference between an axiom and an observation?&lt;/li&gt;
  &lt;li&gt;Why do we need axioms?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While I will answer all these, in the process of doing so, you will understand better how mathematics, as a universe is built (and simultaneously understand my process for constructing Categories).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scene:&lt;/strong&gt; one day, I take you to an apple orchard and you notice that the first tree has &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;10&lt;/code&gt; apples on it, the second tree has &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;37&lt;/code&gt; apples on it and the third free has &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;104&lt;/code&gt; apples on it.&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Tree&lt;/th&gt;
      &lt;th&gt;Apples&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;10&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;37&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;104&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;This is an observation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Observation:&lt;/strong&gt; &lt;em&gt;“a record or description so obtained “&lt;/em&gt; - &lt;a href=&quot;https://www.merriam-webster.com/dictionary/observation&quot;&gt;Merriam-Webster Dictionary&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since you took some basic math classes, you deduce a pattern:&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;prevApples + 7 + (20 * 3^(tree#-2))&lt;/code&gt;:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;tree#&lt;/th&gt;
      &lt;th&gt;prevApples&lt;/th&gt;
      &lt;th&gt;formula&lt;/th&gt;
      &lt;th&gt;apples&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;n/a&lt;/td&gt;
      &lt;td&gt;n/a&lt;/td&gt;
      &lt;td&gt;10&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;10&lt;/td&gt;
      &lt;td&gt;10 + 7 + (20 * (3^0))&lt;/td&gt;
      &lt;td&gt;37&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;37&lt;/td&gt;
      &lt;td&gt;37 + 7 + (20 * (3^1)&lt;/td&gt;
      &lt;td&gt;104&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; technically this is not mathematically sound, how can you explain the first tree? Ignore this for now… this is more or less the point of this example.&lt;/p&gt;

&lt;p&gt;We call this a hypothesis, or conjecture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hypothesis:&lt;/strong&gt; &lt;em&gt;“an educated guess”&lt;/em&gt; - every grade school science teacher ever&lt;/p&gt;

&lt;p&gt;However, you continue walking through the orchard and see more trees. It turns out your hypothesis did not hold:&lt;/p&gt;

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;Tree&lt;/th&gt;
      &lt;th&gt;Apples&lt;/th&gt;
      &lt;th&gt;Predicted&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;10&lt;/td&gt;
      &lt;td&gt;10&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;37&lt;/td&gt;
      &lt;td&gt;37&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;104&lt;/td&gt;
      &lt;td&gt;104&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;229&lt;/td&gt;
      &lt;td&gt;291&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;5&lt;/td&gt;
      &lt;td&gt;430&lt;/td&gt;
      &lt;td&gt;838&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;In fact, you were not even remotely close. It turns out, after some laborious calculations, the pattern is actually: &lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;apples = 3 * (tree#)^3 + 2 * (tree#)^2 + 5&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With some fancy logic skills, we can utilize a technique called induction to prove this formula works. Once we have proven a hypothesis, it is called a &lt;strong&gt;theorem&lt;/strong&gt;. As stated in an article that really motivated this section: &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;“Proofs are what make mathematics different from all other sciences, because once we have proven something we are absolutely certain that it is and will always be true. It is not just a theory that fits our observations and may be replaced by a better theory in the future.”&lt;/em&gt; &lt;a href=&quot;https://mathigon.org/world/Axioms_and_Proof&quot;&gt;mathgion.org&lt;/a&gt; &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;From this, we observe that math tends to follow a pattern like this:&lt;br /&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;observe something&lt;/li&gt;
  &lt;li&gt;question whether that observation holds in other situations&lt;/li&gt;
  &lt;li&gt;postulate that it does and construct a hypothesis&lt;/li&gt;
  &lt;li&gt;gather some more data, a.k.a examples, and see if hypothesis holds&lt;/li&gt;
  &lt;li&gt;formulate a proof (via induction, contradiction, etc.)&lt;/li&gt;
  &lt;li&gt;verify logic holds: via math friends or a proof assistant like &lt;a href=&quot;https://leanprover.github.io/&quot;&gt;Lean&lt;/a&gt;, &lt;a href=&quot;https://coq.inria.fr/&quot;&gt;Coq&lt;/a&gt;, etc.&lt;/li&gt;
  &lt;li&gt;tell the world and publish results&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From this process, we continuously define the world around us, developing a more concrete system for building, creating, and understanding.&lt;/p&gt;

&lt;p&gt;Cool right? Well, I still have not gotten around to axioms yet. Let’s go back to the proof of induction from above. In this proof, I had to rely on some basic building blocks, or principles to base my argument on. i.e. if I was to prove to you &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1 + 1 = 2&lt;/code&gt;, we would need to agree on a few things:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;the definition of equals&lt;/li&gt;
  &lt;li&gt;how one &lt;em&gt;adds&lt;/em&gt; things&lt;/li&gt;
  &lt;li&gt;what even is a number&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While this may seem like a recursive process that never ends, at some point you hit rock bottom… &lt;em&gt;“ok Rob, just believe me, this is true!!!”&lt;/em&gt;. This is where we discuss axioms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Axiom:&lt;/strong&gt; &lt;em&gt;“a statement that is taken to be true, to serve as a premise or starting point for further reasoning and arguments”&lt;/em&gt; - &lt;a href=&quot;https://en.wikipedia.org/wiki/Axiom&quot;&gt;Wikipedia&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In each branch of math, logic, philosophy, etc. there are fundamental truths or observations that are more or less &lt;em&gt;“self explanatory.”&lt;/em&gt; Since we are building up a mathematical system here, &lt;em&gt;Category Theory&lt;/em&gt;, we need to introduce some of our own fundamental building blocks. In doing so, we can then construct an entire system, or world, where our observations (or here our &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;operations&lt;/code&gt;) have more meaning because we can prove things about them, things that &lt;strong&gt;ALWAYS&lt;/strong&gt; hold!&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;category&quot;&gt;Category&lt;/h3&gt;

&lt;p&gt;Ah yes, things are getting real! Let’s talk about categories. To begin, we are building off of a graph - thus we have a set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;O&lt;/code&gt; of objects, a set &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; of arrows between objects and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;domain&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;codomain&lt;/code&gt; operations. We begin by adding a couple more &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;operations&lt;/code&gt;:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;identity&lt;/strong&gt;: an arrow &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;IDa&lt;/code&gt; from some object &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; back to itself.  &lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/jwQs7gw.png&quot; /&gt;&lt;/div&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;composition:&lt;/strong&gt; for a pair of arrows &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt;, denoted &amp;lt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt;&amp;gt;, where &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cod(f)&lt;/code&gt; = &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;dom(g)&lt;/code&gt;, we have an arrow &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g ; f&lt;/code&gt; called the &lt;em&gt;composite&lt;/em&gt;, where we read &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g ; f&lt;/code&gt; as first apply &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt; then apply &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt;.&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/8HHNq6P.png&quot; /&gt;&lt;/div&gt;

&lt;p&gt;&lt;br /&gt;
It is now time to define some axioms. If you decided to skim this piece… shame on you. Please go back and read &lt;em&gt;Axioms vs. Oservations&lt;/em&gt;. &lt;em&gt;TL&amp;amp;DR&lt;/em&gt; axioms are the fundamental building blocks of a system or world:&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/DqhbD9d.png&quot; /&gt;&lt;/div&gt;

&lt;p&gt;As promised, in the world of categories, we establish our first axioms! We’ll start with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unit law&lt;/code&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Unit law:&lt;/strong&gt; for every arrow  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt;: 😀 ➡️ 🍕 and every  &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt;: 🍕 ➡️ 🐈, composition with &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID🍕&lt;/code&gt; gives: &lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID🍕 ;  f&lt;/code&gt; = &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g ; ID🍕&lt;/code&gt; = &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt;&lt;br /&gt;
From this we get the following commutative diagram:&lt;/p&gt;
&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/maKCj5n.png&quot; /&gt;&lt;/div&gt;
&lt;p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Associativity:&lt;/strong&gt; in this world, objects are a friendly (~polygamous~?) bunch , not too concerned who they &lt;em&gt;associate&lt;/em&gt; with. Thus, for some category with objects and arrows: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt;: 🐈 ➡️ 🍕, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt;: 🍕 ➡️ 😀, and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h&lt;/code&gt;: 😀 ➡️ 🍌 we have:&lt;br /&gt;
&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h ; (g ; f)&lt;/code&gt; = &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(h ; g) ; f&lt;/code&gt;&lt;br /&gt;
From this we get the following commutative diagram:&lt;/p&gt;
&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/ZGVvdHo.png&quot; /&gt;&lt;/div&gt;

&lt;h4 id=&quot;axioms-in-action&quot;&gt;Axioms in Action&lt;/h4&gt;

&lt;p&gt;Imagine a world &lt;strong&gt;without&lt;/strong&gt; the above, a world only with the four previously defined operations. Let’s say you notice that, for a few different &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID&lt;/code&gt; arrows, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID; ID; ID ; dom(ID) = dom(ID)&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cod(ID) ; ID ; ID ; ID = cod(ID)&lt;/code&gt;. You tell your friends &lt;em&gt;“hey everyone, I believe for every &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID&lt;/code&gt;, the this observation holds.”&lt;/em&gt; When your friends ask, &lt;em&gt;“how do you know?”&lt;/em&gt; you begin to produce example after example. One friend is not convinced, he is pessimisstic and believes there must exist some &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID&lt;/code&gt; where this does not hold. Without any basis of axioms, without any common set of assumptions, there is no way to convince your pessmisstic friend.&lt;/p&gt;

&lt;p&gt;Assume now we are back in a world &lt;strong&gt;with&lt;/strong&gt; the unit law. You may then formulate the following proof (excuse any formal inaccuracies or details missed in the following proof, I am a bit rusty).&lt;/p&gt;

&lt;p&gt;Consider, for a contradiction, that my conjecture:&lt;br /&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID ; ID ; ID ; dom(ID) = dom(ID)&lt;/code&gt; and &lt;br /&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;cod(ID) ; ID ; ID ; ID = cod(ID)&lt;/code&gt; &lt;br /&gt;do not hold. Thus, for the first case, we have:&lt;br /&gt; &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID ; ID ; ID ; dom(ID) != dom(ID)&lt;/code&gt;&lt;br /&gt; Well, consider the following:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1. from the unit law, we know: ID ; dom(ID) = dom(ID)
2. simplifying the original expression we get: ID ; ID ; dom(ID)
3. simplify again: ID ; dom(ID)
4. and finally: dom(ID)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Thus, we have shown &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID ; ID ; ID ; dom(ID) = dom(ID)&lt;/code&gt;, which is a contradiction. Since we have found a contradiction, we have in fact shown that the original conjecture is always true.&lt;/p&gt;

&lt;p&gt;With the above proof, your pessimistic friend was finally convinced - and hopefully you, &lt;em&gt;the reader&lt;/em&gt;, are now also convinced that axioms are important!&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;commutative-diagrams&quot;&gt;Commutative Diagrams&lt;/h3&gt;

&lt;p&gt;The significance of commutative diagrams is that, for any two objects &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;, every path (of arrows) between these objects, when composed, results in equal arrows. Thus, in the diagram above (for associativity), we have &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h ; (g ; f) = (h ; g) ; f = h ; g ; f&lt;/code&gt;. Let’s take a walk…&lt;br /&gt;&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h ; (g ; f)&lt;/code&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;strong&gt;Start:&lt;/strong&gt; 🐈&lt;/li&gt;
      &lt;li&gt;Take &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g ; f&lt;/code&gt;: 😀&lt;/li&gt;
      &lt;li&gt;Take &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h&lt;/code&gt;: 🍌&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;END:&lt;/strong&gt; 🍌&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;(h ; g) ; f&lt;/code&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;strong&gt;Start:&lt;/strong&gt; 🐈&lt;/li&gt;
      &lt;li&gt;Take &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt;: 🍕&lt;/li&gt;
      &lt;li&gt;Take &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h ; g&lt;/code&gt;: 🍌&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;END:&lt;/strong&gt; 🍌&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h ; g ; f&lt;/code&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;strong&gt;Start:&lt;/strong&gt; 🐈&lt;/li&gt;
      &lt;li&gt;Take &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;f&lt;/code&gt;: 🍕&lt;/li&gt;
      &lt;li&gt;Take &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;g&lt;/code&gt;: 😀&lt;/li&gt;
      &lt;li&gt;Take &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;h&lt;/code&gt;: 🍌&lt;/li&gt;
      &lt;li&gt;&lt;strong&gt;END:&lt;/strong&gt; 🍌&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From the above, it’s clear &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;1 = 2 = 3&lt;/code&gt;.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;so-what&quot;&gt;So what?&lt;/h3&gt;
&lt;p&gt;Well, we now have the ability to &lt;strong&gt;combine&lt;/strong&gt; and discuss &lt;strong&gt;equality&lt;/strong&gt; of arrows. With these tools, we can begin to reason about transitions between objects within our world in interesting ways. Without the addition of any more operations or axioms, we can draw parallels to the real world to make some sense of this: &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Driving&lt;/strong&gt; (&lt;em&gt;get from one location to another&lt;/em&gt;): &lt;br /&gt;
&lt;em&gt;[objects]:&lt;/em&gt; locations&lt;br /&gt;
&lt;em&gt;[arrows:]&lt;/em&gt; roads&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Surfing the internet&lt;/strong&gt; (&lt;em&gt;get from one webpage to another&lt;/em&gt;):&lt;br /&gt;
&lt;em&gt;[objects:]&lt;/em&gt; webpages&lt;br /&gt;
&lt;em&gt;[arrows:]&lt;/em&gt; links&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Baking&lt;/strong&gt; (&lt;em&gt;combine ingredients to make tasty treats&lt;/em&gt;):&lt;br /&gt;
&lt;em&gt;[objects:]&lt;/em&gt; ingredients&lt;br /&gt;
&lt;em&gt;[arrows:]&lt;/em&gt; directions like mix, chop, put in oven, etc.&lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Coding&lt;/strong&gt; (&lt;em&gt;get from one type to another&lt;/em&gt;):&lt;br /&gt;
&lt;em&gt;[objects:]&lt;/em&gt; types&lt;br /&gt;
&lt;em&gt;[arrows:]&lt;/em&gt; functions&lt;br /&gt;&lt;/p&gt;

&lt;h4 id=&quot;but-actually-though-who-cares&quot;&gt;But actually though, who cares?&lt;/h4&gt;

&lt;p&gt;Ok, tough crowd. Let’s discuss a hypothetical situation using concepts from above in the world of &lt;em&gt;driving&lt;/em&gt;. Let’s say you want to get to strabucks - you’re halfway through some ridiculous article on &lt;em&gt;Category Theory&lt;/em&gt; and need an energy boost. Since you’re new in town, so you ask a stranger for directions. Here is how it goes:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You&lt;/strong&gt; Hello, I just moved to Seattle, where is the closest Starbucks?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stranger 1:&lt;/strong&gt; Welcome! Well, if you take road &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; to road &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt;, take a right onto &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;H&lt;/code&gt;, you’ll come up to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;E&lt;/code&gt;. From there, you’ll see one on your left (path: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;E ; H ; B ; A&lt;/code&gt;).&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/bLrObTs.png&quot; /&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Stranger 2:&lt;/strong&gt; Hold on there mate, I know a better route. Instead of taking &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;H&lt;/code&gt;, you can avoid the notorious pothole and instead take &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;G&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID&lt;/code&gt;, which goes between &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;G&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F&lt;/code&gt;, and end up on &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F&lt;/code&gt;. From there you’ll go a few blocks before arriving (path: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F ; ID ; G ; B ; A&lt;/code&gt;).&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/DNoKmWd.png&quot; /&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; thanks for the input, however, if I know that &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;G&lt;/code&gt; is the beginning of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID&lt;/code&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;domain&lt;/code&gt;) and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F&lt;/code&gt; is the end of &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ID&lt;/code&gt; (&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;codomain&lt;/code&gt;), can’t I just go straight from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;G&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stranger 2:&lt;/strong&gt; oh yeah, you’re a bright fellow. By the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;unit law&lt;/code&gt; you’re correct (new path: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;F ; G ; B ; A&lt;/code&gt;)!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stranger 3:&lt;/strong&gt; well how about just going from &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;G&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D&lt;/code&gt;, a scenic route great for newcomers, &lt;em&gt;and then to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;E&lt;/code&gt;&lt;/em&gt; (path: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;E ; D ; C ; G ; B ; A&lt;/code&gt;)?&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/k9YGePw.png&quot; /&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; ok, ok, I need to map all this out. Here we go, these are my options correct? [all nod in approval]&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/l3L6k0M.png&quot; /&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Stranger 3:&lt;/strong&gt; how about I simplify this map a bit. Since traffic in Seattle is the same everywhere and all roads are equally good (&lt;em&gt;in this parallel world, not real Seattle&lt;/em&gt;), we get the following (note, as before &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;;&lt;/code&gt; means composition and describes transitions, applied from right-to-left):&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/e72BrAp.png&quot; /&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Stranger 2:&lt;/strong&gt; oh!! I see where you’re taking us [takes the paper]. From here we can construct the following commutative diagram:&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://imgur.com/LI2ENDd.png&quot; /&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Stranger 1:&lt;/strong&gt; so by this commutative diagram and the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;associativity&lt;/code&gt;, this young lad can either take &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;D&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C ; B&lt;/code&gt; or he can take &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;A&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;B ; D&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;C&lt;/code&gt;. These routes are in fact equal!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You:&lt;/strong&gt; awesome, thanks y’all!&lt;/p&gt;

&lt;p&gt;And from there you hop in your car and get on your way.&lt;/p&gt;

&lt;hr /&gt;

&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;If you made it this far, congratulations! I did not anticipate the length of this first blog post. Size aside, I hope it is now clear how powerful and useful this stuff is; with four operations and two axioms AND ONLY these four operations and two axioms, we can already reason about transitions and relations between objects within very different worlds (or structures).&lt;/p&gt;

&lt;div style=&quot;text-align:center&quot;&gt;&lt;img src=&quot;https://media.giphy.com/media/1034EEGrn91SrS/giphy.gif&quot; /&gt;&lt;/div&gt;
</description>
          <pubDate>2020-04-03T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/CategoryBasics</link>
          <guid isPermaLink="true">https://robdurst.com/CategoryBasics</guid>
        </item>
      
    
      
        <item>
          <title>Comb Sort</title>
          <description>&lt;p&gt;Since I have a few hours to kill on the plane this evening (and I won’t be falling asleep anytime soon due to the delicious Pumpkin Spice Latte I just consumed), I decided to write a post about Comb Sort. &lt;em&gt;Context&lt;/em&gt;: on Wednesday I will be presenting this to my Analysis of Algorithms class… this algorithm did not come up during my interview prep, so if you are deep in the process, stressing about how you need to know yet-another-sort-algo don’t fret!&lt;/p&gt;

&lt;h2 id=&quot;yo-bubble-sort-kinda-blows&quot;&gt;Yo, Bubble Sort Kinda Blows&lt;/h2&gt;

&lt;p&gt;While Bubble Sort maintains an admirable O(1) space complexity, it has an O(n^2) time complexity. Compared to any decent sorting algorithm, quicksort, mergesort, etc. this is quite inefficient. So, one may wonder, is it possible to speed it up? Where are the inefficencies? Where is the bottleneck? While I cannot promise you Bubble Sort will ever be as fast as a decent O(n log n) algorithm (and it won’t), there is room for optimization!&lt;/p&gt;

&lt;h2 id=&quot;an-abstract-intuition&quot;&gt;An Abstract Intuition&lt;/h2&gt;

&lt;p&gt;Let’s pretend you are a hunter and its your job to hunt as many turtles as possible. Now, turtles are slow creatures, so, we will assume they do not run away from you, We will also assume there are infinitely many turtles, just for the sake of argument.&lt;/p&gt;

&lt;p&gt;Since you are a tough guy, your weapon of choice is a club. Thus, you must travel within a yard of each turtle in order to be in striking distance.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/5PhDiKUbCYqNAxEKRP/giphy.gif&quot; alt=&quot;guy with club&quot; /&gt;&lt;/p&gt;

&lt;p&gt;For many seasons, you are able to provide for your family. However, your family grows. By the time your family exceeds 100 people, you are having problems keeping up – your strategy for traveling within striking distance of each turtle seriously inhibits the efficiency of your hunting. You begin to wonder, how can you improve upon your hunting? Would it be possible to reduce the distance you travel between turtles?&lt;/p&gt;

&lt;p&gt;It turns out the answer to this question is yes! A neighboring family has discovered a hunting algorithm that works considerably more efficiently: in order to reduce the distance traveled, they use a grappling hook to bring the turtles closer.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/3oKHWnvwhWK6yxNNXG/giphy.gif&quot; alt=&quot;Patrick with grappling hook&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This &lt;em&gt;preprocessing&lt;/em&gt; allows them to perform less steps-per-turtle, allowing them to feed families 100x larger than yours with ease.&lt;/p&gt;

&lt;h2 id=&quot;turtle-and-rabbits&quot;&gt;Turtle and Rabbits&lt;/h2&gt;

&lt;p&gt;So how can we apply this to Bubble Sort? (With my best Gavin Belson impression) “Consider the tortoise…”.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://siliconvalleyism.com/images/800x460/consider-the-tortoise.jpg&quot; alt=&quot;Gavin Belson w/ tortoise and rabbit&quot; /&gt;&lt;/p&gt;

&lt;p&gt;In Bubble Sort, there are two, let’s call them, “outlier values”, turtles and rabbits. Assuming an ascending order sort, we have the following definitions:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Turtle:&lt;/strong&gt; a small value at the end of the list &lt;br /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rabbit:&lt;/strong&gt; a large value at the beginning of the list&lt;/p&gt;

&lt;p&gt;While Rabbits are cheap to move, Turtles are incredibly expensive to move. Consider the following list:&lt;/p&gt;

&lt;p&gt;[X, X, X, X, 1]&lt;/p&gt;

&lt;p&gt;If every X &amp;gt; 1, 1 must be swapped (or inverted) 4 times. Now consider a boat load more X’s and several more turtles… I think you see where I am going.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Intuition:&lt;/strong&gt; a bottleneck of bubble sort is the inversion count related to turtles. &lt;em&gt;What if we could reduce the inversion count by increasing the swap gap from 1 to some much larger n (where n &amp;lt; length of the array).&lt;/em&gt;&lt;/p&gt;

&lt;h2 id=&quot;comb-sort&quot;&gt;Comb Sort&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/65ONx1Aykzjps8l19N/giphy.gif&quot; alt=&quot;sniper&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This is the idea behind Comb Sort! In Comb Sort land, it’s open season and you’re going turtle hunting with a long range sniper. 
Comb sort works by establishing a gap, and swapping values across that gap. Starting with a gap of length of array - 1 and decrementing by &lt;em&gt;the magic 1.3&lt;/em&gt; until we get to 1, we essentially preprocess the unsorted array, reducing the work of Bubble Sort at the end.&lt;/p&gt;

&lt;p&gt;In code it looks like this:&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# the magical 1.3
&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GAP_FACTOR&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;mf&quot;&gt;1.3&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;swap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;b&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;],&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;arr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;a&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getNextGap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;gap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;*=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GAP_FACTOR&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;combsort&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;len&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;gap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;swapped&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;!=&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;or&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;swapped&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;gap&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;getNextGap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;gap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;swapped&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;False&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
            &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]:&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;swap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;i&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gap&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
                &lt;span class=&quot;n&quot;&gt;swapped&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;bp&quot;&gt;True&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;nums&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;how-effective-is-this-preprocessing&quot;&gt;How Effective is this Preprocessing?&lt;/h2&gt;

&lt;p&gt;Curious to see how this performed, I created a list of 10,000 randomly shuffled numbers and clocked (using &lt;a href=&quot;https://docs.python.org/2/library/profile.html&quot;&gt;cProfile&lt;/a&gt;) Bubble Sort and Comb Sort. The numbers line up with the intuition:&lt;/p&gt;

&lt;p&gt;Bubble Sort:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;~25,000,000 swaps&lt;/li&gt;
  &lt;li&gt;~8.79 seconds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Comb Sort:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;~65,000 swaps&lt;/li&gt;
  &lt;li&gt;~0.05 seconds&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;While this data may be seriously skewed by some arbitrarilly bad distribution of the random shuffle in my one sample point, this at least goes to show that preprocessing the unsorted list before performing Bubble Sort is an effective strategy for optimization.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://bit.ly/2WJi98f&quot;&gt;Try it yourself.&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Comb_sort&quot;&gt;Wikipedia&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.geeksforgeeks.org/comb-sort/&quot;&gt;Geeks for Geeks&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;http://cs.clackamas.cc.or.us/molatore/cs260Spr03/combsort.htm&quot;&gt;Byte Magazine, 1991&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
          <pubDate>2019-11-04T04:19:21-08:00</pubDate>
          <link>https://robdurst.com/comb-sort</link>
          <guid isPermaLink="true">https://robdurst.com/comb-sort</guid>
        </item>
      
    
      
        <item>
          <title>Adventures in PL: Inferring Function Signatures in JavaScript</title>
          <description>&lt;p&gt;Last Friday morning, I sat in my small single in &lt;a href=&quot;https://www.colby.edu/visitors/location/pierce/&quot;&gt;Pierce dormitrory&lt;/a&gt; staring at the &lt;a href=&quot;https://www.typescriptlang.org/&quot;&gt;TypeScript&lt;/a&gt; compiler plugin I had just hacked together (&lt;a href=&quot;https://github.com/yunabe/tsapi-completions/blob/a8020c20d5d2235c2443f34688d30c56eb9d5aad/src/completions.spec.ts&quot;&gt;with some help of course&lt;/a&gt;). Given a small code snippet of TypeScript:&lt;/p&gt;

&lt;div class=&quot;language-typescript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;lodash&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
&lt;span class=&quot;nx&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;my plugin returned a list of type suggestions for the given function, much like what happens when you hover your mouse over a function in &lt;a href=&quot;https://code.visualstudio.com/docs/editor/intellisense&quot;&gt;VsCode’s Intellisense&lt;/a&gt;. It turns out these type suggestions themselves were actually not necesarilly types… as this depended on the type annotation header being used. For example, for the above code snippet, I get something along the lines of this:&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  name: &lt;span class=&quot;s1&quot;&gt;&apos;collection&apos;&lt;/span&gt;,
  documentation: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; text: &lt;span class=&quot;s1&quot;&gt;&apos;The collection to iterate over.&apos;&lt;/span&gt;, kind: &lt;span class=&quot;s1&quot;&gt;&apos;text&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;,
  displayParts: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;...],
  isOptional: &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  name: &lt;span class=&quot;s1&quot;&gt;&apos;iteratee&apos;&lt;/span&gt;,
  documentation: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt; text: &lt;span class=&quot;s1&quot;&gt;&apos;The function invoked per iteration.&apos;&lt;/span&gt;, kind: &lt;span class=&quot;s1&quot;&gt;&apos;text&apos;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;,
  displayParts: &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;...],
  isOptional: &lt;span class=&quot;nb&quot;&gt;false&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Which really did not help a whole lot. So, as I checked the clock and saw it was now a staggering 5AM, I came to wonder…&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/xT5LMK1iAmnCcOcOwU/giphy.gif&quot; alt=&quot;how did I get here?&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;inferring-callback-argument-positions-in-javascript&quot;&gt;Inferring Callback Argument Positions in JavaScript&lt;/h1&gt;

&lt;p&gt;In investigating the extension of &lt;a href=&quot;http://software-lab.org/publications/oopsla2018_LambdaTester.pdf&quot;&gt;a tool for generating feedback-directed, random tests for JavaScript&lt;/a&gt;, I spent some time experimenting with the tool’s callback position inference algorithm. For the less informed, this is non-trivial in JavaScript since it is a dynamically typed language. That means there is no type signature, type annotation, or type anything to clue a person or a static analyzer into what types are expected.&lt;/p&gt;

&lt;p&gt;It turns out LambdaTester’s algorithm did generally well for most common methods, but failed for methods that:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;had complex type requirement pre-condition checks, ex: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;foo(Number, Number, Number, Number, Callback)&lt;/code&gt;&lt;/li&gt;
  &lt;li&gt;had optional arguments, ex: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;readFile(Number, [optional], Callback)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes sense given the algorithm’s basic design:
&lt;em&gt;For 100 iterations, randomly permute the set of argument input types (and values) with a callback as the final argument from position 1…5.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So, as a curious and naive undergrad, I set out to see if I could do better.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/CjmvTCZf2U3p09Cn0h/giphy.gif&quot; alt=&quot;Let&apos;s do this&quot; /&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;putting-the-brute-in-brute-force&quot;&gt;Putting the Brute in Brute Force&lt;/h2&gt;

&lt;p&gt;With a couple months of algorithm practice as part of interview preperation, I knew the first move was to check out a brute force solution. This is rather obvious and was quick to implement. Basically, for the first five argument positions (a hard coded assumption made by the paper) I generated all possible combinations of types with a callback at the end. Satisfyingly, this exhaustive approach was correct, finding every single callback position. However, as with any of these brute force algorithms, it did not scale well. For this particular input size, my code tried over 1500 combinations, a fairly non-trivial 15x more than LambdaTester’s algorithm. Some quick math:&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;type = number | null | object | array | string | boolean

POS_1: cb (1 = 1)
POS_2: type, cb (6 * 1 = 6)
POS_3: type, type, cb (6 * 6 * 1 = 36)
POS_4: type, type, type, cb (6 * 6 * 6 * 1 = 216)
POS_5: type, type, type, type, cb (6 * 6 * 6 * 6 * 1 = 1296)

Total: 1555
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Thus, we more generally have a (6^(n-1)) + (6^(n-2))… or roughly an exponential 6^n complexity, which is &lt;strong&gt;really bad&lt;/strong&gt;, especially given the initial algorithm is constant time, or 100 iterations no matter the size of n arguments we want to discover.&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;how-can-we-optimize-this&quot;&gt;How can we optimize this?&lt;/h2&gt;

&lt;p&gt;Using my problem solving strategies from &lt;a href=&quot;http://algorist.com/&quot;&gt;The Algoithm Design Manual&lt;/a&gt;, I searched for ways to reduce repeated work or prune the search space. Ultimately turns out there is no good way to do so since:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;every test is unique and so no work is redundant&lt;/li&gt;
  &lt;li&gt;any test can be the right answer (cannot infer a direction based on a previous outcome)&lt;/li&gt;
  &lt;li&gt;related to 2, there is no way to determine the partial correctness (output is binary)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Hmmm… time to phone the audience.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/xUOrwiovjeOo1qQAY8/giphy.gif&quot; alt=&quot;me calling people&quot; /&gt;
***&lt;/p&gt;
&lt;h2 id=&quot;type-inference-in-the-wild&quot;&gt;Type Inference in the Wild&lt;/h2&gt;

&lt;p&gt;Avoiding the more intensly type theoretical papers, I ended up focusing my search on three, well-used, open source projects:&lt;/p&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;a href=&quot;https://www.typescriptlang.org/&quot;&gt;TypeScript&lt;/a&gt;: superset of JavaScript that transcompiles to JavaScript, supporting futuristic ECMAScript features and some static typing&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://flow.org/&quot;&gt;Flow&lt;/a&gt;: lightweight, static type checker for JavaScript&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://developers.google.com/closure/compiler&quot;&gt;Google’s Closure Compiler&lt;/a&gt;: JavaScript to JavaScript optimizing compiler&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;While all three more-or-less have some degree of type inference, the Closure Compiler is less focused on it, and Flow &lt;a href=&quot;https://medium.com/flow-type/what-the-flow-team-has-been-up-to-54239c62004f&quot;&gt;seems to be on the decline&lt;/a&gt;:&lt;/p&gt;
&lt;blockquote&gt;
  &lt;p&gt;Recently a bunch of open-source projects originally created at Facebook published plans to be rewritten in TypeScript. At Facebook we strongly value the independence of individual teams in creating their roadmaps, and in doing the best they can for the products they build. The projects that have decided to switch to TypeScript have external contributors whose lives will be much easier with this switch, and we respect these decisions.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and furthermore, was less interesting because it seemed to be veering on the side of &lt;a href=&quot;https://medium.com/flow-type/asking-for-required-annotations-64d4f9c1edf8&quot;&gt;&lt;em&gt;required annotations&lt;/em&gt;&lt;/a&gt; (something I naively believed to be due to a deficiency in innovation). So, I jumped headfirst into TypeScript’s source code with the thinking &lt;em&gt;“if it can tell me what types are and are not correct, then it must have some idea around what types are correct and expected…”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://media.giphy.com/media/l4FGJPnSGn9K5wcTK/giphy.gif&quot; alt=&quot;later&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AND WE ARE BACK AT THE BEGINNING OF THIS POST…&lt;/strong&gt;&lt;/p&gt;

&lt;hr /&gt;

&lt;h2 id=&quot;conclusion---gradual-typing-and-this-thing-called-heuristics&quot;&gt;Conclusion - Gradual Typing and this Thing Called Heuristics&lt;/h2&gt;

&lt;p&gt;This evening, before diving back into my partial solution from above, I decided to do a bit of searching into this concept I had seen around the internet called &lt;strong&gt;Gradual Typing&lt;/strong&gt;. Settling upon &lt;a href=&quot;https://wphomes.soic.indiana.edu/jsiek/what-is-gradual-typing/&quot;&gt;an article by Jeremy Siek&lt;/a&gt;, I learned that gradual typing is a type system where static and dynamic types coexist, often via type annotations…&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WAIT A MOMENT… isn’t this kind of like TypeScript!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Going back to Google, I did another search and &lt;a href=&quot;https://itnext.io/typescript-static-or-dynamic-64bceb50b93e&quot;&gt;it appears that TypeScript is a soft sort of gradually typed language&lt;/a&gt; (not going to pretend I 100% know what that means… just learned about gradual typing three hours ago). Ah, this makes sense. &lt;strong&gt;Thus, it is expected that you cannot fully infer every single method type signature!!!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ok, so it seems this TypeScript, type annotation crutch is doomed to fail; furthermore not every JavaScript library has a type header file. Now what? Well, coincidentally, I got to the seventh chapter in the &lt;em&gt;Algorithm Design Manual&lt;/em&gt;, a chapter discussing heuristics. The basic idea here is that we can use some stats and probability to get a mostly correct answer, sacrificing correctness for, typically, a significant improvement in efficiency. However, this comes with a catch. &lt;strong&gt;We must be able to define a cost function to weigh our progress towards the optimal solution.&lt;/strong&gt; As discussed above, since ever input is unique and only correct or incorrect, &lt;strong&gt;no such cost function exists.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://giphygifs.s3.amazonaws.com/media/ISOckXUybVfQ4/giphy.gif&quot; alt=&quot;sad face&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Well, it turns out my work here is done. I may not have much to show for my adventure here, but I have thoroghly convinced myself that the current algorithm is very likely the best.&lt;/p&gt;
</description>
          <pubDate>2019-10-21T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/JavaScriptTypeInference</link>
          <guid isPermaLink="true">https://robdurst.com/JavaScriptTypeInference</guid>
        </item>
      
    
      
        <item>
          <title>Dynamic Programming</title>
          <description>&lt;p&gt;So everyone who ever lived and learned algorithms, at some point in their journey, excitedly typed out a “how dynamic programming works” blog post. Ladies and Gentleman, this is not it. Instead, this is simply just some fun with python and proving to myself that this dynamic programming stuff is cool and useful. If you are looking for a how to on dynamic programming, I would totally recommend &lt;a href=&quot;http://www.algorist.com/&quot;&gt;The Algorithm Design Manual&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;http://www.algorist.com/images/adm2cover.jpg&quot; alt=&quot;Cover of The Algorithm Design Manual&quot; /&gt;                                                    &lt;br /&gt;
I am working through this book in preparation for job interviews and really love the style and content of this book – as I still work through parts of the bible (&lt;a href=&quot;https://en.wikipedia.org/wiki/Introduction_to_Algorithms&quot;&gt;CLRS&lt;/a&gt;), I find this book a sort of “abridged” version more or less perfect for someone interested in learning more than you can ever learn grinding away on LeetCode, but still not too off in theory land.&lt;/p&gt;

&lt;hr /&gt;

&lt;h1 id=&quot;fibonacci-and-dynamic-programming&quot;&gt;Fibonacci and Dynamic Programming&lt;/h1&gt;

&lt;p&gt;This is the dynamic programming example everyone uses… it has almost been beaten to death imo. However, it honestlt took me a few times to really “get it”, to understand what is really going on here and how it relates to the concept of dynamic programming as a whole. To solidfy my understanding of how fibonacci can be sped up with dynamic programming, I coded up four solutions, from worst to best.&lt;/p&gt;

&lt;h3 id=&quot;solution-1-recursion&quot;&gt;Solution 1: Recursion&lt;/h3&gt;
&lt;p&gt;You’re typical solution that overflows the stack and runs slow.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;def fib(n):
    if n &amp;lt; 2:
        return n

return fib(n-1) + fib(n-2)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;solution-2-recursion-and-memoization&quot;&gt;Solution 2: Recursion and Memoization&lt;/h3&gt;
&lt;p&gt;The optimized solution that still overflows the stack.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;def fib(n):
    if n in seen:
        return seen[n]

    seen[n-1], seen[n-2] = fib(n-1), fib(n-2)
    return seen[n-1] + seen[n-2]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;solution-3-iteration-and-linear-space-memoization&quot;&gt;Solution 3: Iteration and Linear Space Memoization&lt;/h3&gt;
&lt;p&gt;The optimized, stack friendly solution most people are happy with.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;def fib(n):
    dp = [0] * (n+1)
    dp[1] = 1

    for i in range(2,n+1):
        dp[i] = dp[i-1] + dp[i-2]

    return dp[n]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;solution-4-iteration-and-constant-space-memoization&quot;&gt;Solution 4: Iteration and Constant Space Memoization&lt;/h3&gt;
&lt;p&gt;The best, A+ solution.&lt;/p&gt;
&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;def bestFib(n):
    l, ll = 0, 1

    for i in range(2, n+1):
        l, ll = ll, ll + l

    return ll
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;so-how-do-these-all-compare-using-an-input-of-40&quot;&gt;So how do these all compare (using an input of 40)?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Solution 1:&lt;/strong&gt; &lt;em&gt;300,000,000+&lt;/em&gt; function calls
&lt;strong&gt;Solution 2:&lt;/strong&gt; &lt;em&gt;81&lt;/em&gt; function calls
&lt;strong&gt;Solution 3:&lt;/strong&gt; &lt;em&gt;4&lt;/em&gt; function calls
&lt;strong&gt;Solution 4:&lt;/strong&gt; &lt;em&gt;4&lt;/em&gt; function calls&lt;/p&gt;

&lt;p&gt;Don’t believe me?!? See below!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://imgur.com/Htf8d5P.png&quot; alt=&quot;Comparison of profiling of algorithms&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;and-what-is-the-damage-done-by-using-3-instead-of-4&quot;&gt;And what is the damage done by using 3 instead of 4?&lt;/h2&gt;
&lt;p&gt;Jumping into some profiling fun, I installed the &lt;a href=&quot;https://pypi.org/project/guppy/&quot;&gt;guppy&lt;/a&gt; library. In doing so, I was able to see the size of the heaps of each respective algorithm after it terminated. It turns out, on sufficiently large data sets, it is incredibly substantial (obvious I know). For example, I saw a 100x difference in memory usage, which resulted in a 10x slow down from 3 to 4 with a large &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;n&lt;/code&gt; value. Pretty crazy (yet totally expected…)!&lt;/p&gt;

</description>
          <pubDate>2019-10-12T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/DynamicProgramming</link>
          <guid isPermaLink="true">https://robdurst.com/DynamicProgramming</guid>
        </item>
      
    
      
        <item>
          <title>Spring 2019 Independent Study: The Sailfish Programming Language</title>
          <description>&lt;p&gt;I spent the last three and a half months reading through &lt;a href=&quot;https://www.google.com/url?sa=t&amp;amp;rct=j&amp;amp;q=&amp;amp;esrc=s&amp;amp;source=web&amp;amp;cd=4&amp;amp;ved=2ahUKEwii-u6fp43kAhW4FTQIHbsGB0MQFjADegQIABAB&amp;amp;url=https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FCompilers%3A_Principles%2C_Techniques%2C_and_Tools&amp;amp;usg=AOvVaw3164Na6eLEcEJLdOc1a1f4&quot;&gt;Compilers: Principles, Techniques, and Tools&lt;/a&gt; and implementing my own programming languages, &lt;a href=&quot;https://github.com/sailfish-lang&quot;&gt;Sailfish&lt;/a&gt;. As part of the final submission for my project to complete this independent study, I wrote a manual for the language, describing how it works, and some of the design processes along the way.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/sailfish-lang/sailfishc/blob/master/Sailfish.pdf&quot;&gt;Link to the Manual here.&lt;/a&gt;&lt;/p&gt;
</description>
          <pubDate>2019-05-12T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/Sailfish-Manual</link>
          <guid isPermaLink="true">https://robdurst.com/Sailfish-Manual</guid>
        </item>
      
    
      
        <item>
          <title>[Medium] A Restrospective On My Time As Organizer of SF Cryptocurrency Developers Meetup</title>
          <description>&lt;p&gt;&lt;a class=&quot;embedly-card&quot; data-card-controls=&quot;0&quot; href=&quot;https://medium.com/hackernoon/a-retrospective-on-my-time-as-organizer-of-the-sf-cryptocurrency-devs-meetup-44ac629a8d1?source=your_stories_page---------------------------&quot;&gt;A Retrospective on my time as Organizer of the SF Cryptocurrency Devs Meetup&lt;/a&gt;
&lt;script async=&quot;&quot; src=&quot;//cdn.embedly.com/widgets/platform.js&quot; charset=&quot;UTF-8&quot;&gt;&lt;/script&gt;&lt;/p&gt;
</description>
          <pubDate>2018-08-09T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/Restrospective-SF-Crypto-Devs</link>
          <guid isPermaLink="true">https://robdurst.com/Restrospective-SF-Crypto-Devs</guid>
        </item>
      
    
      
        <item>
          <title>[Medium] An Open Source SDK and Serde Magic: My First Two Months as a Member of the Rust Community</title>
          <description>&lt;p&gt;&lt;a class=&quot;embedly-card&quot; data-card-controls=&quot;0&quot; href=&quot;https://medium.com/hackernoon/a-retrospective-on-my-time-as-organizer-of-the-sf-cryptocurrency-devs-meetup-44ac629a8d1?source=your_stories_page---------------------------&quot;&gt;A Retrospective on my time as Organizer of the SF Cryptocurrency Devs Meetup&lt;/a&gt;
&lt;script async=&quot;&quot; src=&quot;//cdn.embedly.com/widgets/platform.js&quot; charset=&quot;UTF-8&quot;&gt;&lt;/script&gt;&lt;/p&gt;
</description>
          <pubDate>2018-05-09T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/Open-Source-SDK-And-Serde-Rust</link>
          <guid isPermaLink="true">https://robdurst.com/Open-Source-SDK-And-Serde-Rust</guid>
        </item>
      
    
      
        <item>
          <title>[Medium] I Just Wrote a Stellar Smart Contract Pt. 2: Let’s Dig a Little Deeper</title>
          <description>&lt;p&gt;&lt;a class=&quot;embedly-card&quot; data-card-controls=&quot;0&quot; href=&quot;https://medium.com/hackernoon/i-just-wrote-a-stellar-smart-contract-pt-2-lets-dive-a-little-deeper-a8dae19b9d0a&quot;&gt;I Just Wrote a Stellar Smart Contract Pt. 2: Let’s Dig a Little Deeper&lt;/a&gt;
&lt;script async=&quot;&quot; src=&quot;//cdn.embedly.com/widgets/platform.js&quot; charset=&quot;UTF-8&quot;&gt;&lt;/script&gt;&lt;/p&gt;
</description>
          <pubDate>2018-04-07T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/Stellar-Smart-Conrtract-2</link>
          <guid isPermaLink="true">https://robdurst.com/Stellar-Smart-Conrtract-2</guid>
        </item>
      
    
      
        <item>
          <title>[Medium] How I Beat CryptoKitties</title>
          <description>&lt;p&gt;&lt;a class=&quot;embedly-card&quot; data-card-controls=&quot;0&quot; href=&quot;https://medium.com/hackernoon/how-i-beat-cryptokitties-f9aa71c03c87&quot;&gt;How I Beat CryptoKitties&lt;/a&gt;
&lt;script async=&quot;&quot; src=&quot;//cdn.embedly.com/widgets/platform.js&quot; charset=&quot;UTF-8&quot;&gt;&lt;/script&gt;&lt;/p&gt;
</description>
          <pubDate>2018-04-02T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/How-I-Beat-CryptoKitties</link>
          <guid isPermaLink="true">https://robdurst.com/How-I-Beat-CryptoKitties</guid>
        </item>
      
    
      
        <item>
          <title>[Medium] I Just Wrote a Stellar Smart Contract</title>
          <description>&lt;p&gt;&lt;a class=&quot;embedly-card&quot; data-card-controls=&quot;0&quot; href=&quot;https://medium.com/@robdurst/i-just-wrote-a-stellar-smart-contract-7f54a391f5e1&quot;&gt;I Just Wrote a Stellar Smart Contract&lt;/a&gt;
&lt;script async=&quot;&quot; src=&quot;//cdn.embedly.com/widgets/platform.js&quot; charset=&quot;UTF-8&quot;&gt;&lt;/script&gt;&lt;/p&gt;
</description>
          <pubDate>2018-02-21T04:19:21-08:00</pubDate>
          <link>https://robdurst.com/Stellar-Smart-Conrtract-1</link>
          <guid isPermaLink="true">https://robdurst.com/Stellar-Smart-Conrtract-1</guid>
        </item>
      
    
      
        <item>
          <title>[Medium] So You Want to Buy Ice Cream on the Bitcoin Testnet: Block and Jerry’s</title>
          <description>&lt;p&gt;&lt;a class=&quot;embedly-card&quot; data-card-controls=&quot;0&quot; href=&quot;https://medium.com/@robdurst/so-you-want-to-buy-ice-cream-on-the-bitcoin-testnet-block-and-jerrys-eb66c8d1296e&quot;&gt;So You Want to Buy Ice Cream on the Bitcoin Testnet: Block and Jerry’s&lt;/a&gt;
&lt;script async=&quot;&quot; src=&quot;//cdn.embedly.com/widgets/platform.js&quot; charset=&quot;UTF-8&quot;&gt;&lt;/script&gt;&lt;/p&gt;
</description>
          <pubDate>2018-02-04T04:19:21-08:00</pubDate>
          <link>https://robdurst.com/So-You-IceCream-Bitcoin-Testnet</link>
          <guid isPermaLink="true">https://robdurst.com/So-You-IceCream-Bitcoin-Testnet</guid>
        </item>
      
    
      
        <item>
          <title>My First Open Source Contribution!</title>
          <description>&lt;h1 id=&quot;i-am-now-officially-an-open-source-contributor&quot;&gt;I am Now Officially an Open Source Contributor&lt;/h1&gt;

&lt;p&gt;One of the coolest things about the blockchain/crypto craze in my opinion is the wealth of amazing open source projects. A goal of mine for a while has been to contribute to one of these projects, a sort of rite of passage in the crypto dev community. Well, I have finally made my first contribution!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/p/5CEvyaWxjaEsVUnNGyqVR3v4eG3o4TbLcLt71sSuPD6C9KDfQ74oJe84ghH6kViFNNyx1tTp8N1oduT5w?format=match&amp;amp;mode=fit&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The project I chose to contribute to is &lt;a href=&quot;https://stellarterm.com/&quot;&gt;StellarTerm&lt;/a&gt;, a Stellar Trading Client. I chose to address the need for a minimal, yet informational account history table. Here is what I came up with:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/DQmWhDr67qSzsFiu6VsrYYEsW12JVUFBE5BcVSy6583L1Zu/Screen%20Shot%202018-01-07%20at%2010.10.57%20PM.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You can even hover over the assets to get a cool little popup (I did not design the popup):&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/p/8DAuGnTQCLpunQuGfHnXTmxWbRQScCVGspXNWFwLjpPqj5rR8bEcKGviF7vcKx5Cu8BH263gSmecRrHuTiAoz4wuWsMUWNnfzMZviQh3JihpCqepgBHQ8kr9d6Q2FbGAWJuupwQDqGwGdQXhRbtFoD1KKSadDuFwcgUy5ksAP4z?format=match&amp;amp;mode=fit&amp;amp;width=640&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And you can filter by effect (action) type:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/DQmRnE2BNjRCN2YAWJo5cAAkaq9nCN9YvmpRS3sMyNEnZku/Screen%20Shot%202018-01-07%20at%2010.11.35%20PM.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here is proof of my contribution:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/p/8DAuGnTQCLpunQuGfHnXTmxWbRQScCVGspXNWFwLnyVAFszeRGdCe9H2X5Jc3atJCuGkP74mffWBeSvgKc2pv3adTbpx9PkCqRnrPcikUg9AXwTs4t2pA5at5xqxroN7oaE2RWr4jxxgHYK7yzhHKusj8up6Nyxm8eex7q3Rsa6?format=match&amp;amp;mode=fit&amp;amp;width=640&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Quite exciting stuff! If you’re also an open source contributor to a cool crypto project, please feel free to comment below.&lt;/p&gt;

&lt;p&gt;Cheers and Steem on!&lt;/p&gt;
</description>
          <pubDate>2018-01-04T04:19:21-08:00</pubDate>
          <link>https://robdurst.com/First-Open-Source-Contribution</link>
          <guid isPermaLink="true">https://robdurst.com/First-Open-Source-Contribution</guid>
        </item>
      
    
      
        <item>
          <title>Horizon School of Technology Blog Series</title>
          <description>&lt;p&gt;During my time at the &lt;a href=&quot;joinhorizons.com&quot;&gt;Horizon’s School of Technology Coding Bootcamp&lt;/a&gt; I wrote a series of blog posts:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://steemit.com/life/@robertdurst10/horizons-school-of-technology-coding-bootcamp-week-1&quot;&gt;Week 1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://steemit.com/life/@robertdurst10/horizons-week-2-won-tickets-to-techcrunch-disrupt-hackathon-and-hacked-with-apple-arkit&quot;&gt;Week 2&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://steemit.com/life/@robertdurst10/horizons-week-3-part-1-backend-baby&quot;&gt;Week 3 Part 1&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://steemit.com/techcrunch/@robertdurst10/horizons-week-3-part-2-techcrunch-disrupt-sf-and-vitalik-buterin-speaks&quot;&gt;Week 3 Part 2&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://steemit.com/ethereum/@robertdurst10/horizons-week-3-part-3-ethereum-developer-meetup-of-the-century-vitalik-buterin-joseph-poon-jun-hasegawa&quot;&gt;Week 3 Part 3&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://steemit.com/life/@robertdurst10/horizons-week-4-web-app-authentication-and-further-crypto-adventures&quot;&gt;Week 4&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://steemit.com/blockchain/@robertdurst10/a-recap-the-first-four-months-of-my-gap-year-in-san-francisco&quot;&gt;An Overall Recap&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
</description>
          <pubDate>2017-12-01T04:19:21-08:00</pubDate>
          <link>https://robdurst.com/Horizon-School-Of-Technology</link>
          <guid isPermaLink="true">https://robdurst.com/Horizon-School-Of-Technology</guid>
        </item>
      
    
      
        <item>
          <title>Bitcoin Edge Dev ++: My Experience</title>
          <description>&lt;h1 id=&quot;bitcoin-edge-dev-an-incredible-experience-and-how-i-got-here&quot;&gt;Bitcoin Edge Dev++: An Incredible Experience and How I Got Here&lt;/h1&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/DQmbJ82DF3E2F4fZAoTsv7dhMeQi8Xbij97KmPprMjZNbs2/Screen%20Shot%202017-11-04%20at%2010.04.24%20AM.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I had an absolutely incredible last two days learning the high level technical overview of Bitcoin. As I’ve had more and more people lately ask me about how to begin in this space, I wanted to begin this post with a quick recap on how I got to where I am.&lt;/p&gt;

&lt;p&gt;To organize this post I am going to split it up into 5 parts:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;My Journey into the World of Blockchain&lt;/li&gt;
  &lt;li&gt;Bitcoin Edge Dev ++ An Overview&lt;/li&gt;
  &lt;li&gt;Day 1&lt;/li&gt;
  &lt;li&gt;Day 2&lt;/li&gt;
  &lt;li&gt;Now What?&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;part-1-my-journey-into-the-world-of-blockchain&quot;&gt;[PART 1] My Journey into the World of Blockchain&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/p/2dk2RRM2dZ8gbkvz1yNBypLpwUHBnasMpK1zSCzdC5LcFTzDzEuGvrHLGYwnJPoNzPo1gxi8bTBcmn6L3k1Wc6ghRTXNJERAo2t4ZcLNxuwgBDdLmvXa75dbaq5VHHDNj6UQPh6HfM7NwdkMw4DR1dmbg98vDRJMkFSCcLEFTt?format=match&amp;amp;mode=fit&amp;amp;width=640&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;My journey into the blockchain world started about 11 months ago midway through December of 2016; thus I am in the weird “new” by some people’s standards and “old” by other people’s standards position. A local tech consulting company, Collaborative Consulting (now CGI), put on an internship competition, a case competition challenging students to come up with the best combination of blockchain and college transcripts. Interested in winning the competition and securing an internship position, I opted for an independent study during my January term to focus on learning about blockchain technology. What started as a desire to win quickly transformed into a desire to learn. I found myself engrossed in white papers and side learning tangents, obsessed with understanding every detail about this exciting technology.&lt;/p&gt;

&lt;p&gt;Since then, my blockchain obsession has taken me many incredible places:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Presented about blockchain technology at CGI’s inaugural East Maine Tech Night&lt;/li&gt;
  &lt;li&gt;Published a Cryptocurrency Ticker App to the Pebble App Store&lt;/li&gt;
  &lt;li&gt;Attended the MIT Bitcoin Expo&lt;/li&gt;
  &lt;li&gt;Became a daily Steemit user and even a witness for a week&lt;/li&gt;
  &lt;li&gt;Played around with Ethereum smart contracts&lt;/li&gt;
  &lt;li&gt;Found a few local cryptocurrency enthusiasts and helped start a local meetup&lt;/li&gt;
  &lt;li&gt;Attended MANY cryptocurreny/blockchain meetups in SF&lt;/li&gt;
  &lt;li&gt;Attended Silicon Valley Tech Week&lt;/li&gt;
  &lt;li&gt;Attended Tech Crunch Disrupt and got to ask Vitalik Buterin a question&lt;/li&gt;
  &lt;li&gt;Helped Co-host a Steemit meetup with @ned as speaker (120+ people came!)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And now, I had the privilege of attending the inaugural Bitcoin Edge Dev++ 2 Day Technical Bootcamp. It is finally time to get serious about developing!&lt;/p&gt;

&lt;h2 id=&quot;part-2-bitcoin-edge-dev--an-overview&quot;&gt;[PART 2] Bitcoin Edge Dev ++ An Overview&lt;/h2&gt;

&lt;p&gt;As per the Bitcoin Edge website, here is the mission of the program:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Bitcoin Edge Dev++ Tutorial is meant to focus on scaling the development capacity of the ecosystem via education of developers in the field of cryptocurrency and helping the industry streamline the process of developer training. The primary focus of this tutorial will be a basic first-principles introduction to cryptocurrency as well as cryptocurrency-specific engineering methodologies, security practices, and standard operating procedures.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Consider a sports analogy for this situation:&lt;/p&gt;

&lt;p&gt;The NFL has run out of talent. To solve this problem, they setup a two day bootcamp taught by top NFL coaches and players to educate and train the next level of talent and get them excited about playing pro football.&lt;/p&gt;

&lt;p&gt;Pretty damn cool right?&lt;/p&gt;

&lt;p&gt;Of course excited and hoping to maximize the situation, I prepped for most of the month leading up. My prep included:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;the first six chapters of http://www.learncpp.com/ in an effort to get a little bit of C++ knowledge under my belt&lt;/li&gt;
  &lt;li&gt;Mastering Bitcoin, an incredible book for getting a high level technical understanding of Bitcoin (most of what I learned this weekend was actually covered wholly, or partially, in this book)&lt;/li&gt;
  &lt;li&gt;Bitcoin Dev email list, Jimmy Song’s newsletter, Reddit, and Twitter to stay up to date&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Walking in the doors on Thursday morning, I was well prepared.&lt;/p&gt;

&lt;h2 id=&quot;part-3-day-1&quot;&gt;[PART 3] Day 1&lt;/h2&gt;

&lt;p&gt;Both days of the two day event were held on Stanford’s campus. Let me just say, WOW!!! Stanford’s campus is absolutely beautiful. The palm trees, the adobe architecture, the modern buildings… just an incredible place. I showed up a few minutes early and got a good seat, front and center. We even received some swag (as I had secretly been hoping for).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/DQmexcAKTFPjRPPszXgEU93XVAJvSW939nXR8SGUv9xDb6K/IMG_1358%20(1).JPG&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Here is the schedule for the day:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/p/8DAuGnTQCLpunQuGfHnXTmxWbRQScCVGspXNWFwLneXTLQKj2KuLJcVy5VBMi36pCXgVzCTQyFTBCSqHK8G8K2mmxm4D5sghdBe4FyAHUGvgKJhprcp8ABTPXsiGi7vWsnSF9EANjqmLCo2Nm5dD2GcGmWCEUEwE9xriNMfD9kA?format=match&amp;amp;mode=fit&amp;amp;width=640&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;While I certainly learned too much to explain here in detail, here is a brief synopsis of what I learned. We started with the most basic elements of any crypto system… cryptography. Jimmy Song’s system went from elliptic curves to finite fields to a combination of the two, to ECDSA to asymmetric cryptography to digital signatures, to P2PKH addresses and signatures to P2SH addresses and signatures. While it may seem like a lot, it is in fact a very nice, logical progression. Luckily I had just taken a cryptography class last semester so, I was one of the least confused people in the room.&lt;/p&gt;

&lt;p&gt;John Newbery, core developer and active contributor was up next. He explained the basics behind blocks, the blockchain, transactions, and the mempool. While at times it got technical and down to the byte (literally) it was fascinating to see how all these moving parts worked together to create the Bitcoin ecosystem.&lt;/p&gt;

&lt;p&gt;With day 1 done, I had a pretty good overview of how the entire Bitcoin system worked; Day 1 was layer 1, focused on the fundamentals of the Bitcoin protocol. Day 2 was layer 2, things built on top of layer 1, ex) Lightning Network.&lt;/p&gt;

&lt;h2 id=&quot;part-4-day-2&quot;&gt;[PART 4] Day 2&lt;/h2&gt;

&lt;p&gt;I found Day 2 to be slightly more interesting as it focused less on the fundamentals and more on applications (and even some code).&lt;/p&gt;

&lt;p&gt;Here is the schedule for the day:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/DQmZ2fy6xiV78Hzt4fWPmyiKm3HCcsgABMtJW7h3AeHTScp/Screen%20Shot%202017-11-04%20at%2010.25.49%20AM.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We began with the last of the fundamentals: HD wallets, mining, and common attacks. Most of this was knowledge I had coming into the day and was covered in Mastering Bitcoin.&lt;/p&gt;

&lt;p&gt;However, the second part of the day was incredibly exciting!&lt;/p&gt;

&lt;p&gt;RPC: RPC stands for remote procedure call and allows for people to connect and interact with their Bitcoin node remotely. I had always been wondering how this worked because in theory, if I wanted to create a Bitcoin application, it would require me to connect to a node in order to access the Bitcoin network. This session presented us with a basic application and explained the basics of interacting with and setting up full nodes.&lt;/p&gt;

&lt;p&gt;Lightning Network: WOW the Lightning Network is awesome! For those of you who are unfamiliar, at its most basic level, the Lightning Network is a second layer protocol for Bitcoin. It works by rooting an initial multisig transaction on the blockchain and then setting up a payment channel between two people off-chain. Via a multi-hop architecture, you can then create a network effect between these channels and connect any two people, allowing for fast, private, cheap transactions that don’t bloat the Bitcoin blockchain. Cool right? Following Tadge’s explanation of the LN, we got play around with a live demo! I received fake bitcoins on the lightning network from the creator of it!!!!! What a great time!&lt;/p&gt;

&lt;p&gt;Crosschain Swaps: Crosschain swaps allow you to privately and securing transact assets between two different blockchains. This presentation was followed by a simple demo. While exciting, the premise is sort of cryptocurrency laundering (at least from some people’s perspectives). Very cool for some people, not so much for the government :)&lt;/p&gt;

&lt;h2 id=&quot;part-5-now-what&quot;&gt;[PART 5] Now What?&lt;/h2&gt;

&lt;p&gt;I am by no means a Bitcoin expert, and am still years of experience away from being technically skilled enough to be a core developer. However, I am a pretty skilled full stack developer with a high level technical understanding of Bitcoin. So ultimately, I believe the best way for me to contribute to the ecosystem is to use the skills I have and the knowledge I gained and try to develop layer 2 applications. Here are some thoughts I have on where to go next and things I want to experiment with:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Develop a front end facing Bitcoin application using my React/web dev skills&lt;/li&gt;
  &lt;li&gt;Build a simple RPC application&lt;/li&gt;
  &lt;li&gt;Develop a simple JS app to mimic Bitcoin’s fundamentals&lt;/li&gt;
  &lt;li&gt;Mess around with the Blockstream Bitcoin Satellite&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now that I am pretty knowledgable in the Bitcoin basics, I am more than happy to help anyone who may be struggling and needs a little bit of clarification! Like I said, I am not an expert by any means, but I undoubtedly know more this week than I did last week… and I believe that if I continue knowing a little bit more each week, at some point I’ll be pretty good at this stuff.&lt;/p&gt;

&lt;p&gt;Hope everyone has a wonderful Fall weekend! Special shoutout to all my fellow Steemians at SteemFest! Cheers and Steem on!&lt;/p&gt;
</description>
          <pubDate>2017-11-03T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/My-Time-At-BitcoinEdge-Dev-++</link>
          <guid isPermaLink="true">https://robdurst.com/My-Time-At-BitcoinEdge-Dev-++</guid>
        </item>
      
    
      
        <item>
          <title>Bitcoin Core Devs Meetup: Forking Meetup Panel Notes</title>
          <description>&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/DQmTLJPW4WMgGmXMr3WgrBnSqc8X6kq1YR1hEwhFdFNpAC7/IMG_1268.JPG&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;overview&quot;&gt;Overview&lt;/h2&gt;

&lt;p&gt;Today, @sahil.hingorani and I attended the San Fransisco Bitcoin Meetup’s Forking Panel discussion in the heart of San Fransisco. The meetup consisted of a strong panel of speakers who discussed the current state of Bitcoin, including the recent forking proposals, Segwit, and Bitcoin Cash. As someone really interested in this space, I took lengthy notes on my computer during the panel discussion. This post is essentially a concise version of the notes I took. Enjoy!&lt;/p&gt;

&lt;p&gt;On the Panel&lt;/p&gt;

&lt;p&gt;Here are the panelists from left to right.&lt;/p&gt;

&lt;p&gt;Eric Martindale: left Blockstream to devote more time to building Fabric, an experimental peer-to-peer information market.&lt;/p&gt;

&lt;p&gt;Elizabeth Stark: Cofounder at Lightning Labs and fellow at Coin Center.&lt;/p&gt;

&lt;p&gt;Christopher “JJ” Jeffrey: CTO of Purse.io and creator of BCoin, an advanced fullnode implementation of bitcoin.&lt;/p&gt;

&lt;p&gt;Laolu “roasbeef” Osuntokun: Cofounder at Lightning Labs and a btcd contributor.&lt;/p&gt;

&lt;p&gt;Some Background Information - Relevant Terms&lt;/p&gt;

&lt;h3 id=&quot;fyi-1-hard-fork-vs-soft-fork&quot;&gt;FYI 1: Hard-fork vs. Soft-fork&lt;/h3&gt;

&lt;p&gt;Currently, there are two acronyms floating around that confuse a lot of people: UAHF and UASF.&lt;/p&gt;

&lt;p&gt;UASF stands for User Activated Soft Fork. UAHF stands for User Activated Hard Fork. I will get to what these two solutions seek to do, but before I go there, what exactly are HF’s and SF’s?&lt;/p&gt;

&lt;p&gt;Hard Fork: a hard fork is a splitting of the blockchain, resulting in two coins. It essentially creates two coins, two blockchains, and two networks that originated from the same blockchain. An example is Ethereum and Ether Classic. Both started as Ethereum and both can trace their origination to the same blockchain, but now the two are completely different entities.&lt;/p&gt;

&lt;p&gt;The UAHF that people are talking about will create Bitcoin Cash and is proposed by Bitmain. This is their plan for opposition against UASF and BIP148.&lt;/p&gt;

&lt;p&gt;Soft Fork: a soft fork is a backward compatible upgrade that make minor changes to the network. An example of a soft fork is the P2SH protocol that allowed for new Bitcoin transaction types. The difference between a soft fork and a hard fork is that a soft fork only needs majority rule and is compatible with nodes that have not participated. Hard forks are not compatible with non-participating nodes and thus cause disruption and confusion within the system.&lt;/p&gt;

&lt;p&gt;BIP148 is a USAF.&lt;/p&gt;

&lt;h3 id=&quot;fyi-2-segwit&quot;&gt;FYI 2: Segwit&lt;/h3&gt;

&lt;p&gt;Segwit stands for segregated witness. This allows for certain parts of transaction data to be left out of transaction blocks, and thus more transactions can fit in a single block.&lt;/p&gt;

&lt;h3 id=&quot;fyi-3-bip91&quot;&gt;FYI 3: BIP91&lt;/h3&gt;

&lt;p&gt;Allows for Segwit2x (Segwit + 2mb increased block size) to be activated if 80% of the miners signal acceptance, versus the previously required 95%.&lt;/p&gt;

&lt;h3 id=&quot;fyi-4-bip148&quot;&gt;FYI 4: BIP148&lt;/h3&gt;

&lt;p&gt;A UASF that seeks to enforce all Segwit ready nodes to run Segwit. Segwit was accepted into the system by miners in a MASF (miner activated soft fork), aka BIP91.&lt;/p&gt;

&lt;h3 id=&quot;fyi-5-lightning-network&quot;&gt;FYI 5: Lightning Network&lt;/h3&gt;

&lt;p&gt;The lightning network is the second layer of the Bitcoin protocol. What does this mean? Before yesterday I had no idea.&lt;/p&gt;

&lt;p&gt;Basically, the lightning network is a separate entity that works on top of the blockchain. What that means is that an application can do some really cool things that the blockchain may not be able to handle while functioning on the lightning network. Then, later the lightning network can finalize these actions on the blockchain.&lt;/p&gt;

&lt;p&gt;An example is reversible transactions. On the blockchain, this is not possible. But, with a second layer protocol like the lightning network, reversible Bitcoin transactions may become a reality.&lt;/p&gt;

&lt;h3 id=&quot;fyi-6-bitcoin-cash&quot;&gt;FYI 6: Bitcoin Cash&lt;/h3&gt;

&lt;p&gt;Some people (even some who originally backed Segwit2X) are unhappy with the direction of Bitcoin and are creating their own currency. While this carries the Bitcoin name, it is an altcoin like Ethereum, Litecoin, etc. Bitcoin Cash is a fork of Bitcoin with no Segwit and 8mb block sizes instead of 2mb. If you act before August 1, ViaBTC will freeze your BTC in exchange for Bitcoin Cash. Many people from the meetup believe this is a scam.&lt;/p&gt;

&lt;h2 id=&quot;the-panel-discussion&quot;&gt;The Panel Discussion&lt;/h2&gt;

&lt;h3 id=&quot;question-1-what-is-the-problem&quot;&gt;Question 1: What is the Problem?&lt;/h3&gt;

&lt;p&gt;a) Bitcoin’s network is reaching its limit and cannot keep up with the number of transactions on the system.
Bitcoin is a scarce resource, meaning that with more demand and a limited supply, prices will rise. Unfortunately, with a fixed transaction size, fee’s must increase more and more as people essentially bid to get their transaction included on the blockchain. Thus, micro (small) payments become obsolete, going against the original intentions of Bitcoin visionary, Satoshi Nakamoto.&lt;/p&gt;

&lt;p&gt;Solutions to this issue are to make transactions smaller and more efficient (Segwit) and to make the block sizes bigger (Bitcoin Cash).&lt;/p&gt;

&lt;p&gt;b) Issue with hard forks.
Bitcoin Cash proponents seek a hard fork. Nearly all the panelists agreed that a hard fork is not a desirable solution. This would create confusion between the two competing blockchains and create unhealthy vulnerabilities that would ruin the reputation of Bitcoin as a whole. One of the panelists even went so far as to say a contentious hard fork may seriously damage and even destroy Bitcoin.&lt;/p&gt;

&lt;p&gt;c) Who governs Bitcoin?
During the discussion of why hard forks are not desirable, the question of governance came up. The golden question here is who governs Bitcoin, the miners or the coders? The obvious argument seemed to be the miners, since they maintain the system. However, these miners are incentivized to protect their investments and so their interest should be aligned with those of the ecosystem. Thus, if they are making moves that instill distrust in the average Bitcoin user, they would likely alter their actions to regain the trust of the average user in fear of damaging the value of their bitcoins.&lt;/p&gt;

&lt;h3 id=&quot;question-2-why-didnt-segwit2x-go-smoothly&quot;&gt;Question 2: Why didn’t Segwit2X go smoothly?&lt;/h3&gt;

&lt;p&gt;For those on the panel who support Segwit, Segwit2X signaling means it is time to celebrate. Sure, they had to make some concessions and increase the block size to 2mb, but the Segwit supporters argued that passing Segwit far outweighed the negative effects that may come with increased block size. However, there are still those that are very opposed to Segwit. These people are supporters of UAHF and are proponents of Bitcoin Cash. So, even though it seemed like a half-way point was met, there are still miners and large organizations making plans to split Bitcoin because they are unsatisfied with portions of the agreement.&lt;/p&gt;

&lt;h3 id=&quot;question-3-what-is-your-vision-of-bitcoin-is-bitcoin-a-currency-or-a-stored-value&quot;&gt;Question 3: What is your vision of Bitcoin? Is Bitcoin a currency or a stored value?&lt;/h3&gt;

&lt;p&gt;Here is the unabridged version of my notes for this question :)&lt;/p&gt;

&lt;p&gt;Laolu (playing devils advocate in support of Bitcoin Cash): it is a currency, not a stored value (DEFEAT ENTIRE PURPOSE if not used as a currency) NEED more people on the system, MORE supply, less fees, LET MARKET DECIDE BLOCK SIZE.&lt;/p&gt;

&lt;p&gt;JJ: into currency and value store BIG ADVOCATE OF LIGHTNING, lightning debate between idealism and pragmatism, SEGWIT2X just good because we got segwit and progress is the MOST IMPORTANT and put before the privacy issues.&lt;/p&gt;

&lt;p&gt;Elizabeth: believe it is both currency and stored value, lightning allow for smaller transactions, lightning allows for local consensus and then the bigger network can confirm the rest, NOT EITHER OR SCENARIO.&lt;/p&gt;

&lt;p&gt;Martindale: blockchain bad for payments, credit cards way faster, struggle to understand urgency to grow network because
SATOSHI vision is not met, need to do this first because use case is not met, bitcoin is a trust anchor and a reference point for all, multiple implementations good for the long run, bitcoin protocol detailed and complex, many edge cases exist.&lt;/p&gt;

&lt;h3 id=&quot;question-4-what-is-happening-in-november&quot;&gt;Question 4: What is happening in November?&lt;/h3&gt;

&lt;p&gt;Second half of Segwit kicks in and people think 3rd coin maybe as mining pools may go 50/50. Basically, even though there was lots of optimism coming from the panel, we are by no means out of the woods yet.&lt;/p&gt;

&lt;h3 id=&quot;question-5-how-do-we-come-together-as-a-community-and-what-can-we-do-better&quot;&gt;Question 5: How do we come together as a community and what can we do better?&lt;/h3&gt;

&lt;ol&gt;
  &lt;li&gt;We need to NOT duplicate work and effectively communicate better as a community&lt;/li&gt;
  &lt;li&gt;Make lightning more user and developer friendly (basically everyone there was a HUGE lightning supporter)&lt;/li&gt;
  &lt;li&gt;Party, pop some bottles, and celebrate Segwit&lt;/li&gt;
  &lt;li&gt;Scaling and developing beyond the blockchain, aka layer one (and not just lightning)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;random-tangent-1-segwit-and-scripting&quot;&gt;Random Tangent 1: Segwit and Scripting?&lt;/h3&gt;

&lt;p&gt;Segwit allows for more script versioning meaning more complex codes can be put on the Bitcoin protocol. Some of these include:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Complex contracts (vault, covenant)&lt;/li&gt;
  &lt;li&gt;Time locks (smart contracts)&lt;/li&gt;
  &lt;li&gt;Witness programs (GO STEEM!!!!)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Segwit also allows for new contracting languages and the implementation of sidechains. Sidechains are huge because with sidechains and script versioning you can do any change you want without a hard fork.&lt;/p&gt;

&lt;p&gt;At this point in the discussion, the panel went into a description of the lightning network. Here it got a little technical. The lightning network is not Turning complete, meaning it basically cannot loop. The people on the panel viewed this as a good thing. Basically, the computational challenge with turning complete systems (the halting problem) is you CANNOT REASON the expense of a program because you cannot predict the outcome. Thus you have problems such as those seen on Ethereum (Ethereum supports Turning complete languages).&lt;/p&gt;

&lt;h3 id=&quot;random-tangent-2-why-ethereum-sucks&quot;&gt;Random Tangent 2: Why Ethereum sucks…&lt;/h3&gt;

&lt;p&gt;Inevitably, the time came to Shit on Ethereum. Basically, the panel concluded that Ethereum is way worse with its scaling issues. Also Ethereym has very few full nodes validating the network and at the end of 2018, it will be at 1TB!&lt;/p&gt;

&lt;p&gt;Post Discussion Questions&lt;/p&gt;

&lt;p&gt;There were many, but these are the best ones.&lt;/p&gt;

&lt;p&gt;As developer, how can I help ecosystem?&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Help get better documentation out there&lt;/li&gt;
  &lt;li&gt;Lead outreach events&lt;/li&gt;
  &lt;li&gt;Recruit more developers&lt;/li&gt;
  &lt;li&gt;Once Bitcoin evolves into more layers, other can get involved without dealing with blockchain&lt;/li&gt;
  &lt;li&gt;Help develop LAPPS - lightning network apps&lt;/li&gt;
  &lt;li&gt;Find an open source mentor on a project you are building; seek individual who can guide you to find a place to contribute&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Why is Bitcoin the best?&lt;/p&gt;

&lt;p&gt;According to the panel, Bitcoin is the best because:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;It has the best developers&lt;/li&gt;
  &lt;li&gt;It is the most scalable&lt;/li&gt;
  &lt;li&gt;It has established the desired network effect&lt;/li&gt;
  &lt;li&gt;It is about to really explode with all this extra utility&lt;/li&gt;
  &lt;li&gt;It has the best memes&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;As someone biased towards DPOS (Delegated Proof of Stake - think Steem, Peerplays, EOS, Bitshares) systems, I am a little weary of Bitcoin. However, the optimistic vibe radiating from the panel and throughout the room of 150 people was contagious. It is hard not to be excited about the future of Bitcoin and the future of cryptocurrency as a whole. I still believe there is a second mover advantage in this space, and the coin that is able to solve Bitcoin’s problems AND find a killer application for this technology will ultimately be the most successful. No matter how optimistic people seem to be, I am still not convinced that a platform that has grown so large can really make the changes it needs without disrupting a majority of its users.&lt;/p&gt;

&lt;p&gt;Either way, this was an incredible experience, and I am itching to see how it will all play out. Even though I am not currently invested in Bitcoin, I am interested in the tech debates and curious to see how this will effect the many, many altcoins… and now that ICO tokens are illegal securities, EVERYTHING just got more interesting.&lt;/p&gt;

&lt;p&gt;Anyway, I hope this helps some people! I will begin attending these meetups more regularly this Fall since I will be living in San Fransisco.&lt;/p&gt;

&lt;p&gt;Cheers and Steem on!&lt;/p&gt;
</description>
          <pubDate>2017-06-03T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/Bitcoin-Forking-Meetup-Notes</link>
          <guid isPermaLink="true">https://robdurst.com/Bitcoin-Forking-Meetup-Notes</guid>
        </item>
      
    
      
        <item>
          <title>Trezor Unpackaging and Review</title>
          <description>&lt;h1 id=&quot;finally-received-my-white-trezor-in-the-mail-today&quot;&gt;Finally Received My White Trezor in the Mail Today!&lt;/h1&gt;

&lt;h2 id=&quot;the-trezor&quot;&gt;The Trezor&lt;/h2&gt;

&lt;p&gt;This is my first hardware wallet, so I was unsure what to expect. Here is a picture of the package front:&lt;/p&gt;

&lt;p&gt;And of course a picture of the package back:
&lt;img src=&quot;https://steemitimages.com/p/3W72119s5BjWPGGUiZ9pqnZoj8JHYxCCp9dtn2QVegWRYvkzX5uzribNdkWLiTmhr8XdUokxAd8MNmGttJPP7KXhKrv6Wdz1YEVVmF5XhbyncmcyFxXZBc?format=match&amp;amp;mode=fit&amp;amp;width=640&quot; alt=&quot;Trezor&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The package was surprisnghly hard to open. While there were seals, taking the seals off did not make the package any easier to open. However, once I opened the package, I found:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The Trezor&lt;/li&gt;
  &lt;li&gt;The USB cable to connect the Trezor to a computer&lt;/li&gt;
  &lt;li&gt;A keyring for easy holding of the Trezor&lt;/li&gt;
  &lt;li&gt;Two recovery seed key papers (to be filled out once the Trezor was set up)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So, I booted up my computer and headed over to Trezor’s website. Once I plugged in my wallet, the firmware began to install (it does not come with firmware, forcing the user to install the most up to date version). Then, I began the actual setup process:&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Create a pin. The pin creation process was actually very cool. You create a pin using the standard nine digit, 3x3 square pin pad. However, the pin numbers do not show up on the computer screen – you use the pin numbers from the Trezor’s filled in pin pad and hit the matching space on the pin pad on the computer. This way, the Trezor may create a random pin pad each time, but you keep the same pin passphrase. Thus, if a hacker were to get your pin combination from the computer, they would not be able to get into your Trezor without seeing the corresponding numbers from your one-time pin pad. Having just taken cryptography, I think this is REALLY cool. It is essentially an implementation of the one-time pad. The one-time pad is a cryptographic encryption technique where two people use the same one time encryption key to send a message. This one time encryption key changes every time. Trezor has essentially created a pseudo-one-time pad with their pin pad passphrase.&lt;/li&gt;
  &lt;li&gt;Write down recover seed. Once you have set the pin passphrase, you then will see 24 words come up in a very specific order. The Trezor goes through the words twice. This is how you can recover your Trezor if you lose the pin passphrase.&lt;/li&gt;
  &lt;li&gt;Send some money to your new wallet! Since I had liquidated 40 STEEM I sent $35 worth to my new wallet!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/DQmcnkkmPun7LZjMDVSdinW8rQShahqgWmNYPt5kvgk4rMi/Screen%20Shot%202017-05-19%20at%203.43.04%20PM.png&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After exploring the Trezor software some, I also noticed they support a few other coins as well.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/p/2dk2RRM2dZ8gbkvz1yNBypLpwUHBnasMpK1zSCzdDQBdFAazsHggfAMChR2SXuaTtWnSBW4vmKc6iHNpjRneAvD7iTPP7iahufi6fL9K9sFXc7s1ZGXH5NwLb3M1mDovnzerobHWZtjBDVJxgHVzSHg1DFWqWyXnD9SWBLXGeA?format=match&amp;amp;mode=fit&amp;amp;width=640&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;p&gt;And here is my Trezor with some of the swag it came with.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/DQmUi5FNacoZkwokQZGBPyN55NSusZwC5fUJhoKrwxKNbeA/IMG_0930.JPG&quot; alt=&quot;&quot; /&gt;&lt;/p&gt;

&lt;h2 id=&quot;first-impression&quot;&gt;First Impression&lt;/h2&gt;

&lt;p&gt;My first impressions were very positive. The packaging was simple, yet had everything I thought should be included (although for the less intuitive techy, there were no instructions so if your first intuition was not to go to Trezor.io, or plug in the Trezor you may be confused on how to begin). The setup was very fast and easy. The Trezor itself is simple, yet complete – as advertised on the website. From setup to money transfer, it took maybe 10 minutes. So far, highly recommend!&lt;/p&gt;

&lt;p&gt;Note: Not endorsed by Trezor, simply a happy customer.&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;
</description>
          <pubDate>2017-05-21T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/Trezor-Unpackaging</link>
          <guid isPermaLink="true">https://robdurst.com/Trezor-Unpackaging</guid>
        </item>
      
    
      
        <item>
          <title>Blind Digitial Signature Voting Scheme (Non-technical Explanation)</title>
          <description>&lt;h1 id=&quot;the-non-technical-guide-for-the-average-reader-and-less-tech-savvy-cryptocurrency-enthusiast&quot;&gt;The Non-Technical Guide for the Average Reader and Less Tech-Savvy Cryptocurrency Enthusiast&lt;/h1&gt;

&lt;h3 id=&quot;the-problem&quot;&gt;The Problem:&lt;/h3&gt;
&lt;p&gt;Yesterday I wrote an article about my implementation of a blind digital signature voting scheme… however I got too technical. I used some scary math terms like “pick a unit of a field modulo p.” Yuck!&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/p/9RTqgzgfVW71fTRU48c6M6Rd8ejgArirceC32AzYpkJzRYCFVBqGsBMSAvDT2Rh8rDzVhCqS6H?format=match&amp;amp;mode=fit&quot; alt=&quot;aint no one got time for that&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;the-solution&quot;&gt;The Solution:&lt;/h3&gt;
&lt;p&gt;This article is in response to that article, which may be found here. The GOAL of this article is to inform the more casual reader about blind digital signatures. I will split this article into three parts:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Digital Signatures
The Zero Knowledge Proof
Blind Signatures and Voting
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;digital-signatures&quot;&gt;Digital Signatures&lt;/h2&gt;

&lt;p&gt;Nearly everyday people are asked to sign documents.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/p/x7L2VSNEiyAB5Ux7nxRBkJQRxwLWUTqtpGJuMZSt3kitoJ5Tm56FrZ7SPCnfF2AfE2WfX3qiEetG6i1?format=match&amp;amp;mode=fit&quot; alt=&quot;signature gif&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This signature is a way of verifying the authenticity of a document; it gives a person a receipt that verifies a transaction was valid or a document authorized/official.&lt;/p&gt;

&lt;p&gt;In the 21st century, we deal with digital documents, digital receipts, digital messages, and digital transactions. How can we verify/authenticate these things in the same way we do for physical things? The answer is digital signatures. A digital signature is essentially a mathematical scheme for verifying/authenticating data. A digital signature addresses three things:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Authenticates the identity of the sender
    a) Every sender will produce a unique mathematical signature
    b) Thus, a signature may be tied to a user&apos;s identity so it is possible to prove I sent data to you
Forbids the sender from denying having sent the data
    a) As a consequence of the first bullet point, it is possible to prove someone sent data
    b) Therefore, I cannot deny that I sent data to you
Verifies the data was not tampered with
    a) Signatures rely on (and are mathematically generated by) the actual data
    b) Therefore if the data is tampered with, the signature will not verify
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This system is based on public key cryptography. In public key cryptography, people use public keys to encrypt data and send it to the user of the public key. The user will then use their private key to decrypt the data. While everyone knows the user’s public key, they don’t know the user’s private key. Thus, only the user can decrypt messages sent to himself/herself.&lt;/p&gt;

&lt;p&gt;Digital signatures are sort of a reverse of this system. Users sign documents using their private key and these documents are “tied” to the user’s public key; to verify a document, the verifier uses the public key of the signer, the signature, and the document.&lt;/p&gt;

&lt;p&gt;Here is a high level diagram of the digital signature process:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/DQmSCNXq5ET3PmxS7czRgi6Nhm2DqDX2sHY4mQKPreQSUHa/Screen%20Shot%202017-04-26%20at%2010.11.14%20AM.png&quot; alt=&quot;signature diagram&quot; /&gt;&lt;/p&gt;

&lt;p&gt;The Zero Knowledge Proof&lt;/p&gt;

&lt;p&gt;Before we jump into blind signatures, which are simply an application of digital signatures, let’s explore the idea of a zero knowledge proof. A zero knowledge proof is: a way for person A to prove to person B they know something without revealing the information they know. Here is the most classic example:&lt;/p&gt;

&lt;p&gt;We have Alice in a purple shirt and Bob in a green shirt. Alice wants to prove to Bob that she knows the password to a secret door in a cave. Alice proposes that instead of giving the password to Bob for him to try out himself, she prove to him that she knows the password. Bob agrees and they both go to the cave. Alice proposes that if she can always appear out of the cave from the path Bob calls out, she must know the password to the door in the cave. So, she and Bob devise a plan. Alice will venture randomly down either path A or path B. Once Alice is down that path, Bob will stand at the entrance and then call out a path. If Alice knows the password to the secret door, she will be able to appear from either path no matter which path she starts down.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;Alice randomly selects either path A or path B.
&lt;img src=&quot;https://steemitimages.com/p/23KQwnti57su7HZA5xrZrYQY4ZmwmqQtUPDSTh1dFN8Zf9wUbHnoQxPwdXSP96NwWUGgFsq6Y1BRn6HV7PTEr15B2AdCxHt?format=match&amp;amp;mode=fit&amp;amp;width=640&quot; alt=&quot;part 1&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Once Alice has entered the cave, Bob enters the cave. He calls out either A or B. In this case he called out A and Alice started down path B.
&lt;img src=&quot;https://steemitimages.com/p/23KQwnti57su7HZA5xrZrYQY4ZmwmqQtUPDSTh1dFN8Zf9wUbHnoQxPwdXSP96NwWTzwDXC8P1gqjp6tYEwuZbXSsWmrPfk?format=match&amp;amp;mode=fit&amp;amp;width=640&quot; alt=&quot;part 2&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;Alice, returns down the path Bob has called out. They repeat many times. If Alice knows the password, she will always be able to return down the path Bob calls out; if Bob calls the path Alice starts from, Alice must simply turn around and if Bob calls out the path Alice does not start down, Alice will simply complete the loop by opening the secret door.
&lt;img src=&quot;https://steemitimages.com/p/23KQwnti57su7HZA5xrZrYQY4ZmwmqQtUPDSTh1dFN8Zf9wUbHnoQxPwdXSP96NwWTTT8f8XEMBAH4nTLWuFZD92u8qg8wx?format=match&amp;amp;mode=fit&amp;amp;width=640&quot; alt=&quot;part 3&quot; /&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;blind-signatures-and-voting&quot;&gt;Blind Signatures and Voting&lt;/h2&gt;

&lt;p&gt;In a paper by David Chaum, he outlined an application of digital signatures called blind signatures. Basically, in certain cases, people may need an authoritative figure to authenticate or verify some data, however the person may not want that authoritative figure to know the data.&lt;/p&gt;

&lt;p&gt;The best example is a secret election. It goes like this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Problem:&lt;/strong&gt; A trustee wants to hold a secret election. The electors cannot meet and will have to send in their votes. However, they value privacy and want their votes to be verifiable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Blind Signature Voting Scheme.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;An elector casts their ballot, puts the ballot in a carbon envelope, and puts that envelope in a plain envelope with a return address.
&lt;img src=&quot;https://steemitimages.com/DQmdzqH9HrWmTA6YF7j33vCqhz57hz9SwL2PmkHM4rHWvXp/Screen%20Shot%202017-04-26%20at%2010.29.29%20AM.png&quot; alt=&quot;part 1&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;The trustee receives the envelope, opens the envelope, verifies the person is eligible to vote, signs the carbon envelope, puts that envelope in a plain envelope with a return address and sends that envelope back to the elector.
&lt;img src=&quot;https://steemitimages.com/p/8DAuGnTQCLpunQuGfHnXTmxWbRQScCVGspXNWFwLnb6mKKuFXo3yDP1gwGJSmykngwZ8ymXeP33Y8xEG1BjY8EieGpWn8ekKyv26UkvaqcxG2TqY86kdvqRq1Dbcv5r16NqfQ8qSh1P4hxcmY71b6NPCkcr72zqAr7SmUZioq66?format=match&amp;amp;mode=fit&amp;amp;width=640&quot; alt=&quot;part 2&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;The elector receives the envelope, opens the envelope, opens the carbon envelope, verifies the signature on the ballot, puts the ballot in a plain, unmarked envelope, and sends the envelope to the trustee.
&lt;img src=&quot;https://steemitimages.com/DQmT9cunUQn5iBFf7j52agfSG3G1r9Djw39ZrEzynTRdds3/Screen%20Shot%202017-04-26%20at%2010.29.57%20AM.png&quot; alt=&quot;part 3&quot; /&gt;&lt;/li&gt;
  &lt;li&gt;The trustee receives the envelope, opens it, and has a verifiable ballot from an anonymous source.
&lt;em&gt;Part 4 image lost :(&lt;/em&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is the voting scheme I implemented and discussed in my last post. I hope this less technical approach makes more sense!&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Hope this article is easier to follow @pitterpatter @steemitqa @spartanza.&lt;/p&gt;

&lt;p&gt;If you have any questions please ask below!&lt;/p&gt;

&lt;p&gt;To answer @spartanza:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Does this use, or can it use a digital asset residing on a Blockchain as an identifier or the representation for the digital signature?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For Bitcoin, identification is done via wallet address. Each wallet address is a series of characters that is generated from a user’s public key. Attached to this public key is a private key. Thus, the user can digitally sign transactions from their wallet with their private key. In most attacks/hacks on cryptocurrencies, people trust their private keys to third parties and these third parties are hacked. Thus, the hacker gets the private keys of wallets and can use these keys to send verifiable transactions from the hacked wallets to themselves.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Can it work with a Blockchain?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Yep! It works with Bitcoin, other cryptocurrencies, and MANY other applications (one being voting).&lt;/p&gt;

&lt;h2 id=&quot;bibliography&quot;&gt;Bibliography:&lt;/h2&gt;

&lt;p&gt;Zero Knowledge Proof Example:
http://pages.cs.wisc.edu/~mkowalcz/628.pdf&lt;/p&gt;

&lt;p&gt;Zero Knowledge Proof Images:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;CC BY 2.5, https://commons.wikimedia.org/w/index.php?curid=313643&lt;/li&gt;
  &lt;li&gt;CC BY 2.5, https://commons.wikimedia.org/w/index.php?curid=313645&lt;/li&gt;
  &lt;li&gt;CC BY 2.5, https://commons.wikimedia.org/w/index.php?curid=313648&lt;/li&gt;
&lt;/ul&gt;
</description>
          <pubDate>2017-04-13T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/Non-Technical-Blind-Digital-Signature-Voting-Scheme</link>
          <guid isPermaLink="true">https://robdurst.com/Non-Technical-Blind-Digital-Signature-Voting-Scheme</guid>
        </item>
      
    
      
        <item>
          <title>Blind Digitial Signature Voting Scheme</title>
          <description>&lt;h2 id=&quot;basic-implementation-of-a-blind-digital-signature-voting-scheme-in-python-using-rsa&quot;&gt;Basic implementation of a Blind Digital Signature Voting Scheme in Python using RSA&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;https://steemitimages.com/p/5CEvyaWxjaEsVUnNGyqbkS7pRBtq76DUohca25kDEK9zduSRqoj5q8gxdDtHmYQgk4gQCQQvtX5vxqZbb?format=match&amp;amp;mode=fit&quot; alt=&quot;dancing cat&quot; /&gt;&lt;/p&gt;

&lt;p&gt;You may be wonder, “What the hell is a blind digital signature voting scheme?”
Well, let’s break it down into pieces. This is essentially RSA + digital signatures + blind signatures + voting. We will look at this step by step!&lt;/p&gt;

&lt;h3 id=&quot;rsa&quot;&gt;RSA&lt;/h3&gt;

&lt;p&gt;RSA is a public key cryptosystem. Essentially, Alice comunicates with Bob by taking Bob’s public key and encrypting a message with that key. Then Alice sends the encrypted message to Bob. Bob receives the ciphertext (encrypted message) and uses his private key to decrypt the message. Then Bob can read the message. This is secure because only Bob can read the message from Alice because only he has the private key to decrypt the message. EX) Think of your mailbox. Anyone can put mail in your mailbox, but only you have the key to open it. From a technical standpoint, this works as so:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Key Generation:
    Pick two large primes. Lets call those two primes p and q.
    Calculate:
        a) n = (p)(q)
        b) phi(n) = (q-1)(p-1)
        c) e = (relative prime of the units of phi(n)) * Higher Level Math Term *
        d) d = modular inverse of e * Higher Level Math Term *
    public key = (n,e) and private key = (n,d)
Encryption
    Receive Bob&apos;s public key (n,e)
    Choose m, message
    Encrypt message --&amp;gt; m^e = C
    Send C to Bob
Decryption
    Receive message C
    Remember private key (n,d)
    Decrypt message --&amp;gt; C^d = m
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;digital-signatures&quot;&gt;Digital Signatures&lt;/h3&gt;

&lt;p&gt;Digital signatures work sort of like real world signatures. Whenever you sign a receipt, you are verifying that you agree with the purchase and you are using your credit card; essentially you are “confirming” your identity. Confirming is in quotes because this system is archaic and not reliable. Digital signatures are essentially a mathematical signature that cannot be replicated (at least not easily).&lt;/p&gt;

&lt;p&gt;As with RSA, digital signatures use public and private keys. Say I want to send a bitcoin to Bob, well, Bob would want some way of verifying that I in fact agreed to that transaction (everyone likes free money, but Bob doesn’t want me claiming later I was cheated). Well, I can digitally sign the transaction. Essentially, in the Bitcoin world, people are identified by pseudo-anonymous addresses that are random characters. For each address, the owner of the wallet owns a private key. Through math, the only one who may create messages or send transactions from a wallet is the one who possesses the private key associated with that address.&lt;/p&gt;

&lt;p&gt;Blind Signatures and Voting Scheme (with RSA)&lt;/p&gt;

&lt;p&gt;Consider now a system where someone needs something verified but doesn’t want the signing party to know the data they are signing off on; the best example is at a voting center. While a voter needs an election official to confirm their voting eligibility and authorize their vote, they don’t necessarily want the official to know who they voted for. Thus we have blind signatures. Here is a technical implementation of a blind signature scheme (using RSA), as outlined by David Chaum in this paper:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Signing Authority Creates Public and Private Information:
    a) Generates random p and q
    b) Computes n=pq and phi(n)=(p-1)(n-1)
    c) Picks e such that e is a relative prime in the field of units modulo phi(n) * Higher Level Math Term *
    d) Computes d, where d is the inverse of e modulo phi(n) * Higher Level Math Term *
    e) Publishes to PUBLIC: (n,e)
Voter Prepares Ballot for Signing by Signing Authority:
    a) Generates random r such that 1&amp;lt;r&amp;lt;p
    b) Chooses favorite candidate, option, etc. on ballot
    c) Creates message: m = candidate + r
    d) Generates f such that f is a relative prime in the field of units modulo n * Higher Level Math Term *
    e) Computes g, where g is the inverse of f modulo phi(n) * Higher Level Math Term *
    f) Computes blinded message (disguises his message): m&apos; = m*f^e mod n (where n and e are public knowledge)
    g) Sends m&apos; to signing authority
Signing Authority Authorizes Ballot
    a) Signing authority receives m&apos;
    b) Signing authority verifies voter is eligible to vote
    c) If voter is eligible, signing authority signs ballot: s&apos; = (m&apos;)^d (where d is the secret exponent of the signing authority)
    d) Sends s&apos; back to voter
Voter Unwraps Blinding of Ballot
    a) Receives s&apos;
    b) Computes s = (s&apos;)(g)
    c) Sends the signature s in to the ballot receiving location
Ballot Received, Verified, and Counted
    a) Compute:
        1) ballot = s^e
        2) signature = s
        3) verification (true or false) --&amp;gt; Use ballot, signature, (public e, aka public key of the signing authority)
    4) vote = ballot - random-extra (predetermined length of random-extra makes easy to subtract)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;So I really hope all that made sense! If you have any questions please ask below! If there are any small mistakes, SORRY, it has been a long day.&lt;/p&gt;

&lt;p&gt;If you want to try this out for yourself, I uploaded the code to my GitHub: https://github.com/robertDurst/BlindVoting&lt;/p&gt;

&lt;p&gt;To run the code:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;1. Download
2. Download necessary modules (I think you just need websocket)
3. Open two terminals
4. Terminal 1: python web_app.py --&amp;gt; The result window of the polling
5. Terminal 2: python electionPoll.py --&amp;gt; The polling window
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Again, comments, questions, love, accepted below!&lt;/p&gt;

&lt;p&gt;Cheers!&lt;/p&gt;
</description>
          <pubDate>2017-04-12T05:19:21-07:00</pubDate>
          <link>https://robdurst.com/Blind-Digital-Signature-Voting-Scheme</link>
          <guid isPermaLink="true">https://robdurst.com/Blind-Digital-Signature-Voting-Scheme</guid>
        </item>
      
    
  </channel>
</rss>
