<?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 Kari Eline Strandjord on Medium]]></title>
        <description><![CDATA[Stories by Kari Eline Strandjord on Medium]]></description>
        <link>https://medium.com/@karieline?source=rss-ff01092f165------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*8uNmFgOlW4VKPL9GNVFr6Q.jpeg</url>
            <title>Stories by Kari Eline Strandjord on Medium</title>
            <link>https://medium.com/@karieline?source=rss-ff01092f165------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 22:41:06 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@karieline/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[test && commit || revert with Elm]]></title>
            <link>https://medium.com/@karieline/test-commit-revert-with-elm-913ff094eb7d?source=rss-ff01092f165------2</link>
            <guid isPermaLink="false">https://medium.com/p/913ff094eb7d</guid>
            <category><![CDATA[limbo]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[elm]]></category>
            <dc:creator><![CDATA[Kari Eline Strandjord]]></dc:creator>
            <pubDate>Sun, 14 Oct 2018 16:52:08 GMT</pubDate>
            <atom:updated>2018-10-15T15:32:44.435Z</atom:updated>
            <content:encoded><![CDATA[<p>For the last few days my co-worker Oddmund Strømme and I have been testing a new workflow <a href="https://medium.com/@kentbeck_7670/test-commit-revert-870bbd756864">test &amp;&amp; commit || revert</a> (TCR) with a couple of languages. One of them being <a href="https://elm-lang.org/">Elm</a>. As Elm is a relatively new language it was interesting to see how the workflow could be adapted.</p><p>The concept with test &amp;&amp; commit || revert workflow is that your code should always be in a valid state. So, if the test passes you commit the code or if it fails you lose all your changes and the code is forced back to the last valid state. It incentives you to take small steps, or else you would have to rewrite a lot of stuff.</p><p>First trying this workflow, I can’t say anything else than that I was a bit frustrated. I was quite a noob compared to my co-worker who had been on a week of code camp with Kent Beck on this topic. However, my co-worker was eager to experiment more with the TCR workflow, and I was like “why not?”. It turned out being more fun than I expected.</p><h3>Elm — starting out with TCR</h3><p>We’ve been working a bit with Elm, so it was a natural choice starting a new application trying it with TCR. We will not reproduce the code for that application here, but just show a mini-version of how to quickly get started with TCR in Elm.</p><p>Before getting started with the TCR flow, we need to setup the project with elm init then elm-test init . See the short video of the first flow, just setting up the initial building blocks.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FNn0IZ_Ln7CA%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DNn0IZ_Ln7CA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FNn0IZ_Ln7CA%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/849bf73cf3b7ac624a74637755d1b0b1/href">https://medium.com/media/849bf73cf3b7ac624a74637755d1b0b1/href</a></iframe><p>Versions for Elm, elm-format and elm-test:</p><ul><li>Elm 0.19.0</li><li><a href="https://github.com/avh4/elm-format">elm-format-0.18 0.6.1-alpha</a></li><li><a href="https://github.com/elm-explorations/test">elm-test 0.19.0-beta9</a></li></ul><p>After setting up the project, it was time to code TCR style. We wanted to write all the code in small steps, so to test the workflow instead of writing a script we could just use the terminal directly. We ended up with something like this:</p><pre>🐠✨$ elm-test &amp;&amp; elm-format tests/ --yes &amp;&amp; git commit -am &quot;working&quot; || git reset --hard</pre><p>We used elm-test for testing our code. We also wanted to format the code before each commit, so we added the elm-format command with source code directories and the --yes flag. Commiting with flags as -am made it possible to add all changes in tracked files and use a simple commit message<em>. </em>The last part with || git reset --hard resets all the code if the test failed. Since we were testing this in super small steps with pair programming, we didn’t get the chance to test it with a continuously pull and push script, adding the collaborative aspect of the workflow.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F_qrrKIipRTI%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D_qrrKIipRTI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F_qrrKIipRTI%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/0fe8f30baf9f263396c33e8096eb6594/href">https://medium.com/media/0fe8f30baf9f263396c33e8096eb6594/href</a></iframe><h3>TCR style experiences from working with Elm</h3><p>What we noticed very quickly was that making ultra-small changes in Elm was a bit more difficult than in other languages, as for example Java. The compiler forces you to write valid Elm code, which in this case makes it a more tedious going into a next state which is valid. As the Elm compiler makes it delightful being a programmer, maybe the case here is just to admit that the steps would be larger in a language as Elm.</p><p>Since the language is quite new it doesn’t have the same refactoring tools and possibilities as more mature languages. I haven’t seen a plugin for Elm which lets you extract a function or rename a module name, please let me know if you know about some. This naturally impacts the step size, as more manual changes have to be accounted for.</p><h3>TCR experiences beyond Elm</h3><p>It didn’t take a long time before I got used to failing. Resetting the code to the last valid state encouraged me to take more advantage of the editor tooling and drop some bad habits. Making changes as small as possible made me think about one step of the time. By breaking the problem into tiny bits, larger problems became smaller problems which were more straightforward and easier to solve.</p><p>As the TCR workflow is new, it’s a good time to experiment with what works and what doesn’t work. After trying it in small steps with Elm, I want to experiment with the workflow in other languages as Elixir and try it out in larger projects.</p><p><em>Thanks to Lars Barlindhaug and Oddmund Strømme for feedback and inspiring me to try it out.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*entMFcB1u_ot7PI54cX0Sg.jpeg" /><figcaption>First discovering test &amp;&amp; commit || revert.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=913ff094eb7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>