<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mike Solomon on Medium]]></title>
        <description><![CDATA[Stories by Mike Solomon on Medium]]></description>
        <link>https://medium.com/@michael.solomon?source=rss-d90aca1008b7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ye9kqy7bTGoURFIpr3fzfg.png</url>
            <title>Stories by Mike Solomon on Medium</title>
            <link>https://medium.com/@michael.solomon?source=rss-d90aca1008b7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 19:54:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@michael.solomon/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Transcription of Benjamin Netanyahu’s Resignation Speech]]></title>
            <link>https://medium.com/@michael.solomon/a-transcription-of-benjamin-netanyahus-resignation-speech-7a97a35f2089?source=rss-d90aca1008b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a97a35f2089</guid>
            <category><![CDATA[israel]]></category>
            <category><![CDATA[palestine]]></category>
            <dc:creator><![CDATA[Mike Solomon]]></dc:creator>
            <pubDate>Sat, 11 Nov 2023 18:53:49 GMT</pubDate>
            <atom:updated>2023-11-12T18:31:16.381Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Wt0MxGr0y4dxtd-ALCtqQ.jpeg" /></figure><blockquote>On October 8, 2023, the day after Hamas and Palestinian Islamic Jihad unleashed a surprise attack against Israel, Benjamin Netanyahu resigned as the country’s Prime Minister. The following is an English-language translation of the speech that accompanied his formal resignation.</blockquote><p>Citizens of Israel,</p><p>Yesterday, our young, beautiful nation was attacked in a barbaric and vile manner by bands of armed thugs that indiscriminately killed, maimed, and captured Israeli soldiers and civilians. The depravity of their actions and the cruelty with which they delighted in others’ suffering will leave a permanent scar not just on our nation, but on the world. Even now, small terrorist cells remain embedded in our border towns and kibbutzim, and our defence forces are working tirelessly to eliminate them. It is a moment that calls for radical and swift action, which is why I am speaking to you today.</p><p>Over the course of nearly twenty years, you have entrusted me and my government with the task of protecting you against exactly this form of indiscriminate hatred — a moral cancer that has robbed many Jews of their childhood, and against which our nation has served as an enduring bulwark. In this sense, we have all failed you. And as the ultimate responsibility for this failure lies with me, I cannot with good conscience be the one that leads you towards the just and equitable outcome that you deserve. It is therefore with great sadness coupled with a clear sense of duty that I have tendered my resignation to President Herzog, effective immediately.</p><p>When the Knesset reconvenes, our President will nominate one of my colleagues to form a new government. My hope is that he or she will focus on four critical tasks — the return of our hostages, the uplifting of those whose lives were shattered by this tragedy, the security of our borders, and the urgent formation of a Palestinian state.</p><p>The most important mission for our new Prime Minister will be the repatriation of those who have been taken hostage by Hamas and Palestinian Islamic Jihad. If recent history is any lesson, the process will take time, so an equally vital goal will be providing comfort to the families of those who are detained. They have been plunged into a state of unimaginable grief, and they must know at all times that they are seen — that their suffering is our suffering.</p><p>Those who have attacked us are small, and they will only get smaller in the days ahead. As we mourn, and as the world mourns with us, the entirety of our attention will turn to the captives, not their captors. We categorically refuse to gift Hamas the war that they desperately desire. And every day that we are not baited into belligerence, Hamas will get a little smaller. Their death sentence will not be inflicted by Israel, but by their own people, who will renounce their wicked acts in disgust as they come to understand the horrors committed in their name. Hamas will become irrelevant, at which point, their hostages will turn from a perceived asset into their greatest liability. Detaining innocent citizens of forty nations in a labyrinth of tunnels will rob Hamas of sun, fresh air, the embrace of their mothers and children, and belonging to a civil society that has forgotten them as it works towards a durable peace. This is a world I never could achieve as your Prime Minister — in hindsight, my actions to bolster Hamas were among the gravest errors a leader could have committed. But a new leader with fresh ideas can achieve this in a matter of months, if not weeks. And at that moment, you will know again the warm touch and radiant smile of your loved ones.</p><p>The second goal of our new Prime Minister must be healing the wounds of those who have suffered. The first step is to spare them the indignity of being led and comforted by those who are partly to blame for their torment, which will be facilitated by my departure and that of other ministers. After this will begin the eternal process of remembering, honoring, and making vows that lies at the heart of all Jewish tragedies. From our repeated exiles to catastrophic loss of life to forced conversions and assimilations, our history of tragedy has bestowed upon us a set of rituals and responsibilities with which we elevate the bereaved. We must sit shiva, bury our dead, mark their Yahrzeit, and erect monuments across the land.</p><p>Unlike other tragedies that have befallen us, this one was filmed for the world to see in realtime. It will invariably pose new challenges, as families will forever be a few clicks away from reliving the worst moments of their lives. But this new technology will also act as a ledger in the annals of history, defending us against those who seek to negate our pain and falsify our past. Before it is too late, we must extensively document and collect every piece of evidence connected to this tragedy. Families’ dignity will be restored not only by our Jewish traditions — it will be reaffirmed by courts of law and by each successive generation as it confronts irrefutable proof of these grave atrocities. Remembering has always been our collective responsibility, and the families of those who have fallen can find a modicum of comfort in knowing that they will occupy a permanent place in the rich tapestry of our shared heritage.</p><p>Your next Prime Minister must not allow agents like Hamas to become stronger, as I foolishly did in my bad-faith attempt to sabotage the process of Palestinian statehood. Instead, your security must become your leaders’ primary responsibility going forward.</p><p>Unity is a precondition for this security. We cannot look after one another if we are busy yelling at and fighting each other. While we will always have political disagreements, we must never again let ourselves be torn apart by the acrimony that consumed our society in the summer of 2023. Regardless of the perceived wisdom of a proposed reform, it can never be made at the expense of Jewish unity.</p><p>I have no doubt that our people can quickly and efficiently achieve an impenetrable security apparatus, with multiple redundant levels of observation and protection, both digital and human. Hamas will no longer have the logistical and military resources to attack us, nor will Hezbollah. The biggest danger to this security will not come from outside — rather, it will be our desire to avenge yesterday’s gruesome attack through war. While I have no doubt our defence forces can eradicate Hamas, it is clear from our short history as a nation that war often produces a more formidable enemy than the one we defeat. And no war will obviate the need for robust border security — it will simply require more expensive and vigilant security against a defeated, humiliated and angry neighbor. My hope is that our next leaders will avoid the strategic nightmare that hides behind the veneer of war, no matter how legitimate or righteous it may seem.</p><p>Lastly, I hope that our next Prime Minister understands the tactical need for the creation of a Palestinian state. While the process may seem daunting and distant, I believe that with diplomacy and cooperation, we can achieve this ambitious goal in an astonishingly fast timeframe.</p><p>A group of terrorist neighbors that engages in indiscriminate attacks against civilians is our problem. A nation that does this is the world’s problem. Bringing our hostages home and securing our borders will be significantly easier if it is pursued through the organs of international justice and mediation to which nation-states are held responsible. I have no illusions that some Palestinian factions will fight against this, enjoying the benefits of ambiguity and plausible deniability that act as a smokescreen for their homicidal aspirations. I also recognize that the strong anti-Jewish sentiment coursing through Palestinian education and institutions will not disappear as a result of statehood. These are all obstacles and risks, but the truth is, at our current juncture, all paths forward are fraught with risk. We must soberly endorse the risks that best align with our national mission of family reunification and unassailable security.</p><p>Palestinian statehood will also give us the most important security of all: security of the mind. The question of our Indigenousness to this land will be settled once and for all, as will the the Right of Return to a Palestinian State instead of the physical homes from which Palestinian families were expelled 80 years ago. These are certainly compromises that Palestinians will not like, and we too will be forced to make difficult concessions regarding our settlements in the West Bank, but the result of these concessions will be a sense of resolution, closure and safety for displaced families as they return to their homes.</p><p>Lastly, if there is one word I want to impart on you as I concede this role to those who are better equipped to face the immense challenges confronting our people, it is <em>joy</em>. Today is Simchat Torah — a holiday on which it’s a mitzvah to feel and exude the bright, radiant joy of internal warmth, even in situations of incomparable grief and suffering. Our people often contrasts this joy to that of Purim: a holiday that represents the manic, frenzied joy of upheaval and war. Purim’s joy is a Godless joy — indeed, the name of God does not appear once in the story of Purim. It is also an inversion of normal circumstances, represented by the disguises worn in the story as well as the costumes we wear to celebrate. We simulate Purim’s joy together so that we do not feel the need to create it, or inflict it on others, outside of our community. Hamas has no such intelligence. In their videos, we recognize their joy as the tragically misplaced, transient joy of Purim. It is an unstable, unsustainable joy upon which no lasting sentiment of victory can reside and that quickly gives way to fear. The joy I wish upon my successor and my Jewish people is that of Simchat Torah. For those who hold me in contempt for the present situation, I know you will find joy in my departure. And to those of you who have supported me, I hope you find the greatest joy of all — the joy of knowing that your champion valued the security and prosperity of the Jewish state above all else, including potentially his own personal liberty. Today, on Simchat Torah, perhaps the only joy we can feel is that of hope. Next year, may it be of hope fulfilled. <em>Am Yisrael Chai</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a97a35f2089" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Dissenting Critical Opinion about Tears of the Kingdom]]></title>
            <link>https://medium.com/@michael.solomon/a-dissenting-critical-opinion-about-tears-of-the-kingdom-9d9759de56d?source=rss-d90aca1008b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d9759de56d</guid>
            <category><![CDATA[zelda]]></category>
            <category><![CDATA[tears-of-the-kingdom]]></category>
            <category><![CDATA[video-game-review]]></category>
            <dc:creator><![CDATA[Mike Solomon]]></dc:creator>
            <pubDate>Mon, 29 May 2023 17:16:36 GMT</pubDate>
            <atom:updated>2023-05-30T06:46:27.394Z</atom:updated>
            <content:encoded><![CDATA[<p>Tears of the Kingdom, the latest instalment in the storied Zelda series, has no shortage of quests, monsters, characters, and puzzles. It also has no shortage of accolades.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F_-2rpZs1ZhE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D_-2rpZs1ZhE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F_-2rpZs1ZhE%2Fhqdefault.jpg&amp;key=d04bfffea46d4aeda930ec88cc64b87c&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/45f0183699c3dc175ae49e4f14099a24/href">https://medium.com/media/45f0183699c3dc175ae49e4f14099a24/href</a></iframe><p>While I enjoyed playing the game, I was surprised that the critical community was not more divided about it. There’s a lot to praise, but there are also some flaws that, in my opinion, make it considerably less satisfying than its record-shattering predecessor <strong>Breath of the Wild</strong>.</p><p>In this article, I’d like to offer a few criticisms of the game that left me mildly irked for most of my experience and, at certain junctures, fantasizing about a completely different game than the one in front of me. I’ll then discuss the critical consensus around the game and try to unpack what this universal acclaim means about the Zelda arc and the overall video game industry.</p><h3>A Flawed World</h3><p>[mild spoiler alert] After a breathtaking opening sequence, we learn that Link and Zelda’s explorations have unintentionally awaked the Demon King Ganondorf and caused the <em>Upheaval</em>, an event that — in addition to bringing about Zelda’s disappearance and Link’s unconsciousness — caused the appearance of several islands in the sky, caves, shrines, and fissures leading to a subterranean landscape as vast as Hyrule itself. In addition, the upheaval has caused strange phenomena in the same four regions of Hyrule that featured prominently in Breath of the Wild.</p><p>From this point onwards, an experience remarkably similar to Breath of the Wild unfolds — we investigate the four regions, make our way through four dungeon-like areas to vanquish four bosses, and finally battle the biggest and baddest boss at Hyrule castle. Link is equipped with various new “builder” powers (I’ll talk about these later) that make puzzle solving more fun and engaging, but the overall form is the same. This is not problematic in-and-of-itself — a good sequel can certainly retain and build upon its predecessor. But here, the lack of a sufficiently-different Hyrule made me feel like I was playing a heavily-modded version of Breath of the Wild.</p><p>In BotW, after the initial tutorial that was rich in new and exciting abilities like magnesis and concepts like shrines were introduced as part of an overarching story linked to a 100-year-old calamity whose scars still marred Hyrule, you obtain a paraglider and cast off into the vast unknown. In every direction, you see near-infinite nuance, and you realize that the game will lead you on a quest to discover these regions as you build up the strength, arsenal, and support to defeat Calamity Ganon. Exploration was a constant process of exaltation, and my family enjoyed hours of gameplay as we explored every nook and cranny of this vast landscape.</p><p>In TotK, looking at the same landscape pockmarked with sky islands, I had a feeling of “not this again.” Nothing about the landscape was compellingly different enough to make me want to retrod my paths from BotW, and the sky islands, while beautiful, did not occupy enough of the gameplay to make up for the lack of novelty on the ground.</p><p>This is the “irked” feeling I alluded to above — as I was playing, I often felt like I was just getting from point A to point B as quickly as possible. The occasional side quest or goofy village feud did not sustain me for the long haul. The shrines, while generally more enjoyable than BotW, only reinforced the “more of the same” vibe.</p><p>Where I found myself pulling out my hair, however, was at certain key moments where I felt that Nintendo missed opportunities for revolutionary and bold choices in the gameplay and story. Here you have an “upheaval” where islands and chasms appear out of nowhere to supplement a mostly-unchanged Hyrule. Instead, I found myself imagining and longing for a version of TotK where Hyrule was literally upheaved — where the floating islands were carved out of the landscape itself, resulting in deep gashes and an otherwise mutilated landscape.</p><p>As I piloted Link through a familiar Hyrule, I imagined (for example) half of Hataneo Village being thrust into the sky and needing to come up with a mechanism to communicate, Death Mountain elevated and perhaps even rotated 180-degrees, Gerudo Village plunged deep into a cavern out of which a sky island was born, etc. As for the shrines, a scarred Hyrulean landscape could have given birth to an entirely different mythology and form of gameplay. As the upheaval was initiated by a violent confrontation between Link and the corpse of Ganondorf, one can imagine Link’s essence being scattered throughout the upheaved Hyrule as a result of this moment. Then, Link’s increasing heart and stamina count could have been tied to a series of geographic puzzles where Link finds his shattered self and, in the process, incrementally restores Hyrule to its pre-upheaval state. A system like this would have made Link’s new powers even more essential, as they would have been used in the process of rebuilding Hyrule. Instead, most of my building in the game felt like tinkering, while fun in the same way that Minecraft is, did not give me the sense of puzzle-solving joy that I’ve come to expect in the Zelda series.</p><p>An upheaval of Hyrule into an ancient, stratified state would have also allowed for a much richer and more nuanced narrative around the idea of time and the birth of Hyrule. Here too, I found myself imagining an arrogant Rauru wanting to keep sky separate from earth, thereby creating a sense of envy that turned Ganondorf into a monster. In recognition of his hubris and as an act of sacrifice, Rauru’s imprisoning of Ganon could have caused a catacylsm that made the sky crash into the earth, forming Hyrule and annihilating the Zonai world that Rauru fought hard to preserve. The awakening of Ganon would then give rise to a plausible reason for this process to be reversed. Instead, the narrative in TotK feels a bit flat: its most poignant moments come later in the game and revolve around Zelda, which is nice, but the majority of it feels hollow.</p><p>I’m not an avid gamer, but the ones I like tend to have core gameplay loops that, while simple, give rise to hours of joy. I get the sense that the core loop in TotK is supposed to be building and manipulating things, and perhaps some players found enough richness here. However, for me, and it pains me to say it, there was no core loop. There was a checklist of things that I dutifully accomplished to finish the game. A gorgeous game, for sure, but not a transformative one. I found myself longing for a broken, shattered Hyrule that would have made Link’s building powers fill this role of a core loop.</p><h3>The critics agree — but not with me</h3><p>About halfway into my Zelda journey, I Googled around for reviews of TotK, expecting to see mixed reviews that pointed to this sense of déjà vu and emptiness at the core of the game. Instead, I found the most uniformly laudatory critical consensus I’ve ever seen for anything. Even my local newspaper wrote a three page, 5-star review — something it’s never done for any video game in spite of the fact that Finland likely produces more high-quality video games per capita than any country on earth.</p><p>Digging into these reviews, I found myself agreeing with most of them. Yes the world is beautiful, yes the new powers are awesome, yes the silly side quests are really fun, etc. But the sum of these things did not add up to “one of the greatest video games of all time”, as metro.co.uk wrote. For me, it sits comfortably as a middle-of-the-road Zelda game. Meaning that it is good. Not great, not bad, just good. 3.5 or 4 stars max. I enjoyed BotW, Ocarina of Time, and Wind Waker all more than TotK.</p><p>So what’s with all the praise? To be clear, Nintendo put out a stunning AAA game, and coordinating tens of thousands of work hours to produce something this dense and rich is a colossal accomplishment. Many of the critics picked up on exactly this, and they also noted how bold Nintendo was for taking the risk of setting this Zelda in the same world as the previous one. However, for these critics, the risk paid off: it led to a gameplay experience that, as one review put it, made BotW feel like a “first draft.” For me, on the other hand, this risk was precisely the thing Nintendo did not lean into enough: it felt like they were incrementally tweaking and improving prior art rather than using Hyrule’s sameness as a point of departure for an entirely different journey.</p><p>So, as a devoted Zelda fan that has followed the series since its inception, I felt the 10/10 score did not do the project justice, let alone nearly 100 of these ratings. This left me with the same cynical impression I developed when collaborating on certain large art installations in France: when something is too big to fail, it is possible to subconsciously guide a creative work towards a sort risk-averse outcome that will garner praise in a predictable way without making something that is truly transformative in the way that all great art is.</p><p>In spite of this impression, I have no doubts about the bright future of the silent knight and the princess of Hyrule: TotK is a good game, and given how strong the fundamental premise of Zelda is (not to mention the nostalgia factor for 40-somethings like me), I’m sure that Nintendo will continue releasing great Zelda games for decades to come. If anything, I’m sad that a game that had such a long incubation did not innovate enough at its core to give birth to an unforgettable, once-in-a-decade gameplay experience in spite of the fact that this felt entirely within reach.</p><p>What I’m much less optimistic about is the critical apparatus around video games. I have trouble understanding why more critics were not critical of TotK, and I sincerely hope it is a fluke and not part of a broader trend to reward safe bets because they contain certain praiseworthy qualities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3N1gji76UhU1Dbct_khWww.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d9759de56d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Extension types in TypeScript]]></title>
            <link>https://medium.com/pleasework/extension-types-in-typescript-6b083fb83f15?source=rss-d90aca1008b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b083fb83f15</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Mike Solomon]]></dc:creator>
            <pubDate>Fri, 20 Sep 2019 07:39:36 GMT</pubDate>
            <atom:updated>2019-09-20T07:39:36.813Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_6hrxuqtPb0W9TBjFS0OUg.png" /></figure><p>When creating a TypeScript library, you will invariably run into a scenario where someone wants to extend it. In JavaScript land, they can do this with the following simple hack.</p><pre>const yourLibrary = require(&#39;your-library&#39;);<br>const myExtension = require(&#39;./my-extension&#39;);<br>yourLibrary.yourObject.myExtension = myExtension</pre><p>In TypeScript, this type of thing is generally frowned upon because the type system will not (easily) allow monkey patching. The “classic” workaround is using a cast to the any type, which effectively de-TypeScript-ifies TypeScript.</p><pre>import { yourObject } from &#39;your-library&#39;;<br>import myExtension from &#39;my-extension&#39;;<br>(&lt;any&gt;yourObject).myExtension = myExtension</pre><p>The other problem with this pattern is that it myExtension is not referenceable on yourObject, which requires a cast on every access as well.</p><pre>const result = (&lt;any&gt;yourObject).myExtension.myFunction();</pre><p>At this point, we have lost the type-safety of myExtension. So the TypeScript compiler will no longer check that myFunction actually exists on myExtension, let alone what the result of myFunction() is. Too much of this pattern will render your TypeScript project un-typeable, at which point JavaScript would have been a better option.</p><h3>What to do?</h3><p>One solution is just to make a pull request to the original library to have your extension incorporated into its official package. While this may be a good idea in some scenarios, in most cases extensions are too niche, too broken or too big to be merged into a project. On top of that, pull requests often take a long time to go through review and incorporation into a new release.</p><p>Another solution, which is what this article advocates, is building libraries with type-safe extensions as first-class citizens. I realize that this won’t solve your problem here-and-now, but if you are a library author, it will give other developers an easy way to extend your work without necessarily touching the core package. If you are a consumer of a library, a pull-request giving it extensional properties is usually a much easier ask than extending the library with <em>your</em> specific feature.</p><h3>Two types of extensions</h3><p>The most common types of extensions developers need are <em>intersection extensions</em> and <em>union extensions</em>. Intersection extensions say “Hey, your objects are awesome, but they would be even <em>more </em>awesome if they did thing X.” Union extensions say “Hey, your objects are awesome, but you’re missing a few that I’d need for scenario Y.” Intersections and unions are part of TypeScript’s core language — the intersection &amp; and union | operator are a basic way to build composite types. What I’m advocating is leveraging these operators to supercharge your libraries with extensionality.</p><h4>Intersection extensions</h4><p>Intersection extensions can be achieved with a generic type (let’s call it U) that is passed down through your objects and intersected with primitive objects via the &amp; operator.</p><p>Let’s imagine that your library contains the following two types.</p><pre>type Person = {<br>  name: string;<br>  address?: Address;<br>  friends?: Person[];<br>}<br>type Address = {<br>  city: string;<br>  country: string;<br>}</pre><p>Intersection extensions add an intersection to all relevant types.</p><pre>type Person&lt;U&gt; = {<br>  name: string;<br>  address?: Address&lt;U&gt;;<br>  friends?: Person&lt;U&gt;[];<br>} &amp; U;<br>type Address&lt;U&gt; = {<br>  city: string;<br>  country: string;<br>} &amp; U;</pre><p>For example, if we want to add an optional id to all types, it becomes a simple operation.</p><pre>const me: Person&lt;{id?: number}&gt; = {<br>  name: &#39;Mike&#39;,<br>  address: {<br>    id: 5,<br>    city: &#39;Helsinki&#39;,<br>    country: &#39;Finland&#39;<br>  },<br>  friends: [{ name: &#39;Marie&#39;, id: 101 }]<br>}</pre><p>Even better, we now have a type-safe accessor for id, so the following function will pass the TypeScript compiler</p><pre>const hasId = (p: Person&lt;{id?: number}&gt;) =&gt; typeof p.id === &#39;number&#39;;</pre><h4>Union extensions</h4><p>Let’s imagine a different scenario — we are creating types for JSON objects.</p><pre>type JSONPrimitive = number | boolean | string | null;<br>type JSONValue = JSONPrimitive | JSONArray | JSONObject;<br>type JSONObject = { [k: string]: JSONValue; };<br>interface JSONArray extends Array&lt;JSONValue&gt; {}</pre><p>Let’s say that we would like JavaScript Date objects to also be admitted as JSON. Union extensions, which I’ll represent with the letter T, give us a clean way to do this.</p><pre>type JSONPrimitive&lt;T&gt; = number | boolean | string | null | T;<br>type JSONValue&lt;T&gt; = JSONPrimitive&lt;T&gt; | JSONArray&lt;T&gt; | JSONObject&lt;T&gt;;<br>type JSONObject&lt;T&gt; = { [k: string]: JSONValue&lt;T&gt;; };<br>interface JSONArray&lt;T&gt; extends Array&lt;JSONValue&lt;T&gt;&gt; {}</pre><p>Now, we can put Date objects all over our JSON and the TypeScript compiler will not complain.</p><pre>const jsonWithDates: JSONValue&lt;Date&gt; = {<br>  foo: 1,<br>  bar: new Date(),<br>  baz: [true, &#39;hello&#39;, 42, new Date()]<br>}</pre><h4>Runtime validation</h4><p>If you are using a runtime type validator like <a href="https://github.com/gcanti/io-ts">io-ts</a>, the patterns are quite similar. For intersections, we can use the intersection function from io-ts.</p><pre>import * as t from &#39;io-ts&#39;;<br>const PersonValidator = &lt;U&gt;(u: t.TypeOf&lt;U, U&gt;) = t.recursion(<br>  &#39;Person&#39;,<br>  t.intersection([<br>    t.type({name: t.string}),<br>    t.partial({<br>      address: AddressValidator(u),<br>      friends: t.array(PersonValidator(u))<br>    }),<br>    u<br>]));<br>const AddressValidator = &lt;U&gt;(u: t.TypeOf&lt;U, U&gt;) = <br>  t.intersection([<br>    t.type({city: t.string, country: t.string}),<br>    u    <br>  ]);</pre><p>The same type of pattern can be used for union types — just pass the a validator to t.union instead of t.intersection where needed.</p><h3>Show me the code!</h3><p>This is the strategy I used to build <a href="https://github.com/unmock/json-schema-strictly-typed">json-schema-strictly-typed</a>, which creates a typed version of JSON Schema that is extensible with both intersection and union extensions. This way, people can add arbitrary extensions to objects in the Schema (intersection) <em>and</em> arbitrary new Schema primitives (union).</p><p>From this level of generic-ness (genericity?, generickitude?), it is easy to export helper objects for “base” cases. The base case of an intersection extension is simply a type from which all your objects already extend. In the example above, Person&lt;{}&gt; and Address&lt;{}&gt; would be this, as intersecting with {} is a no-op. For union types, a default extension could be extending the library with a type that already exists in the union. So, for example, JSONSchemaValue&lt;string&gt; is a no-op.</p><p>I’m looking forward to seeing if this pattern catches on and if the community can come up with tools that help maintain and author TypeScript libraries with extensibility in mind!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b083fb83f15" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pleasework/extension-types-in-typescript-6b083fb83f15">Extension types in TypeScript</a> was originally published in <a href="https://medium.com/pleasework">pleasework</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Attending your own workshop]]></title>
            <link>https://medium.com/pleasework/attending-your-own-workshop-3eb44dc52bfe?source=rss-d90aca1008b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/3eb44dc52bfe</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[workshop]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Mike Solomon]]></dc:creator>
            <pubDate>Fri, 20 Sep 2019 07:35:48 GMT</pubDate>
            <atom:updated>2019-09-20T07:35:48.774Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mYTrRah3TEx2FMf6U4M6_g.png" /></figure><p>What’s better than running a workshop? A workshop running you! This is exactly what I did at <a href="https://github.com/unmock/unmock-odessa-saturday">OdessaJS</a> this year.</p><p>The workshop format comes from years of workshops not panning out because there are always problems — projector not working, people know more than me and get bored, people don’t have the requisite skill set, unclear examples, etc. To remedy this, I started with the basic premise of “let’s build a GitHub repo, from scratch, that is populated (almost) exclusively by attendees’ <a href="https://help.github.com/en/articles/about-pull-requests">pull requests</a>.” That way, I don’t need an HDMI cable because the workshop lives in the attendees screens and unfolds in real-time. In thirty minutes, the workshop runs itself, and the workshop runner (me) sets the cadence, becomes a glorified pointer to the <a href="https://www.unmock.io/">documentation</a>, and makes coffee runs. Lastly, because the workshop is plugged into CircleCI, people can build multiple branches without hogging CPU. The PRs and build artifacts act as an audit log of everyone’s efforts, which usually gives hints on how to fix broken code.</p><p>So without further ado, let’s unpack my unmock workshop, step-by-step with timestamps, so that you see how the sausage is made.</p><h4>11AM — Pleasantries, short introductions</h4><h4>11:05AM — Create the <a href="https://www.github.com/unmock/unmock-odessa-saturday">GitHub repo</a></h4><p>Pass around your computer to get everyone to sign up. If they don’t have a GitHub account, ask them to create one. If they won’t create one then you’re SoL, but I haven’t run into this yet.</p><h4>11:10AM — First pull requests to <a href="https://github.com/unmock/unmock-odessa-saturday/pull/1">README.md</a></h4><p>Have everyone make a <a href="https://github.com/unmock/unmock-odessa-saturday/pull/3">pull request to README.md</a>. Merge them as they come in and help people sort out their own merge conflicts. This way, people who are uncomfortable with the git flow can get help from other attendees. This is the only place that I saw some more advanced students getting bored, and I asked them to help set up <a href="https://github.com/unmock/unmock-odessa-saturday/pull/4">.gitignore</a>, TypeScript, package.json, Jest and various other tidbits so that we could hit the ground running.</p><h4>11:14AM — Set up <a href="https://circleci.com/gh/unmock/unmock-odessa-saturday">CircleCI</a></h4><p>Get automatic builds going immediately, and populate the repo with a <a href="https://github.com/unmock/unmock-odessa-saturday/pull/13">minimum viable CircleCI config file</a>. About half the crowd has no clue it is this easy to run automated tests on your code. There is at least one person who tears up thinking about the amount of time they’ve wasted not using a tool like CircleCI. Comfort them and move on.</p><h4>11:18AM — Write your first tests</h4><p>At this point, we want to get people writing tests. Not because we are evangelizing <a href="https://en.wikipedia.org/wiki/Test-driven_development">test-driven development</a>, nor because we are teaching them to use <a href="https://www.unmock.io/">unmock</a> (well, ok, kinda because of that), but because tests provide a spec for how people think through their work and show people’s expectations for success and failure, which makes collaboration easier.</p><p>For example, <a href="https://github.com/OlehBuriaOSF">OlehBuriaOSF</a> authored a <a href="https://github.com/unmock/unmock-odessa-saturday/pull/11">PR</a> with the following test:</p><pre>test(&quot;string + number = string&quot;, () =&gt; {<br>  expect(&quot;2&quot; + 3).toBe(&quot;23&quot;);                                      <br>});</pre><p>While perhaps not revealing that much about the predilections, aspirations and fears of OlehBuriaOSF, we know that he expects a string plus a number to be a string in JavaScript. You’d be amazed how many people are comforted by seeing the way other people write tests. It assures them that writing tests is not hard, that it’s ok to write silly tests, and that tests really do help communication.</p><h4>11:30AM — Write your first functions to test</h4><p>A more realistic scenario is that a person writes a test for a function. For example, <a href="https://github.com/kl2karpenko">kl2karpenko</a> wrote a lovely pow function (power to Lily!), imported it into her test and <a href="https://github.com/unmock/unmock-odessa-saturday/pull/21">tested it</a>.</p><h4>11:40AM — Failing a test</h4><p>This is the secret sauce — <a href="https://circleci.com/gh/unmock/unmock-odessa-saturday/36">ask everyone to write an intentionally bad bit of code that whatever you are teaching will fix</a>. This is not that hard, as most libraries or packages fix something that’s broken in the development process. In this case, because we are teaching unmock, which is all about mocking APIs, we ask them to call a real API. Predictably, builds for this sort of thing will fail for a variety of reasons — 404 unauthorized errors, rate limits, etc. If you’re lucky, you may even hit a real API and do something fun like move money between two banks! But usually this doesn’t happen.</p><h4>11:55AM — Passing the test using unmock</h4><p>Once everyone has felt the pain, help them ease their way out if it by introducing the meat of what you’re there to teach. In this case, unmock saves the day by helping them write a spec for their API and using that spec to automatically mock the API, which means their tests pass. The <a href="https://github.com/unmock/unmock-odessa-saturday/pull/34">pull requests don’t lie</a> — the students get it. Horrah!</p><h3>Never run a workshop again</h3><p>Using this method, your workshops will become delightful collaborative experiences where people rarely get bored and everyone verifiably learns the thing you set out to do. And unless you are creating a quantum computer, you can probably build it all from scratch during the workshop. Actually, <a href="https://spookyactionbook.com/category/diyquantum/">even DIY quantum computing is possible</a>. I look forward to any and all feedback about this workshop format, and thanks for taking the time to check it out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3eb44dc52bfe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pleasework/attending-your-own-workshop-3eb44dc52bfe">Attending your own workshop</a> was originally published in <a href="https://medium.com/pleasework">pleasework</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optics in TypeScript]]></title>
            <link>https://medium.com/pleasework/optics-in-typescript-c1a190fb3963?source=rss-d90aca1008b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1a190fb3963</guid>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[optics]]></category>
            <dc:creator><![CDATA[Mike Solomon]]></dc:creator>
            <pubDate>Fri, 20 Sep 2019 07:33:28 GMT</pubDate>
            <atom:updated>2019-09-20T07:33:28.721Z</atom:updated>
            <content:encoded><![CDATA[<h4>tl;dr Use monocle-ts</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vOafDIxbKNsnHF1gvXbQAw.png" /></figure><p>When one of my team members shared <a href="https://medium.com/javascript-scene/lenses-b85976cb0534">this Medium story</a> about lenses, I thought it would be great to do a nice, lightweight exercise in optics (the category to which lenses belong) that my team could get behind. So, I rewrote the entire code base to use optics and submitted it as a giant pull request. So much for best intentions. But I did learn a lot about optics, as did my team, and I would like to share my learnings here. By the end of the article, you should know <em>why</em> one would use optics, <em>what </em>optics are and <em>how </em>to use them.</p><h3>Why optics</h3><p>Let’s look at a really basic operation: changing the first letter of each string in an array of strings to &quot;F&quot; and returning the first string from the array. Here is my first attempt.</p><pre>const string withF = (s: string[]): string =&gt;<br>  s.map(i =&gt; &quot;F&quot;+i.slice(1))[0];</pre><p>This code has two major flaws: we are not guaranteed that the strings will be of non-zero length, and we are not sure that the array will be of non-zero length. We could remedy this with the following.</p><pre>const string withF = (s: string[]): string | undefined =&gt;<br>  s.length &gt; 0 ? s.map(<br>    i =&gt; i.length &gt; 0 ? &quot;F&quot;+i.slice(1) : undefined<br>  )[0] : undefined;</pre><p>While this works, it is unreadable. We have diluted the intention of our code in a sea of conditionals and undefined.</p><p>Optics give you three big advantages compared to the hot mess above:</p><ul><li>They are readable.</li><li>They allow you to focus on each step of a complex operation in isolation, which helps eliminate bugs.</li><li>They create composable bits of logic that can be combined into powerful abstractions.</li></ul><p>As a basic rule of thumb, any time you are <em>getting</em> a property of an object that may be undefined, which includes anything in a Record, Array, or string, use optics. Also, if you are creating a new object from an old one, use optics. So, basically, use optics all the time.</p><h3>What are Optics</h3><p>You can think of lenses as ways to focus on different parts of an object and either get those parts or create a new object with those parts changed. While there are lots of different optics, I would like to discuss four. If you master these four, everything else is either a combination thereof or some exotic wizardry that falls outside of average use cases.</p><h4>Lens</h4><p>The most ubiquitous optic is called a lens. It is a simple zoom operation. Let’s see it in action, using monocle-ts as our optics library of choice.</p><pre>import { Lens } from &quot;monocle-ts&quot;;</pre><pre>type Person = {<br>  name: string;<br>  hobbies?: string[];<br>}</pre><pre>const nameLens = new Lens&lt;Person, string&gt;(<br>  person =&gt; person.name,<br>  name =&gt; person =&gt; ({ ...person, name }) )<br>);</pre><pre>const newPerson = nameLens.modify(_ =&gt; &quot;Jane&quot;)({ name: &quot;Steve&quot; });<br>newPerson.name // &quot;Jane&quot;</pre><p>In general, the syntax for a Lens is:</p><pre>&lt;TopLevel, ThingToFocusOn&gt;(<br>  getter: (a: TopLevel) =&gt; ThingToFocusOn,<br>  setter: (a: ThingToFocusOn) =&gt; (b: TopLevel) =&gt; TopLevel<br>)</pre><p>Because lenses are often used to zoom in on the field of an object, monocle-ts provides us with the Lens.fromProp method that simplifies the above definition. In this case, we’d use the following.</p><pre>import { Lens } from &quot;monocle-ts&quot;;</pre><pre>type Person = {<br>  name: string;<br>  hobbies: string[];<br>}</pre><pre>const nameLens = Lens.fromProp&lt;Person&gt;()(&quot;name&quot;);</pre><h4>Iso</h4><p>Next up is Iso, which changes something to something else in a lossless manner. That is, you need to preserve all of the information from the original object for Iso to work correctly.</p><pre>import { Iso } from &quot;monocle-ts&quot;;</pre><pre>type Person = {<br>  name: string;<br>  hobbies?: string[];<br>}</pre><pre>type Coder = Person &amp; { languages?: string[]; }</pre><pre>const personToCoder = new Iso&lt;Person, Coder&gt;(<br>  person =&gt; person,<br>  coder =&gt; { { languages, ...rest } = coder; return rest; }<br>);</pre><pre>const newCoder = personToCoder.modify(_ =&gt; _)({ name: &quot;Steve&quot; });<br>newCoder.name // &quot;Steve&quot;</pre><p>In general, the syntax for an Iso is:</p><pre>&lt;ThingA, ThingB&gt;(<br>  get: (a: ThingA) =&gt; ThingB,<br>  reverseGet: (b: ThingB) =&gt; ThingA<br>)</pre><p>In my experience, I’ve found that the main use of Iso is to convert between data structures to then do further processing. For example, sometimes it is easier to work with arrays instead of objects, in which case an object-to-array Iso helps.</p><pre>const objectToArray = &lt;A, B&gt;() new Iso&lt;Record&lt;A,B&gt;, Array&lt;[A,B]&gt;&gt;(<br>  obj =&gt; Object.entries(obj),<br>  arr = arr.reduce((a, b) =&gt; ({ ...a, [b[0]]: b[1] }), {})<br>);</pre><p>You have to be careful here that you know how your object behaves. For example, if we use the Iso above and then map all of the entries’ keys to the same entity of type A, we will lose all of the values but one of type B, which breaks the Iso promise. So, while an Iso is a helpful converter, make sure that it is a lossless converter or, alternatively, that you can accept whatever loss may come along with it!</p><h4>Traversal</h4><p>Traversal operates on objects that can be iterated over in a definite order, like arrays. Unlike the other objects we’ve explored, the signature for a traversal constructor is quite complicated. Essentially, it takes an applicative functor that is applied to all the elements of a collection. Thankfully, we do not have to write these functors: we can just used several useful prefabricated traversals.</p><p>For example, monocle-ts has a fromTraversable function that allows you to easily build a Traversal from something implementing the Traversable interface in fp-ts. One common Traversable is array. So,</p><pre>import { fromTraversable } from &quot;monocle-ts&quot;;<br>import { array } from &quot;fp-ts/lib/Array&quot;;</pre><pre>const arrayTraversal = fromTraversable(array)();<br>arrayTraversal.modify(i =&gt; i + 1)([1, 2, 3]); // [2, 3, 4]</pre><h4>Prism</h4><p>The last optic to grok is Prism, which takes an object and returns none if the object does not correspond to some criteria or some(obj) if the object does correspond. Here, none and some are part of the Option class from fp-ts, but any optional type (ie string | undefined) will do. The “classic” way to use prisms is to discriminate between types in a union (think variants in ReasonML, union types in TypeScript, etc). But you can use it to apply any criteria to any object and determine of the object fulfills or rejects that criteria.</p><pre>const undefinedPrism= &lt;A&gt;() new Prism&lt;A | undefined&gt;(<br>  myUnion =&gt; myUnion === undefined ? none : some(myUnion),<br>  myA =&gt; myA<br>);</pre><p>In general, the signature for a Prism takes two functions: one that does the discriminating, and one that passes in a valid value and yields the original value. The latter is usually the identity function. If it is not, consider composing your Prism with an Iso.</p><pre>&lt;A&gt;(<br>  get: (a: A) =&gt; Option&lt;A&gt;,<br>  reverseGet: (a: A) =&gt; A<br>);</pre><h4>Summary</h4><p>The four optics we see above can be thought of roughly with the following equivalents:</p><ul><li>Lens = Accessor (ie a.b)</li><li>Iso = Map (ie f(a))</li><li>Traversal = Iterator (ie a.map)</li><li>Prism = Filter (ie a === b)</li></ul><p>From these four objects, we can combine really powerful optics that dig deep into structures and modify them or yield their parts. For example, monocle-ts offers an Optional optic, which is a Lens + a Prism, that you’ll want to use whenever a field in an object may be undefined.</p><h3>How to use optics</h3><p>The best way to learn how to use optics is to study a repository that uses them. For example, we created <a href="https://github.com/unmock/unmock-js/blob/dev/packages/openapi-refinements/src/index.ts">openapi-refinements</a> to make it easier to get and set parts of an OpenAPI schema. I hope you find them useful — they make for less errors and more readable code!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1a190fb3963" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pleasework/optics-in-typescript-c1a190fb3963">Optics in TypeScript</a> was originally published in <a href="https://medium.com/pleasework">pleasework</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introducing Wall]]></title>
            <link>https://medium.com/pleasework/introducing-wall-fbe06e2c724b?source=rss-d90aca1008b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbe06e2c724b</guid>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[scheme]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[haskell]]></category>
            <category><![CDATA[lisp]]></category>
            <dc:creator><![CDATA[Mike Solomon]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 08:21:27 GMT</pubDate>
            <atom:updated>2019-08-14T08:21:27.648Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*msE6rFFYItA5KDdpscJ0zA.png" /></figure><blockquote>tl;dr <a href="https://wall-lang.netlify.com/">Wall</a> doesn’t exist, help me build it.</blockquote><p>Ever since my first piece of code returned an error, which is the first thing that happened when I ran my first piece of code, I have been fascinated with errors. <a href="https://docs.python.org/3/library/exceptions.html#ZeroDivisionError">Division by zero</a>. undefined is not an object. <a href="https://docs.oracle.com/javase/7/docs/api/java/lang/IndexOutOfBoundsException.html">Index Out of Bounds Exception</a>. Maximum call stack size exceeded. I’ve seen them all, and while I harbor a certain affection for them, I would like if I experienced slightly less of them in my day-to-day work. In general, I’m cool with errors that stop me from doing stupid things, like forgetting to close parentheses, but it’s the errors that pop up once the software is running that really get on my nerves.</p><p>Recently, I had some time off from work to decompress, and while most people probably would use time like this go to Majorca or binge-watch Stranger Things, I wrote documentation for a non-existent programming language called <a href="https://wall-lang.netlify.com/">Wall</a>.</p><p>I decided to sketch out Wall because I am tired of shit breaking all the time, especially when working with files, SQL databases and REST APIs. So I consider this an investment in my future vacations — if fewer stuff breaks, then I will have more time to go to Majorca and binge-watch Stranger Things. Hopefully, work on Wall will result in a full-featured programming language that finally nails the imminently solvable, billion-dollar error handling problem that has plagued software development since mankind witnessed the first out-of-memory error.</p><h3>What is Wall?</h3><p>Wall is a dialect of Lisp that strives for Zero Runtime Errors™. It is the coding equivalent of bumper bowling with bumpers that converge inwards toward the middle pin and a lane that has a slight downward slope. It has some sweet syntactic sugar to avoid monstrosities like (+ 1 (+ 2 (+ 3 (+ 4 (+ 5 6))))) and, in the spirit of Lisp, it is purely functional.</p><p>Wall’s killer feature is the validation of function invocation at compile time. So if f is a function and x is an input to that function, then compilation will fail if x is not guaranteed to be in the domain of f. To build up to this feature, I will explore four notions in Wall: sets, functions, validators and rules. Along the way, you’ll see lots of other nifty bits of Wall that are more thoroughly explained in its <a href="https://wall-lang.netlify.com/">documentation</a>.</p><h3>Sets</h3><p><a href="https://wall-lang.netlify.com/sets-1.html">Sets</a> in Wall are defined using :[] notation, so :[1 2 &#39;foo] is a set containing 1, 2, and the string &#39;foo. Sets can be finite or infinite: Wall ships with several <a href="https://wall-lang.netlify.com/sets-2.html">infinite sets</a> including the set of all integers called int, the set of all sets called set, and the set of every possible Wall value called everything. In this way, sets in Wall are kind of like types.</p><h3>Functions</h3><p>In Wall, there are no Objects. There are no Maps. There are no Classes. There are no Interfaces. There are just <a href="https://wall-lang.netlify.com/functions-1.html">Functions</a>.</p><pre>// a function that maps 1 to 2 and 3 to 4<br>f = { 1 2 3 4 }<br>f 1 // result is 2</pre><p>Like in Haskell, functions can only take one argument, just like maps or objects can only ever take one key or accessor. Functions can be defined on a finite domain (like above) or on an infinite domain using a variety of <a href="https://wall-lang.netlify.com/functions-2.html">pre-defined functions</a>. <a href="https://wall-lang.netlify.com/functions-3.html">fmap</a>, for example, is a function that takes a set s, a function m, and returns a function mapping elements of set s to values obtained by applying m to each element of s.</p><pre>a = fmap :[1 2] (+ 3)<br>== a { 1 4 2 5 } // true<br>just-42 = fmap everything (just 42)<br>just-42 &#39;foo // result is 42<br>// a function that maps everything but the number 0 to itself<br>identity-0 = fmap (s-e everything 0) identity<br>identity-0 1 // result is 1<br>identity-0 0 // compilation error because 0 is not in the domain</pre><p>In the example above, s-e subtracts an element from a set, so identity-0 is defined on every possible value in Wall <em>except </em>0. just is a function that returns whatever is passed to it.</p><p>Using fmap makes working with dependent types a piece of cake. In languages like TypeScript and Haskell, it is really hard to specify a function signature that accepts only positive integers and throws a compile-time error if this is not the case. In Wall, it is trivial.</p><pre>valid-ages = filt int (&lt; 0)<br>make-one-year-older = fmap valid-ages (+ 1)<br>make-one-year-older 5 // 6<br>make-one-year-older -1 // compilation error</pre><h3>Validators</h3><p>A <a href="https://wall-lang.netlify.com/validation-1.html#validators">validator</a> is a special type of function in Wall that maps everything to either true or false.</p><pre>ill-accept-anything = fmap everything (just true)<br>heck-no = fmap everything (just false)</pre><p>Validators can be used with the <a href="https://wall-lang.netlify.com/functions-4.html">fun</a> function to compose function domains that would be tedious to define via operations on sets. In this way, they resemble “normal” function definitions.</p><pre>add-ints = fun [int? int?] (a0 + a1)</pre><p>The a0 and a1 above come from a bit of syntactic sugar, but they correspond to the arguments int? and int?.</p><p>Wall ships with hundreds of predefined validators that allow for some pretty snazzy compile-time verification.</p><pre>person? = object? {<br>  name&#39; string?<br>  (maybe? age&#39;) int?<br>  (starts-with? &#39;x-) string?<br>}<br>say-hello = fun [person?] (++ &quot;Hello &quot; a0)<br>say-hello { &#39;name &#39;Mike } // &quot;Hello Mike&quot;<br>say-hello { &#39;name &#39;Mike &#39;age 36 } // &quot;Hello Mike&quot;<br>say-hello { &#39;name &#39;Mike &#39;age 36 &#39;x-likes &#39;reading } // &quot;Hello Mike&quot;<br>say-hello { &#39;name &#39;Mike &#39;last-name &#39;Solomon } // compile error</pre><p>Above, the function object? constructs a validator from key-value pairs of required and optional arguments, including pattern validators like starts-with?. In most languages, it is impossible to specify hybrid objects like this that behave like a class with fields <em>and</em> a map whose strings have specific properties. In Wall, this is easy, and it allows for creating compile-time validators for things like OpenAPI and JSON Schema.</p><p>Furthermore, Wall keeps an internal record of what functions have been applied to what values. This allows it to determine if unknowns, like a string returned from an API call, have been sufficiently validated to be consumed by functions.</p><h3>Rules</h3><p>Of course, a binary yes/no validation is useful in some cases, but in a lot of scenarios, it is more desirable to modify values on the fly. For example, if we receive a string with whitespace that is supposed to be a username, we probably do not want to reject the string entirely, but rather trim the whitespace and use the trimmed value. To accomplish this, Wall has a function <a href="https://wall-lang.netlify.com/validation-3.html">rules</a> that acts on input to validate it and, if necessary, transform it.</p><pre>username-rule = rules [string? [has-whitespace? remove-whitespace]]<br>hello-user = def [username-rule] ++ &quot;Hello: &quot; a0<br>hello-user &quot;  Amy &quot; // &quot;Hello Amy&quot;<br>hello-user 5 // compilation error</pre><h3>Other cool stuff in Wall</h3><p>Wall has some pretty jazzy features, including:</p><ul><li><a href="https://wall-lang.netlify.com/sugar-2.html#string-constants">pattern matching</a> using functions;</li><li><a href="https://wall-lang.netlify.com/sugar-1.html#ampersand">local scopes</a> for any syntactic construct;</li><li><a href="https://wall-lang.netlify.com/tests.html">co-located unit tests and code</a></li></ul><p>…and a <a href="https://wall-lang.netlify.com/musings.html">whole lot more</a>. I would absolutely love any and all feedback on the language design so far, and if you are courageous enough to look at implementation sketches, the <a href="https://github.com/mikesol/wall/tree/wall">Wall branch</a> has an embryonic parser and input validator.</p><h3>What’s in a name</h3><p>Wall is named after Larry Wall, the inventor of the Perl programming language. While I have never met Larry, I have always loved Perl for its bold vision and quirky idiosyncrasies. I still use perl for most of my one-liners, Larry’s quotable quips are staples in my personal lexicon, and I think Larry’s answer to the question “<a href="https://www.youtube.com/watch?v=LR8fQiskYII">What are 5 programming languages everyone should know?</a>” should be required watching for the 21st century.</p><p>Of course, “wall” is also a noun. It is unfortunate that, with so much discussion in the air about building walls to separate people, we don’t talk enough about how walls unite people. Walls like the wailing wall, the Vietnam War memorial, and any awesome piece of street art, bring people together to think, meditate, remember and be astounded. Wall’s goal is similar: by composing together a bunch of small bricks, I hope it turns into an object of wonder, enlightenment and community for years to come.</p><p>Interested in contributing to Wall? Even if it&#39;s just an idea, head on over to the <a href="https://www.github.com/mikesol/wall">GitHub</a> repo and make your presence known!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbe06e2c724b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pleasework/introducing-wall-fbe06e2c724b">Introducing Wall</a> was originally published in <a href="https://medium.com/pleasework">pleasework</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Kotlin tests and user stories.]]></title>
            <link>https://medium.com/pleasework/kotlin-tests-and-user-stories-89ae09380430?source=rss-d90aca1008b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/89ae09380430</guid>
            <category><![CDATA[robots]]></category>
            <category><![CDATA[process-automation]]></category>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[Mike Solomon]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 08:13:55 GMT</pubDate>
            <atom:updated>2019-08-14T08:13:55.389Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bIeI9MWVGtzQw8dO0MoLcQ.png" /></figure><p>I love stories. I love tests. And I really love tests that read like stories.</p><p>My journey into the poetic world of writing tests like stories starts with a talk by Jake Wharton about <a href="https://jakewharton.com/testing-robots/">robot testing</a>. Wharton argues that tests should read like instructions to a robot on how to use your app. The benefits of his approach go beyond the human-readability of a testing spec. Writing hybrid story/tests enforces a form of rigor that forces one to take a step back and think about how one truly wants users to interact with an app. This invariably leads to a cleaner design and less cruft.</p><p>This way of authoring tests has recently become a bit of an obsession. So much so that I have dispensed with functional syntax and begun writing my tests using prose. Think OuLiPo plus Larry Wall.</p><p>“How does the whole thing work?” you may ask. Imagine we were writing a payment app. The code below would constitute a syntactically-valid Kotlin test.</p><pre><br>First sign into your console.<br> Then check your point balance. There should be fifteen points.<br> Then use all of your points to buy a ticket to Guam that costs exactly the number of points you have.<br> Then check your point balance. It should now be zero.<br></pre><p>Kotlin makes the example above possible thanks to the keyword. I have provided below the same example with all of the infix functions needed to create syntactically correct Kotlin.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d4b8257d376a2358ce37cf8d48ba6b63/href">https://medium.com/media/d4b8257d376a2358ce37cf8d48ba6b63/href</a></iframe><p>You see that some functions above contain placeholder comments to verify the various bits of business logic that we are testing. This allows us to decouple the actual functions we are testing from their semantic meaning. It also reduces the ambiguity of intent even though it requires a fair amount of boilerplate. Even the boilerplate can be mitigated to a certain extent by scripts that transform prose into code.</p><p>Robot tests are not the only situations where Kotlin-interpretable prose can prove useful. <a href="https://try.kotlinlang.org/#/UserProjects/uspeu9cmn55b14jn71l3amlea1/r95i21of8ue2oc7aaop4rkp9dl">Medium articles work as well</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=89ae09380430" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pleasework/kotlin-tests-and-user-stories-89ae09380430">Kotlin tests and user stories.</a> was originally published in <a href="https://medium.com/pleasework">pleasework</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Proving stuff about lists]]></title>
            <link>https://medium.com/pleasework/proving-stuff-about-lists-e14d74b7ec9a?source=rss-d90aca1008b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/e14d74b7ec9a</guid>
            <category><![CDATA[logic]]></category>
            <category><![CDATA[theorem-prover]]></category>
            <category><![CDATA[sat-solver]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[lists]]></category>
            <dc:creator><![CDATA[Mike Solomon]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 08:11:34 GMT</pubDate>
            <atom:updated>2019-08-14T08:11:34.412Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XB53C086WPHg2YEc-nwrig.png" /></figure><p>Lists are great! Lists of users, lists of prices, lists of products — the list goes on. Coders use lots of lists. But lists are awfully difficult to test, mostly because there are so many of them! This article explores a novel way to prove properties of lists using Horn clauses. But first, we will discuss why testing lists is so darn hard.</p><h3>Properties and proofs</h3><p>In programming, one way to verify the behavior of functions is <em>property testing</em>, a practice where you repeatedly invoke a function with a bunch of nonsensical values and assert that the function returns something sensible and/or, if needed, triggers the correct side effects. After you’ve done this enough, you can say with reasonable confidence “yup, function X behaves this way with <em>any </em>input.” With booleans, enums, and other finite types, it is pretty easy to do exhaustive checks. Even with integers, you can go pretty far by testing ten-thousand or so alternatives. But with lists, things are different. A list of twenty integers between 0 and 100 has 100²⁰ different possible outcomes. Try testing all of those and you will wait a very, very long time for your tests to complete! That is why <a href="https://github.com/dubzzz/fast-check/blob/master/documentation/1-Guides/Arbitraries.md">fast-check</a> has a default maximum list size of 10 and significantly constrains the scope of a list’s values.</p><p>One alternative to property testing is proving theorems. A theorem is something like “For all integer inputs <em>X</em> to function <em>Y</em>, the output will always be an integer less than <em>Z</em>.” You can then use a theorem prover like <a href="https://github.com/coq/coq">Coq</a> or <a href="https://isabelle.in.tum.de/">Isabelle</a> or <a href="https://github.com/Z3Prover/z3">Z3</a>, to prove or disprove your theory using <a href="https://github.com/coq/coq/wiki/CoqAndAxioms">axioms</a>. So long as people believe your axioms (which tend to be pretty uncontroversial, like “If A=B and A=C then B=C”), they should, in theory, accept your result.</p><p>Of the previous theorem provers mentioned, all of them have certain features that help you prove things automatically, but only Z3 makes automatic proving a first-class citizen. Also, and perhaps not surprisingly, you can’t prove as much automatically in Z3 as you can by guiding Coq or Isabelle to a solution using their assisted proving techniques and/or brute-forcing proofs using reinforcement learning. This is what makes using Z3 to verify real-world programs hard.</p><h3>Proofs involving lists</h3><p><a href="https://rise4fun.com/Z3/tutorial/guide">Z3 </a>is an <a href="https://en.wikipedia.org/wiki/Satisfiability_modulo_theories">SMT solver</a>, which means it is good at proving things using first-order logic and great at proving things using <em>quantifier-free first-order logic. </em>Quantifier-free means that you avoid saying stuff like “For all X, X &gt; 0” (called a universal qualifier) or “There exists a Y such that Y &gt; 0” (called an existential qualifier). SMT solvers shine when you limit yourself to assertions like “X &gt; 0” and “X &lt; 4”, and the SMT solver will determine if there exists a satisfiable outcome to the assertions (in this case, 1, 2 and 3 are all satisfiable outcomes for X). In SMT lingo, a satisfiable set of conditions is called <em>sat </em>whereas an unsatisfiable set of conditions is called <em>unsat</em>. While you can use quantifiers in Z3, they slow down programs significantly if not indefinitely, and in a lot of cases produce <em>unknown, </em>as a result, meaning impossible to determine either <em>sat </em>or <em>unsat</em>.</p><p>One of the most notable restrictions of first-order logic is that it <a href="https://en.wikipedia.org/wiki/First-order_logic">cannot treat functions as inputs to, constants in, or outputs from other functions</a>. While first-order reasoning in Z3 can prove lots of stuff about a function like:</p><pre>const add = (a, b) =&gt; a + b;</pre><p>It would have no clue how to handle:</p><pre>const add = a =&gt; b =&gt; a + b;</pre><p>The first version of add is a function that accepts two arguments and adds them. The second version of add is a function that accepts one argument and produces a function that accepts one argument that then produces the added result. In functional programming land, the second is called currying or partial evaluation. First-order logic can say lots of stuff about the first one but knows nothing about the second one.</p><p>This is a major bummer for lists. There are lots of ways to represent lists, but perhaps the most intuitive one is via a function cons that accepts two arguments — what you are adding to the list and another list. If the token for the empty list is EMPTY, then intuitively, cons 1 EMPTY is the list [1] and cons 1 (cons 2 EMPTY) is the list [1 2]. So, while we can prove stuff about lists with a certain number of elements, we cannot make claims about lists in general because there is no first-order logic function that can accept, act on or return the <em>function </em>cons — they can just accept or produce a given result of cons.</p><h3>Horn clauses</h3><p>I mentioned before that SMT solvers like Z3 struggle with qualifiers, but there is one case where they do exceptionally well: Horn clauses. While the nitty-gritty of Horn clauses is outside the scope of this article, there is a great <a href="https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/nbjorner-yurifest.pdf">article </a>by Nikolaj Bjørner on how Horn clauses use universal qualifiers under the hood to guarantee convex results, meaning that results that converge to a unique “least” model. This guaranteed convergence towards a solution is what allows us to prove stuff about Horn clauses. In this article, suffice it to say that every Horn clause presented will implicitly have a <em>universal qualifier</em> associated with it. So, if f is a function taking two integers and returning a Boolean value, then the Horn clause: RULE(f(m, m+1), m &gt; 100) translates to “<em>For all </em>m, if m is greater than 100 then f(m, m+1) will yield true.” From here on out, we will sometimes leave out the “for all”, but assume it’s always there when we talk about Horn clauses, and again, to see why it’s there, check out this <a href="https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/nbjorner-yurifest.pdf">article</a>.</p><p>Horn clauses come in three flavors: <strong>facts</strong>, <strong>rules</strong>, and <strong>queries</strong>. A <strong>fact</strong> is a statement that is always true. For example, if we had said FACT(f(m, m+1)) , we would have meant that for all m, f(m, m+1) will yield true. In other words, f(1,2), f(3,4), and f(42,43), are all true whereas f(0,0) and f(1,-1) are false. A <strong>rule</strong> is comprised of a statement followed by one or more non-negative statements (meaning statements that never use “not”) that need to hold true for the “head” assertion to hold true. For example, if we define two more functions g and h with the same signature as f, we can write RULE(f(m, q), m &gt; 100, g(m, p), h(p, q), which means “for all m, q and p, if m is greater than 100 and g(m, p) is true and h(p, q), then f(m, q) will be true.” A <strong>query </strong>assumes nothing to be true and simply asks if the statements (again non-negative) are satisfiable based on what we know. For example, if we have established FACT(f(m,n)) then QUERY(f(0,0)) will be satisfiable, because f yields true for any two integers. Again, the advantage of Horn clauses is that well-formulated clauses will rarely if ever yield <em>unknown</em>, which means that if we can formulate a problem as a series of facts and rules, we can almost always prove if a satisfiable result exists or not via a query.</p><p>While none of this helps us with lists yet, we will see that by using Horn clauses, we can get around some of the major hurdles of first-order logic and prove some pretty sweet results.</p><h3>Composing lists using Horn clauses</h3><p>In order to be able to say anything meaningful about cons, we need to first create a statement in a Horn rule that equates cons to its result. For example, RULE(_something_about_c_, c == cons(a, b), _something_about_b_). Once we have this, we can encode recursion over cons, with b representing the previous list, and c representing the output list. So long as we make a separate rule in the form of RULE(_something_about_b_, b == EMPTY_LIST) as a terminal condition, we will have a “convex” function that can be handled by Horn clauses. This is also called <a href="https://en.wikipedia.org/wiki/Mathematical_induction">induction</a>, and is used in provers like Coq and Isabelle to reason about recursively defined constructs like natural numbers.</p><h3>Verifying stuff about lists</h3><p>We can now verify some pretty cool stuff about lists using Horn clauses. First, let’s prove that the sum of a list of negative numbers must be negative.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d913604b73e0a7bc142402590e3b9ef/href">https://medium.com/media/4d913604b73e0a7bc142402590e3b9ef/href</a></iframe><p>Here, we represent cons as we did above with the added restriction that b (the entry into a list) must be negative, or b &lt; 0. Then, we create Horn clauses for a function list_sum that recursively iterates over a list, summing up its members and stopping when the empty list is reached. We see that, when we query the system, it is impossible to have a non-empty list (a != ll.empty)whose sum is greater than or equal to 0 (b &gt;= 0). On the other hand, we can satisfactorily construct a list whose sum is less than 0.</p><p>Next, let’s prove that if a non-empty list’s sum is greater than or equal to its length, then it must have at least one value greater than zero.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e1328ffa409c8c0114e900968f5ee94/href">https://medium.com/media/7e1328ffa409c8c0114e900968f5ee94/href</a></iframe><p>Here, we introduce a new function, list_len that generates the length of a list. The only difference from list_sum is that, instead of adding a value from the list to the running total, it adds 1. We take as a fact that the list only contains values less than one and prove that the sum of a non-empty list cannot be greater than or equal to the length of the list. Intuitively, this makes sense because the highest value of a number in the list is 0 (b &lt; 1)), so the sum of a bunch of these values can never exceed 0, and 0 can never exceed the length of a non-empty list.</p><p>It is worth it to note that proofs like this are rather trivial in Coq and Isabelle, but they do require guiding the prover to a suitable result with strategies like <em>auto </em>and <em>simple</em>. My prediction is that, in ten years, techniques like Isabelle’s <a href="https://isabelle.in.tum.de/website-Isabelle2009-1/sledgehammer.html"><em>sledgehammer</em></a><em> </em>and Adam Chlipala’s <a href="http://adam.chlipala.net/cpdt/"><em>crush</em></a><em> </em>strategy for Coq will gradually replace SMTs, but we are not there yet. Until we cross that threshold, SMTs are (in my opinion) the easiest way to obtain automatic proofs of simple deductive statements and, with Horn clauses, inductive relationships.</p><h3>Happy lists, happy … wrists?</h3><p>While property testing is pretty cool, it encounters a major hurdle as the space of possible properties widens. Here, I’ve presented a novel way to prove properties about lists using Horn clauses, which can be used (amongst other things) to create linting rules that flag potential issues with list manipulations. In general, Horn clauses can represent higher-order functions by making statements about constants with predictable behavior (like our Datatype ll) and the way they are treated by recursive functions. That is what allowed us to encode the recursive properties of functions like list_sum and list_len. While most programmers will never have to write this sort of verification themselves, it helps to know what’s possible in case you ever want to write a killer linter that alleviates the need for certain tests. Meaning writing less code, meaning less strain on your wrists, thus the title of this section. Ok, so maybe wordplay is not my thing, but Horn clauses are — check them out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e14d74b7ec9a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pleasework/proving-stuff-about-lists-e14d74b7ec9a">Proving stuff about lists</a> was originally published in <a href="https://medium.com/pleasework">pleasework</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting to 0 users]]></title>
            <link>https://medium.com/pleasework/getting-to-0-users-93f8fffc321e?source=rss-d90aca1008b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/93f8fffc321e</guid>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[failure]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Mike Solomon]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 08:06:23 GMT</pubDate>
            <atom:updated>2019-08-14T12:55:41.232Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2UOi-xfCbDq17XgM43u7fA.png" /></figure><p>In January of 2019, things were going pretty well for <a href="https://www.meeshkan.com/">Meeshkan</a>, a company I founded in 2017. We had just won the <a href="https://www.youtube.com/watch?v=s-A2puVVCKI">Slush 100</a> pitch competition. We launched a project called <a href="https://www.unmock.io/">unmock</a> and were seeing a healthy increase in week-over-week downloads. Our at-the-time flagship product, the Meeshkan Slack Bot, had just signed a large deal with a cutting-edge med-tech AI firm.</p><p>Fast-forward to August 2019 and the Meeshkan Slack Bot is dead, the 0.0.X series of unmock went from 1000s of users to 0 users, and the company has never been doing better. In this article, I’d like to talk about how we took the unmock pilot from 1000 to 0 users and what we learned by doing it. But first, it’s worth it to discuss how the Meeshkan Slack Bot fizzled out, as it turned out to be a harbinger of things to come with unmock.</p><h3>Onlookers versus users</h3><p>The apogee of interest in the Meeshkan Slack Bot came on the heels of the Slush 100 pitch competition, when we got more traffic to our website in two days than the previous twelve months and netted over fifty sign-ups for our product. Fifty may not sound like a lot, but in the Machine Learning space for a relatively niche tool, we thought it was pretty darn cool.</p><p>The problem with this mini-surge, as well as the Slush event in general, was that there was far more interest in our vision around the product than the product itself. Those that were “supposed” to be interested in the Slack Bot simply weren’t jumping on board. Data scientists would give up after halfhearted attempts to use it and go back to their arsenal of comfortable, hand-rolled devops hacks. Deals never felt organic — when we pitched to C.T.O.s or heads of ML, we were painfully aware that their team was not yet using the free version of Meeshkan. This is the IT equivalent of a death sentence, as the only products that ever succeed are ones with strong organic usage <em>before </em>paid buy-in.</p><p>Ultimately, the Meeshkan Slack Bot was ahead of <em>and </em>behind its time. It was ahead of its time because its lofty goal — to coordinate the training of machine learning models on Slack — would have required teams to already have organized, sanitized piles of data waiting to be machine-learned. These teams do exist, but they tend to have dedicated professionals working with them on ML infrastructure who would often rather build something themselves then trust a third-party vendor. On the other hand, the Slack Bot was behind its time because no one in the world pays for products like that anymore. Netflix, for example, recently open-sourced <a href="https://www.youtube.com/watch?v=XV5VGddmP24">Metaflow</a>, which has 70% shared DNA with our Slack Bot and is 100% free. Ultimately, unless lawmakers in America blow tech giants to smithereens with new anti-trust legislation, massive companies will be solving massive problems with state-of-the-art tools that benefit from being reviewed and maintained by an open-source community. While there is money to be made by hosting, using, and teaching those tools, producing them is no longer a viable business model.</p><p>The Meeshkan Slack Bot was like a Janus with the heads rotated 180 degrees— the future was staring down the past in a tight loop that sealed its doom. So why all the hype around it? Ultimately, Meeshkan had 10,000 onlookers for every user. Its avant-garde use of Slack coupled with its status as an ML tool was enough to titillate even the mildest of buzzwordophiles. But even more so, we put on a good <em>show</em>. Watching our slick presentation of the tool activated the same neural pathways as attending a good production of Parsifal at the Met or seeing a Parliament-Funkadelic reunion. This is what I have informally dubbed the “IT Spectacle Economy” — an international network of meetups and conferences where pizza and beer flow freely and people sometimes pay serious cash to be wowed by professionals talking about the code they write and the tools they use. I unwittingly became a participant in and purveyor of this circuit because (a) it’s fun; (b) I confused onlooker enthusiasm with user engagement; and (c) my background is in the performing arts and I like playing to a receptive and engaged crowd.</p><p>This intractable gap between onlookers and users is ultimately why we shut the Meeshkan Slack Bot down. But we were about to repeat the same mistake, in an even more colossal fashion, with unmock. The rest of this story is about that process.</p><h3>A fake version of the internet</h3><p>When we launched unmock, we did so with an even loftier and more ambitious goal than the Meeshkan Slack Bot — to make a fake version of the internet that you can mess around with to your heart’s desire before messing around with the real internet. That is <em>still</em> the goal of the project, but in January, rather than starting off small, we (I) started building the final version of unmock. We were creating hand-crafted mocks of certain popular services, heating our Helsinki office with GPUs doing NLP on various corners of the internet. We had a killer demo where you could basically play with a fake version of <a href="https://www.behance.net/">Behance</a> that felt like the real one, which allowed people to see how unmock effortlessly generated oodles of real-looking users, profiles, images, comments etc.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DNxI7fqv6smQ&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FNxI7fqv6smQ&amp;type=text%2Fhtml&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa684205556b011086e9dc3efe5b612d/href">https://medium.com/media/fa684205556b011086e9dc3efe5b612d/href</a></iframe><p>If onlookers liked the Meeshkan Slack Bot show, they went gaga over watching us mess around with a fake internet on stage. We got programmed at conferences and meetups in San Francisco, Seattle, London, Dublin, Berlin, Tel Aviv, and Stockholm. Our usage numbers were even ostensibly better, as I always left people with specific instructions for how to try out unmock at home and they usually dutifully followed them.</p><p>The problem, as you may have guessed, is that while people liked the <em>idea </em>of a fake version of the internet, no one actually knew what to <em>do </em>with it. So, after taking unmock for a spin, usage puttered out. We had more churn than a nineteenth-century butter maker. Our numbers looked like the skyline of the alps with peaks the day after meetups and troughs on all other days. For a while, my solution was simply to do more meetups to make the mountain range more dense. But of course, that doesn’t fix the underlying problem.</p><p>The craziest part of all this was that we had ten to twenty genuine signups a day for a tool with zero marketing and almost zero usage. So who the heck were these people? I reached out to a lot of them, and the responses were consistently the same — they thought what we were building was interesting and, while they couldn’t figure out what to do with it, wanted to be part of the journey somehow. While this is, of course, better than nothing, it is a long way from a viable business or even project.</p><p>In June, we had a week-long powwow to figure out how to handle all this. We could only think of two options, neither of which was pretty: double down on the companies that had signalled interest and develop an enterprise grade-product to suit their needs, or whittle down the codebase to only the most unbroken, useful and sustainable features and open-source the whole thing. The status quo was not an option: we were repeating our onlooker mistake, but at scale and more expensively, and even worse, we were actually calling these people “users” because they signed up for the thing and maybe even used it a few times.</p><p>We decided on the second option, namely, open-sourcing a useable version of our codebase. This required asking several questions, none of whose answers were obvious at the time. What was useable? What was useful? How would this sync up with the broader vision of the project and company? How could any of this be commercially viable? To start answering these questions, we proceeded by subtraction rather than addition. We stopped, for example, disseminating a clear-cut tutorial on how to use unmock, which resulted in a pretty drastic fall in usage, but those who remained gave us valuable insights into what people actually <em>did</em> with the tool. We conducted exit interviews with dozens of fleeing (non-)users, all of whom told us the various sources of their indifference. For example, it was from this that we learned that unmock needed to be fully offline and run locally. Finally, and most importantly, we cut off new signups to our service. Our onboarding process was so slick compared to the rest of the machine that it was getting in our way of thinking about that onto which people were boarding. This decision was inspired by a legend about the sculptor <a href="https://en.wikipedia.org/wiki/Auguste_Rodin">Rodin</a>, which I recount here with slight embellishments that come from years of telling it and misremembering it.</p><blockquote>One day, Rodin unveiled a new work to his students, and they all reacted with predictable awe to the creation of their talented master. One student effused “My, what agony, and what <em>hands</em>. From them pours a thousand years of inexpressible grief.” A second student opined “Master, what awful tragedy is masked behind those terrible, grotesque, hideous, and singularly beautiful hands?” Irritated, Rodin found a third student that, upon inspection, declared triumphantly “You have created <em>the</em> hands to which all future hands, real or unreal, will be compared.” Rodin, furious, grabbed an axe (in my version he happens to have an axe handy) and cut off the hands. His students asked in disbelief why he had mutilated his prodigal handiwork. His response: “No element of a work should ever be so great that it distracts from the greatness of the whole.”</blockquote><p>Granted, unmock 0.0.0 was not great — it was at best bad — but its onboarding process was only bad whereas everything else was awful, so we cut it off. This allowed us to focus purely on signal — people reaching out to us and <em>asking</em> about unmock.</p><p>Fast forward a few months and <a href="https://www.unmock.io/">unmock</a> 0.1.5 is alive and kicking! It has seen slower, but steadier, week-over-week growth in usage and, most importantly, we can focus on how people <em>are </em>using it instead of how they would <em>like to</em> use it. Because it is fully open-source and most usage happens in the open, we have a great view of <a href="https://github.com/unmock/unmock-odessa-saturday/pulls">users’ processes</a> and what <a href="https://github.com/unmock/unmock-odessa-saturday/issues">issues</a> they are confronting. And because there is a crystal clear separation of concerns — unmock is an open-source project whereas Meeshkan is a commercial entity that helps companies build cool stuff with unmock — there is no confusion about what is free and what’s not.</p><p>Getting to 0 users of unmock 0.0.0 was embarrassingly easy because it wasn’t a product — it was a vision that got a lot of intellectual buy-in but was less stable than CryptoKitties. Accruing a user base for unmock 0.1.X has been more difficult but more rewarding, and if I had to do it all over again, I’d start with the 0.1.X strategy and leave 0.0.0 for later. We will build our fake version of the internet, but we will do it one (real) community member at a time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93f8fffc321e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pleasework/getting-to-0-users-93f8fffc321e">Getting to 0 users</a> was originally published in <a href="https://medium.com/pleasework">pleasework</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[pleasework.io ; edition 0.0.0]]></title>
            <link>https://medium.com/pleasework/pleasework-io-edition-0-0-0-58eef1416c78?source=rss-d90aca1008b7------2</link>
            <guid isPermaLink="false">https://medium.com/p/58eef1416c78</guid>
            <category><![CDATA[emotions]]></category>
            <category><![CDATA[failure]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Mike Solomon]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 08:02:46 GMT</pubDate>
            <atom:updated>2019-08-14T08:18:01.569Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ezvcUfH4zqhLXk1qu_cfcg.png" /></figure><h3>pleasework.io ; edition 0.0.0</h3><p><em>Crosses fingers and pushes to production…</em></p><p>In 2014, I wrote a nihilistic glitch opera called <a href="https://www.offi.fr/theatre/dechargeurs-1986/overtime-52175.html">Overtime</a>. To put the thing together, I imported a bunch of loops from <a href="https://www.ableton.com/">Ableton</a> into <a href="https://supercollider.github.io/">SuperCollider</a> and progressively messed with their timing until I came up with stuff like this.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FOgWdV5Fooc8%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DOgWdV5Fooc8&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FOgWdV5Fooc8%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/5af6fcb8ad4edee32d10ba9ea9e89a6e/href">https://medium.com/media/5af6fcb8ad4edee32d10ba9ea9e89a6e/href</a></iframe><p>I’m sorry you had to hear that.</p><p>Anyway, if you look at the directory of all the SuperCollider scripts I wrote to compose the thing, you’ll see the following.</p><pre>$ ls .<br>pleaseWork.sc   pleaseWork.Now.sc   pleaseWork.Tuesday.ahhh.sc<br>seriouslyPleaseFuckingWork.sc  prettyPleaseWithSugarOnTopWORK.sc</pre><p>Within the files, the same monotonous naming convention represents variables and functions.</p><pre>pleeeeassssseWork = [Synth.new(&#39;foo&#39;, \t, x) for x in range(100)]</pre><p>In fact, on my computer, if you look up the number of files that contain the phrase “pleasework”, you’ll find…</p><pre>$ grep -rnw &#39;/Users/mikesolomon&#39; -e &#39;pleasework&#39; | wc -l<br>10561</pre><p>Perhaps I am a bit obsessional, but pleasework is my <em>de facto</em> name for basically everything I do because (a) I want things to work; (b) they rarely do; and (c) I have learned that, in life, if you don’t ask for something nicely, you won’t get it.</p><h3>So why a blog?</h3><p>I have a hunch that, these days, people utter the supplication “please work” a lot. And I think we do it more now than we did in the past. Of course, humanity has always had its share of compulsive fiddlers and tinkerers that spent their life crossing their fingers and biting their lips that they could pull off thing X or Y. But something about the modern lifestyle, with its abundance of tools, processes, and networks, leaves most folks with a healthy skepticism that anything will work, and certainly not on their first try.</p><p>The theme of this blog, then, is <strong>the things we do to make sure stuff works as expected</strong>. It could be writing a test, doing an experiment, having a discussion, rehearsing something, making a sketch, praying, etc. That’s sort of vague, but in general, if you’ve ever found yourself holding your breath with your eyes shut while compulsively muttering “please work”, think about what led you to that moment, what transpired afterwards, write it down and send it to us. Then, we will add some snazzy artwork, offer helpful editorial suggestions, and post it for the world to applaud. The great thing is that, if the article doesn’t work out, you’ll have a subject for your next article!</p><p><em>If you’re interested in being part of the journey as a contributor, editor, or designer, or just want to say hi, ping us at </em><strong><em>editor@pleasework.io</em></strong><em>. See you soon, and thanks for giving us a read!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58eef1416c78" width="1" height="1" alt=""><hr><p><a href="https://medium.com/pleasework/pleasework-io-edition-0-0-0-58eef1416c78">pleasework.io ; edition 0.0.0</a> was originally published in <a href="https://medium.com/pleasework">pleasework</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>