<?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 Juan Rodriguez on Medium]]></title>
        <description><![CDATA[Stories by Juan Rodriguez on Medium]]></description>
        <link>https://medium.com/@versatil5634?source=rss-4c0b085e065e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*gzZhCJUU4j2WGtUZxWMghw.jpeg</url>
            <title>Stories by Juan Rodriguez on Medium</title>
            <link>https://medium.com/@versatil5634?source=rss-4c0b085e065e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 12:41:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@versatil5634/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[TDD: What’s the recipe for success?]]></title>
            <link>https://medium.com/@versatil5634/tdd-yes-but-no-baa4f25c8f8a?source=rss-4c0b085e065e------2</link>
            <guid isPermaLink="false">https://medium.com/p/baa4f25c8f8a</guid>
            <category><![CDATA[tdd]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[test-driven-development]]></category>
            <dc:creator><![CDATA[Juan Rodriguez]]></dc:creator>
            <pubDate>Mon, 10 Jun 2019 20:35:33 GMT</pubDate>
            <atom:updated>2019-07-04T13:45:28.269Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IYegWJ-20610No61" /><figcaption>Photo by <a href="https://unsplash.com/@gillystewart?utm_source=medium&amp;utm_medium=referral">Gilly Stewart</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>I <em>love </em>TDD</strong> (Test Driven Development). It’s been six years since I applied for a job at the company which I truly believe has made me the Software Developer I am today. During my interview, Dave (a Tech Lead) briefed me on the technical test. It seemed quite straightforward and I felt confident with it, just like you did as a kid when you got an exam paper and the questions were exactly those that you’d studied for. I started writing my first line of code when Dave stopped me saying: <em>“woah woah, hold right there! W</em>e <em>write a test first,</em> <em>don’t we</em>?”. I didn’t know it then, but I will forever be grateful for that interview.</p><p>Over the years, I have (rightly) seen the popularity of TDD grow and interestingly, I’ve also seen many Software Developers claim they adopt it when really, they don’t.</p><h3><strong>Why do Software Developers find it hard to adopt TDD?</strong></h3><p>Let’s just very quickly go over the facts:</p><ul><li>TDD drives the design of your code through asserting on <strong>small, atomic units of behaviour</strong></li><li><strong>TDD is not a silver bullet. </strong>It does not drive the overall architectural design of your application</li><li>TDD promotes <strong>simplicity over anything else</strong></li><li>TDD promotes atomicity. If done right, <strong>your tests should become more specific</strong> and your production code should go in the completely opposite direction. In other words, <strong>your code will become more generic</strong>. <strong>By just doing TDD, you will implicitly hit the infamous</strong> (or famous, depending who you are talking to) <a href="https://en.wikipedia.org/wiki/SOLID"><strong>SOLID principles</strong></a>.</li></ul><p>I won’t go any deeper into this, but it’s easy to see why people try to get behind the TDD wagon, right? After all, we all want to write good code!</p><p>So, why do we fail at it? Why do so many people and companies see the benefits but don’t follow through? Well, short answer: it is not easy. In fact, it is hard.</p><h3><strong>First problem: Easy sell, hard implementation</strong></h3><p>TDD sells itself well. However, when you first try to implement it, you very rapidly realise it’s not as straight forward as you expected. Let’s have a look at the below chart:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_T_I7ji5Y85-IjzLtzzWBQ.png" /><figcaption>Stages of learning Test Driven Development</figcaption></figure><p>This is what I think happens when someone tries to learn TDD. It’s very motivating if you have the pleasure (like I did) to work alongside incredible, passionate developers that live and breathe TDD. The problem comes when you try to do this on your own, because as soon as we face difficulty, motivation quickly drops and frustration starts to rise.</p><p>What happens next? People have a tendency to instantly default and return to their comfort zone. You’ll start with production code and maybe write a unit test to back up what you’ve done and keep code coverage up. Oh, oh…</p><p>So, what happens when someone trying to practice TDD encounters this problem? <strong>You’re met with resistance</strong>.</p><h3><strong>Second problem: The TDD workflow</strong></h3><p>Red, green, refactor. Red, green, refactor. Red, green, refactor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KGZg28tnqlKJrW2h" /><figcaption>Photo by <a href="https://unsplash.com/@erwanhesry?utm_source=medium&amp;utm_medium=referral">Erwan Hesry</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The root of all problems is in the red. To paraphrase Uncle Bob’s first TDD law: “<em>We are not to write a single line of production code, without having a failing test first</em>”. Think about this — it’s not easy, right? Going back to my interview with Dave, I remember having my response to the task mapped out in my head — what classes and methods I was going to use, what I was going to write first, what dependencies etc. Then he dropped a depth charge and wiped it all away by telling me to forget about it and just focus on the “<strong><em>simplest thing we can test first</em></strong>”. It destroyed me — but, why?</p><p>It goes against a Software Developer’s way of thinking. We like to map out in our heads what we are doing and, through trial and error, write the code that solves the problem. Then, suddenly, we’re being told to forget about it, decompose the entire thing and just think of a single unit of behaviour that will drive a tiny little bit of the solution we are trying to achieve. <strong>We don’t know what it’s going to look like. All we’re being asked is to keep our focus on the smallest piece of the puzzle possible</strong>. This is hard — very hard<em>. </em>Through <a href="https://en.wikipedia.org/wiki/Kata_(programming)">code Katas</a>, you train this way of thinking. You make it second nature with practice, however it’s a completely different game when you are faced with actual real-life problem and you are trying to test drive it without experience.</p><p>So, what happens when someone trying to practice TDD encounters this problem? <strong>You’re met with resistance<em>.</em></strong></p><h3><strong>Third problem: Background and seniority</strong></h3><p>Quite simply, the more years’ experience one has without having exposure to TDD, the harder it’s going to be to adopt.</p><p>Let’s use an example of two developers — John and Sarah. John’s been asked to add a new endpoint to the API. It’s not going to work if Sarah (who loves TDD) tells him to write a test first. John already knows what controller he needs to write, if he needs to do any modifications to the service layer, if he needs a new repository or connector etc. He has the whole thing mapped out!</p><p>Let’s then say Sarah manages to write a test first and passes the keyboard to John. John then finds it difficult to keep focused within the context of the test — <strong><em>making it go green in the simplest way possible. </em></strong>His thought process is miles away from the test, maybe ten steps ahead. He ends up writing a bunch of production code that’s not yet needed, arguing: “<em>I know we’re going to remember this later</em>”.</p><p>You see my point? He has been doing this for so long that he’s reluctant to change.</p><p>So, what happens when someone trying to practice TDD encounters this problem? <strong>You’re met with resistance.</strong></p><h3><strong>Fourth problem: It takes time</strong></h3><p>Businesses know that TDD is a recipe to remove the risk of potential problems with applications being developed. However, there’s often the expectation that people will learn and adopt Test Driving, but in a way that has no impact to current commitments. This never ends well and quite often results in a crowded suite of poorly written unit tests that haven’t been test driven, adding noise to the overall development and maintenance of the application. This gives a terrible false sense of security because “<em>our code coverage is well above 90%”.</em></p><p>So, what happens when we try to push for TDD but don’t acknowledge that there is going to be a very steep learning curve? Developers will just default to what they know. They’ll write the code first, and then write some unit tests.</p><h3>So, what is the recipe for success?</h3><p>Unfortunately, there is no secret answer. In fact, the very short answer is to keep persevering, but let’s try to break this down a little bit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ov6OYV-elWlOFWKq" /><figcaption>Photo by <a href="https://unsplash.com/@dizzyd718?utm_source=medium&amp;utm_medium=referral">Drew Graham</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4><strong>1. Surround yourself by the right people</strong></h4><p>There’s a very good Spanish saying that goes: “<em>El que a buen arbol se arrima, buena sombre le cobija</em>”, which translates to something like: “<em>whoever gets close to a good tree will benefit from a very good shade”. </em>In other words, if you surround yourself by passionate people who live and breathe TDD you will, without a doubt, breathe it too. Throughout my career, I’ve been very lucky to work with extremely talented people who have taught me a lot.</p><h4><strong>2. Practice makes perfect</strong></h4><p>Practice, practice, practice. There is no other way. Keep doing code Katas at home, organise mob sessions and get yourself out of your comfort zone by coding with people that are miles ahead from you. By doing this, the only way is up.</p><p>Looking back, it’s incredible how much I’ve learned by just pairing with people more experienced than me that truly love what they do.</p><h4><strong>3. Persevere</strong></h4><p>It’s one thing to do Uncle Bob’s bowling Kata — it’s another to be faced with a daunting empty solution where you need to drive functionality from scratch. I know it’s tempting to give up and just start writing production code, but don’t.<strong> </strong>Keep pushing and one day it will all click, and it will feel good. In fact, it will feel great.</p><h4><strong>Do your duty as a Software Developer</strong></h4><p>You’re the one responsible for writing code, so take your time to deliver real craftsmanship. Remember that to go fast, you must first go slow. It’s your duty as a Software Developer, to speak up if you don’t feel comfortable with time pressures or if something can’t be done. It doesn’t <em>really</em> matter if your employer seeks TDD or not — the truth is, you’re expected to produce a high-quality product and TDD is a great way of doing it, so take your time and enjoy yourself.</p><p>Someone who I truly respect once said to me: “<em>TDD is our bread and butter. You just do it and if anyone is not doing it then they are not doing their job”. </em>I know this sounds radical and harsh but the context of this affirmation was within a company that had fully adopted TDD, so it made sense and I completely agree with it.</p><p>All these points combined will put you in the right track to pursue TDD proficiency. It’s extremely hard to initially adopt and to do so, you need to surround yourself with the right people, respect your integrity as a Software Developer and practice all the time. Once you’ve nailed it, you’ll soon start to reap the benefits.</p><p>Thank you very much for reading. And keep practicing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=baa4f25c8f8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>