<?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 Alvin Antonius on Medium]]></title>
        <description><![CDATA[Stories by Alvin Antonius on Medium]]></description>
        <link>https://medium.com/@alvin.antonius?source=rss-89b1d559c10f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qRIG5WkiDaywq5jjfsSZKg.png</url>
            <title>Stories by Alvin Antonius on Medium</title>
            <link>https://medium.com/@alvin.antonius?source=rss-89b1d559c10f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 14:48:21 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alvin.antonius/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[Save time by writing more code. Write unit test before anything else]]></title>
            <link>https://medium.com/@alvin.antonius/save-time-by-writing-more-code-write-unit-test-before-anything-else-580367affca0?source=rss-89b1d559c10f------2</link>
            <guid isPermaLink="false">https://medium.com/p/580367affca0</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[go]]></category>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[golang]]></category>
            <dc:creator><![CDATA[Alvin Antonius]]></dc:creator>
            <pubDate>Sat, 01 Apr 2017 22:09:07 GMT</pubDate>
            <atom:updated>2017-04-01T22:09:07.049Z</atom:updated>
            <content:encoded><![CDATA[<p>Some people tend to skip writing unit test or maybe write it after the function already done. Actually writing unit test it’s a timesaver if you do it right.</p><p>By following <strong>Red -&gt; Green -&gt; Refactor</strong> steps after trying TDD approach when writing some <em>golang</em> code for my work, i realize how useful it is to help me saving time when writing new code which also helps me to write testable code at start.</p><p>So, for example here i will create one <em>golang </em>package which will do <em>regex </em>operation, for checking http request header to make sure the request is coming from certain site. Let’s start into <strong>RED </strong>phase by writing the unit test first.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a41042f02a751e6919d2b9158300ff34/href">https://medium.com/media/a41042f02a751e6919d2b9158300ff34/href</a></iframe><p>It will fail then i run the test. but it’s okay thats why we call it <strong>RED </strong>phase.</p><p>After finish writing the unit test and some test case, we entering the <strong>GREEN </strong>phase by writing the real function to pass all the test case.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d1e7c61455acdd1cd9e80c1783a2527/href">https://medium.com/media/1d1e7c61455acdd1cd9e80c1783a2527/href</a></iframe><p>If all the test case is passed, then we already finished the <strong>GREEN</strong> phase. And you can continue to the <strong>REFACTOR </strong>phase if you’re not statisfied yet with your code structure.</p><p>By doing development this way, we already save so much time because we didn’t need to test the function manually.</p><p>Let me know what you think about this approach. Thanks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=580367affca0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>