<?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 Constantinos Mavromoustakos on Medium]]></title>
        <description><![CDATA[Stories by Constantinos Mavromoustakos on Medium]]></description>
        <link>https://medium.com/@constantinosmavromoustakos?source=rss-13ca99d4fe57------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*kXPKZRCOKBKN4Vzi.jpg</url>
            <title>Stories by Constantinos Mavromoustakos on Medium</title>
            <link>https://medium.com/@constantinosmavromoustakos?source=rss-13ca99d4fe57------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 23:54:51 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@constantinosmavromoustakos/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 rant about software testing]]></title>
            <link>https://medium.com/@constantinosmavromoustakos/a-rant-about-software-testing-5832904eb9fb?source=rss-13ca99d4fe57------2</link>
            <guid isPermaLink="false">https://medium.com/p/5832904eb9fb</guid>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Constantinos Mavromoustakos]]></dc:creator>
            <pubDate>Thu, 09 May 2019 16:54:10 GMT</pubDate>
            <atom:updated>2019-05-09T16:54:10.126Z</atom:updated>
            <content:encoded><![CDATA[<p>I have had the conversation about testing applications more than a few times in the last couple of months. I have heard arguments ranging from it slows down development to the best way to test is to let your users break shit (this article was used as a reference <a href="https://logicmag.io/05-the-servers-are-burning/">https://logicmag.io/05-the-servers-are-burning/</a>).</p><p>At first I was taken back that there are still people out there that believe that software testing is unecessary. But then I thought back to when I first started coding and thought what could have I told my younger self (aside from stop being such an asshole) that would convince him that testing would save him many hours of staring at a screen hoping the bug would miraculously manifest itself.</p><h3>Large problems / small problems = simple solutions</h3><p>Many times as engineers we will be handed a complex business problem and start trying to solve it in our heads. We approach the problem as a whole and from our experience we will start creating mental milestones to achieving this task. To me these milestones form the basis of my tests. Instead of writing the ideas down on a piece of paper I write them down in the form of unit tests or integration tests depending on what I am trying to accomplish.</p><p>An example of this is I had to integrate an escrow system using the <a href="https://stripe.com/">https://stripe.com</a> API into <a href="https://indie.ninja/">https://indie.ninja</a>. I went through the Stripe documentation and at a high level knew that it could be done but had no idea of the sequence or what data was needed to accomplish this. I knew at a high level that I needed to do 4 things:</p><ul><li>Collect the data from the user</li><li>Send it to stripe</li><li>Save/cache some data about the transaction locally</li><li>display an error or success message to the user.</li></ul><p>So I started down the path of writing my tests.</p><p>My integration tests were as follows:</p><ul><li>User enters credit card information</li><li>User sees success message upon successful save of credit card</li><li>User sees error message if there is an error with the card</li></ul><p>I started writing stubs for the interface which I would use to communicate with the stripe API. Again I split the problem into very high levels and now started diving into my unit tests.</p><ul><li>Send credit card info to Stripe and handle successful response</li><li>Send credit card info to Stripe and handle unsuccessful response</li><li>Map stripe specific errors to user friendly error messages</li><li>Create the record if stripe returns succesfully.</li></ul><p>I now had the milestones planned out for how this feature will work. Using the tests I had written I had been able to break up 1 large problem into several smaller problems which could each be worked in isolation.</p><p>Their are many advantages to this but the most important ones to me were:</p><ol><li>At this point I knew with exact detail how complex the problem as a whole was. If something came up which I did not account for I could go back to my partners and say “hey I under estimated this and will need more time”.</li><li>By segmenting and isolating each piece I had a more clearly defined endpoints of my API with clear definitions of where the responsibilities of each component resided. If I had worked on the problem as a whole it’s sometimes easier (lazier) to just add functionality where it does not belong in order to make things work.</li><li>If I needed to delegate work to someone else I could more accurately break up the work and assign smaller chunks in parallel without worrying about stepping on each others toes.</li></ol><p>You might be thinking at this point wouldn&#39;t an experienced developer know this by this point? Yes, but we all make mistakes and this process eliminates any guess work. Also if I was pairing with someone this would be a good opportunity to split up and work in parallel.</p><h3>Documentation</h3><p>A long time ago I subscribed to the school of if you need to add code comments to explain what you are doing then your writing bad code.</p><p>As a developer I am very good at reading code. The language interpreter has set inputs and set outputs. I have a set of rules I can compare to to know what a piece of code is doing. Reading documentation oftens adds a layer of human complexity. Documentation can be interpreted differently by people depending on how they understand the issue. Language differences can sometimes make it harder to read especially if the developer’s first language is English.</p><p>Tests eliminate this layer. If I know what the inputs and outputs are of your code, I can summarize and even refactor your code based on what you are telling me the code should be doing. Even if the code is not clear (although you can make the argument that you can write shitty tests also, but that is another topic) I can summarize what it is doing.</p><h3><strong>Refactoring</strong></h3><p>I did some contract work recently and had to work on a very large and complex application that had no tests. I started picking up small features to familiarize myself with the codebase and every time I fixed something I broke 3 other things completely unrelated to the issue. I would scramble and fix the issues only to break 3 more.</p><p>This project was weirdly enough the same project where I had to have a discussion with someone about of the importance of tests and their response was that they did not believe in tests (like it was the fucking easter bunny or something) and they took too long to write and execute than just writing the code.</p><p>So back to my point. I had to refactor one line of code. ONE! All I had to do was change the attribute for an import task that was parsing the data incorrectly. The final fix took over 8 hours of users complaining that something else was broken, hunting it down, fixing it and testing it manually.</p><p>At this point it’s simple math. Chances are that the system will change, new data will come in, old data will change formats and that same piece of code will have the same vicious cycle of bug hunting. That 8 hours speant will more than likely be multiplied by the number of times needed to refactor that code.</p><p>I can’t imagine the tests would take anywhere near that amount of time to write.</p><h3>Summary</h3><p>These days I cringe at the thought of working on an application withouts tests and can not even fathom how people write software without testing it. I have subscribed to the TDD approach and make sure I write my tests first before even writing any code to make sure I understand what the interactions are of the user and of my components that I am writing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5832904eb9fb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>