<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://jlhood.com/feed.xml" rel="self" type="application/atom+xml" /><link href="https://jlhood.com/" rel="alternate" type="text/html" /><updated>2025-12-13T20:08:35+00:00</updated><id>https://jlhood.com/feed.xml</id><title type="html">James Hood</title><subtitle>A blog about software and the humans who create it.</subtitle><author><name>James Hood</name><email>james@jlhood.com</email></author><entry><title type="html">Handling Conflict in a Healthy Way</title><link href="https://jlhood.com/handling-conflict-in-a-healthy-way/" rel="alternate" type="text/html" title="Handling Conflict in a Healthy Way" /><published>2023-04-21T00:00:00+00:00</published><updated>2023-04-21T00:00:00+00:00</updated><id>https://jlhood.com/handling-conflict-in-a-healthy-way</id><content type="html" xml:base="https://jlhood.com/handling-conflict-in-a-healthy-way/"><![CDATA[<p>Over the years, I’ve read many, many books on a wide range of both technical and non-technical topics, so people often ask me for book recommendations. While there seems to be a never-ending list of wonderful books with new ones coming out all the time, my hands-down top book recommendations have not changed for almost 2 decades: <a href="https://www.amazon.com/Crucial-Accountability-Resolving-Expectations-Commitments/dp/0071829318">Crucial Accountability</a> and <a href="https://www.amazon.com/Crucial-Conversations-Tools-Talking-Stakes/dp/1260474186">Crucial Conversations</a>.</p>

<p>Very early in my career, I was lucky enough to take a leadership course taught by an excellent teacher, and one of the course units was dedicated to studying the content of these two books (note, Crucial Accountability was called Crucial Confrontations at the time) and practicing the techniques they taught. <em>I am not exaggerating when I say that out of all the books I’ve read, these books have had the single largest positive impact on both my career and personal life.</em></p>

<p>I didn’t grow up with great examples of healthy communication, especially when it came to handling conflict. As a result, my first instinct when dealing with confrontation was to not deal with it. I would disengage or try to change the subject rather than dealing with the problem head-on, but that only led to it festering under the surface, breeding growing resentment, which would pop up randomly in future conversations. However, these books completely changed the way I think about conflict and confrontation. While I’m not perfect at it, interpersonal conflict of all shapes and sizes happens frequently in life, so I’ve had lots of opportunities to practice and have become quite skilled at dealing with conflict in a healthy and positive way, which has helped me immensely both in my career and in my personal life.</p>

<p>I honestly believe if everyone on Earth read, internalized, and regularly practiced the skills taught in these books, the world would be a significantly better place to live. While I highly, highly recommend everyone read these books, I recognize people are busy, so I’m going to use the rest of this post to give a quick summary of some of the key concepts I’ve found most helpful.</p>

<p>The first thing to understand about conflict is that it arises due to missed expectations. Let’s illustrate with a simple example: Let’s say you and a friend agree to meet for dinner at a restaurant at 7 pm, and you arrive at 7 pm and your friend arrives at 7:30 pm. You had an expectation that your friend would be there at 7 pm, but they arrived 30 minutes late. Again, this is a very simple example, and realistically, your friend would probably apologize and explain why they were late, but it’s easy to tweak this into a higher stakes scenario. What if you two are also colleagues and this was dinner with a client to discuss an important business deal, and the two of you have been preparing for this dinner for weeks? Now you might not be quite so forgiving!</p>

<p>Generally, when conflict arises, your first indication will be your emotional reaction. Depending on the situation, you may feel a range of negative emotions including disappointment, irritation, and anger. It’s important not to ignore these feelings as they serve as your body’s natural alarm system to notify you of a problem. However, it’s also important not to let them completely dictate your actions in the moment, as strong feelings can lead you to say or do something you’ll regret later. Strong emotional reactions are one of the key reasons why handling conflict in a healthy way is so difficult, so handling a situation well requires some pre-work before you actually have a conversation with that person.</p>

<p>The pre-work is called “What/If” and involves you figuring out <em>what</em> the conflict is and <em>if</em> it actually needs to be dealt with. For the “what” part, remember, the source of conflict is missed expectations, so this step means figuring out what you expected to happen vs. what actually happened. In the books, this is called “defining the gap,” meaning the gap between what you expected to happen vs. what actually happened. For example, in the above cases, the expectation was you would both arrive at 7 pm, but the reality was you arrived at 7 pm and your friend arrived at 7:30 pm. The “if” part is deciding if the problem actually warrants a conversation at all. If this was truly a one-time thing or, say, your friend is moving away tomorrow and you’re never going to see them again, maybe you decide it doesn’t really matter in the grand scheme of things, and it doesn’t warrant a conversation. This is the classic “pick your battles” cliché. Just be careful that you’re not always choosing that it doesn’t matter when, in reality, you’re just trying to avoid dealing with the conflict. If this is a person you’re going to interact with on a regular basis, such as a colleague or partner, it’s generally better to deal with conflict early.</p>

<p>Defining the gap may sound simple, but when emotions are running high, this can actually be quite difficult due to a phenomenon known as the <a href="https://en.wikipedia.org/wiki/Fundamental_attribution_error">Fundamental Attribution Error</a>. The fundamental attribution error is the tendency to attribute someone else’s behavior to flaws in their personal character. In simple terms, it’s the tendency to jump to the conclusion that someone behaved in some way because they are “bad” or “evil” in some way. This may sound funny, but our brains do this A LOT. So much so, that it can happen unconsciously, almost like a reflex. For example, we might assume our friend showed up late to dinner because “they are selfish and have no regard for me and my time.” The biggest problems with these assumptions are that (1) they start us on the path of building resentment toward that person, and (2) if we allow ourselves to conclude that another person is “bad” or “evil” even, it means any unhealthy actions we take toward them as a result of that behavior are somehow justified.</p>

<p>The key to mitigating the fundamental attribution error is twofold: First, when defining the gap, stick to factual data only. “We agreed to meet at the restaurant at 7 pm. I arrived at 7 pm. They arrived at 7:30 pm.” It’s not, “They arrived at 7:30 pm, <em>because they don’t value my time.</em>” That last part is an assumption your brain tacked on, not a fact. Second, ask yourself the following question: “Why would a rational, reasonable person do this?” The answer you should arrive at is “I don’t know.” This changes your mindset from one of irritation or anger to one of curiosity. Once you get to a place of genuine curiosity, you are ready to have a healthy conversation.</p>

<p>Ask the person if you can talk to them in private about something and only proceed if they say yes. Don’t try to force the conversation if they’re not in a good place to have one; find a time that works for both of you. Begin by describing the gap, sticking only to factual information. Then, with genuine curiosity ask them what happened, and <em>really listen to their answer</em>. Ask clarifying questions and repeat your understanding back to them to ensure you actually understood it and to also let them know that you’re really listening and genuinely care about what they have to say.</p>

<p>What’s brilliant about this approach is it changes the entire idea of confrontation from an adversarial “fight” between you and them into you creating a safe environment where you can present a problem, get more insights about what happened from their point of view, and then the two of you can work together to solve the problem. Being in the engineering field, I’ve found this approach works incredibly well with my work colleagues, because everyone I’m working with tends to be problem solvers. For me personally, at least, I find working with others to solve problems energizing, as opposed to being angry at another person, which I find mentally exhausting and draining.</p>

<p>When you get to the point where you’re having a healthy dialogue with the other person, there tends to be a noticable sense of relief on both sides as tensions from the initial conflict ease. This is good; however, it’s also important to ensure the dialogue leads to a concrete resolution. Make sure the two of you agree on concrete steps one or both of you can take to prevent a situation like this from happening again in the future and hold each other accountable.</p>

<p>I hope you find this summary helpful, but it’s not a substitute for reading the books. For example, creating a safe environment for dialogue and problem solving can be easier said than done depending on the conflict, and the book goes into a lot of detail and various scenarios to help better equip you to do this. The authors’ company also has <a href="https://cruciallearning.com/blog/">a free blog</a> and email newsletter you can sign up for. I haven’t received the newsletter for quite some time, but I remember it being very helpful early on after reading the books, because people would send in real-life work conflict scenarios asking for advice, and I always found their answers on how to apply the skills to the specific situation thoughtful and helpful.</p>

<p>At this point, I’m starting to get worried people will think I’m being paid to write this post, but I promise I’m not (maybe I should have asked them to pay me? 😜). But again, I can’t stress enough how often I use these skills in my everyday life, both at work and personally, and I just want more people to have these skills that have and continue to serve me so well.</p>]]></content><author><name>James Hood</name><email>james@jlhood.com</email></author><category term="career" /><category term="leadership" /><category term="self-improvement" /><category term="motivation" /><summary type="html"><![CDATA[Over the years, I’ve read many, many books on a wide range of both technical and non-technical topics, so people often ask me for book recommendations. While there seems to be a never-ending list of wonderful books with new ones coming out all the time, my hands-down top book recommendations have not changed for almost 2 decades: Crucial Accountability and Crucial Conversations.]]></summary></entry><entry><title type="html">I Need Therapy (and you do too!)</title><link href="https://jlhood.com/i-need-therapy-and-you-do-too/" rel="alternate" type="text/html" title="I Need Therapy (and you do too!)" /><published>2022-03-18T00:00:00+00:00</published><updated>2022-03-18T00:00:00+00:00</updated><id>https://jlhood.com/i-need-therapy-and-you-do-too</id><content type="html" xml:base="https://jlhood.com/i-need-therapy-and-you-do-too/"><![CDATA[<p><strong>Trigger warning:</strong> This post contains content about suicide.</p>

<p>This week I was shocked to learn that a good friend whom I’ve known for over 2 decades committed suicide. The news is still fresh and raw so this post is difficult to write, but let me start by saying if you or someone you know is considering harming themselves, please stop reading this and immediately call a suicide prevention hotline like <a href="https://suicidepreventionlifeline.org/">Lifeline</a>.</p>

<p>My reaction to the news was a mix of shock and confusion. It just doesn’t make sense. He left behind a 9 year old daughter whom he loved so much. I literally watched him begin a new chapter of his life 1 month ago, marrying a woman he’d described meeting and thinking, “Oh. There you are. It’s us.” But that’s the frustrating thing about these kinds of situations. Our brains immediately try to reason about how it could make sense when in reality, there’s no rhyme or reason to mental illness.</p>

<p>While I’ve thankfully never personally dealt with suicidal thoughts, I am very familiar with mental health issues. I think it’s easy for people to look at me and my career and assume I’ve somehow magically figured out life and have it all together, but first off, of course that’s not true, and second, I’ve had a lot of help over the years to get to where I am now. While this help has come in the form of love and support from my amazing wife and kids as well as friends and other loved ones, I think it’s also important to publicly say that a big part of my personal growth and success has come from the fact that I’ve been in regular therapy sessions for well over a decade.</p>

<p>My generation grew up with a stigma around seeking help for mental health issues, and while the public discourse around mental health is improving, the stigma still exists, because when I ask most people I mentor if they’ve ever seen a therapist, the vast majority say no.</p>

<p>I can understand this, because I didn’t seek out therapy (even though I desperately needed it!) until about 12 years ago when my wife suffered severe postpartum psychosis and we ended up in a crisis center. After an evaluation, we were given a reference to a therapist and psychiatrist. I went to our first therapy session because <em>I was a good husband</em> and wanted to attend the therapy sessions <em>that my wife needed</em>, not me mind you, my wife… Well, it took about 5 minutes for the therapist to focus in on me and say, “So what’s going on with you?” Wait, timeout! We’re here to talk about my wife’s problems, right?? Can we talk about my wife and not me please?? And so began my personal therapy journey.</p>

<p>For several years, my wife and I attended couples therapy, and eventually it got to a point where we were generally able to communicate with each other in a healthy way, and we realized the recurring issues that were still coming up were caused by our own personal issues that needed work. So we transitioned from couples therapy to individual therapy, each finding a therapist that could help with our specific individual needs. Fast-forward to now and I can easily say I’m in a much more stable place than when I started. However, I still see my therapist every month.</p>

<p>I was pushing 30 years old when we went to that first therapy session and while it was uncomfortable and awkward for me at first, even then, all I could think was, “We should have done this ages ago!” Now I encourage my mentees and anyone else who will listen to attend therapy, and I’d like to encourage you to do the same. I recognize not everyone has access to quality therapy and that’s a separate issue, but many do and choose not to use it thinking it’s only meant for emergencies.</p>

<p>The way I describe it to people is to think of it like office hours in college. One of the best pieces of advice I ever received when starting college was, “Go to office hours <em>before</em> you’re in trouble. You don’t want to be sitting in your professor’s office hours a week before finals, along with a crowd of other panicked students, trying to learn a semester’s worth of material in a couple hours.” I followed this advice, regularly attending office hours throughout the semester, and it made a huge positive difference in my academic experience.</p>

<p>Therapy should be treated exactly the same way. Don’t be like me and wait until a crisis situation to go. Don’t wait until you’ve hit rock bottom or divorce is on the table or you’re suicidal. Even if you feel relatively stable, I assure you, therapy can help you uncover personal baggage that is impacting your daily life more than you realize. Therapists aren’t there to fix you, but a good therapist is incredibly helpful at leading you to focus on root causes of struggles in your life. Oftentimes, they help simply by providing data and research that shows you’re not alone in your struggle and many others are struggling with similar issues. That knowledge alone can bring a huge sense of relief and open the door to self-compassion. They are also often able to provide tools to help you work through your issues, eventually coming to accept yourself more and more for all your unique talents and quirks.</p>

<p>I loved my friend and I miss him terribly, and while I can’t do anything to help him now, I hope this post encourages someone else to seek the help they need well before their situation becomes dire. Also, if you’re reading this and you’ve already found therapy for yourself or a loved one, please do me a favor and post about your experience with the hashtag <strong>#ineedtherapy</strong>. Let’s get it trending to spread awareness that it’s ok to go to therapy and talk openly about the fact that we do!</p>

<p>Take care of yourselves and give your loved ones a big hug today if you can.</p>

<hr />

<p>This post is dedicated to Eric, a loving father, husband, and friend. Eric, I hope your soul has found peace. 💔</p>

<p><img src="/images/eric.jpg" alt="Eric" /></p>]]></content><author><name>James Hood</name><email>james@jlhood.com</email></author><category term="personal" /><category term="self-improvement" /><category term="mental-health" /><summary type="html"><![CDATA[Trigger warning: This post contains content about suicide.]]></summary></entry><entry><title type="html">Beating the Quality Death March with BDD</title><link href="https://jlhood.com/beating-the-quality-death-march-with-bdd/" rel="alternate" type="text/html" title="Beating the Quality Death March with BDD" /><published>2018-10-13T00:00:00+00:00</published><updated>2018-10-13T00:00:00+00:00</updated><id>https://jlhood.com/beating-the-quality-death-march-with-bdd</id><content type="html" xml:base="https://jlhood.com/beating-the-quality-death-march-with-bdd/"><![CDATA[<p>I have yet to meet a software developer or manager who would disagree with the statement, “We should build quality software.” However, ensuring quality can feel like an uphill battle. I used to have this <a href="https://despair.com/">Despair.com</a> poster in a frame on my desk, but it unfortunately got lost during one of the many building moves that happen when you work at Amazon. 😂</p>

<p><a href="https://despair.com/products/quality"><img src="/images/quality.png" alt="Despair.com: Quality" /></a></p>

<p>I’ve come a long way in my career when it comes to software quality. At my first job, we didn’t even write automated tests <em>at all</em>. Every change was tested manually at the time you developed it <em>*shudder*</em>. I think it’s because I’ve seen that side of software development that I’ve become such a huge quality advocate. Now, I’ve led multiple teams at Amazon to develop critical services and web UIs where each commit goes through a full continuous deployment pipeline with automated unit and integration tests and other safeguards to ensure quality all the way to production, so I have a lot to say on the subject.</p>

<p>What I wanted to cover today is a common developer question I get: How do you ensure integration tests get written for your software?</p>

<p>At this point, most teams/companies are on board with writing unit tests. It’s relatively easy to enforce a rule on your team that all functional changes must include unit test changes in the same commit/PR. While code coverage is not a perfect metric, it is a decent measurable indicator that this policy is being enforced.</p>

<p>However, unit tests alone <a href="https://twitter.com/thepracticaldev/status/845638950517706752">are</a> <a href="https://twitter.com/thepracticaldev/status/892788721350836225">just</a> <a href="https://twitter.com/thepracticaldev/status/852508104914874369">not</a> <a href="https://twitter.com/thepracticaldev/status/687672086152753152">enough</a>. Ensuring integration tests are written can be tricky though. The key problem is you usually can’t test a service or website until you’ve built enough of it to process an end-to-end request. If you don’t think carefully about how you’re going to structure the delivery of the features of your product, you can end up saving all integration tests until the very end of the project where it’s common for them to get deprioritized due to deadlines.</p>

<p>I wanted to share a solution to this problem that I’ve tried on multiple teams and have found to be extremely effective in solving this problem: Behavior-Driven Development (BDD).</p>

<h2 id="what-is-bdd">What is BDD?</h2>

<p>BDD is a development methodology derived from Test-Driven Development (TDD) that focuses on defining feature requirements in terms of concrete scenarios <em>before</em> developing the solution, then turning those scenarios into executable tests that verify the solution meets the requirements.</p>

<p>Let me give you an example. Let’s say you’re writing a simple banking service that allows you to open accounts and make deposits and withdrawals. You might receive a bullet-list of requirements for this service, e.g.,</p>

<ol>
  <li>Users can open and close a checking or savings account with an initial balance.</li>
  <li>Users can deposit or withdraw money from an open account as long as they don’t overdraw the account.</li>
  <li>Savings accounts have a minimum balance of $100.</li>
  <li>…</li>
</ol>

<p>These high-level requirements are a starting point, but when you use BDD, the next step is to break up this project into features and then write detailed scenarios for each feature using simple language that can be read and understood by both developers and key stakeholders. For example, the above requirements would be described in the following feature file:</p>

<div class="language-gherkin highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">Feature</span><span class="p">:</span> Basic Account operations
  As a customer
  I want to be able to open checking and savings accounts, and credit and debit my accounts
  So I can buy stuff online^H^H^H^H^H save my money

<span class="kn">Scenario</span><span class="p">:</span> Customer creates a checking account
  <span class="nf">When </span>the customer opens a checking account with a $0 balance
  <span class="nf">Then </span>a new checking account should be created
  <span class="nf">And </span>the checking account should have a balance of $0

<span class="kn">Scenario</span><span class="p">:</span> Customer creates a savings account with the minimum balance
  <span class="nf">When </span>the customer opens a savings account with a $100 balance
  <span class="nf">Then </span>a new savings account should be created
  <span class="nf">And </span>the savings account should have a balance of $100

<span class="kn">Scenario</span><span class="p">:</span> Customer creates a savings account with less than the minimum balance
  <span class="nf">When </span>the customer opens a savings account with a $50 balance
  <span class="nf">Then </span>the call should fail

<span class="kn">Scenario</span><span class="p">:</span> Customer credits their account
  <span class="nf">Given </span>the customer has a checking account with a $0 balance
  <span class="nf">When </span>the customer credits their checking account $10
  <span class="nf">Then </span>the checking account should have a balance of $10

<span class="kn">Scenario</span><span class="p">:</span> Customer debits their account
  <span class="nf">Given </span>the customer has a checking account with a $50 balance
  <span class="nf">When </span>the customer debits their checking account $10
  <span class="nf">Then </span>the checking account should have a balance of $40
<span class="err">...</span>
</code></pre></div></div>

<p>The format for these scenarios is very simple. The only real structure is that steps starting with the word “Given” are preconditions or assumptions, steps starting with “When” are the action that’s taken, and steps starting with “Then” are assertions on side effects of the actions taken. “And” can be used to chain multiple steps together.</p>

<p>Once the feature files are reviewed and approved, you build the feature. After that, tools like <a href="https://cucumber.io/">Cucumber</a> allow you to map each step in the feature file to a function in code and run the feature file as an executable test. Put a step in your CI/CD pipeline to execute the feature file and you now have automated acceptance tests for your feature that are run everytime you make a change to your codebase!</p>

<h2 id="why-bdd-works">Why BDD works</h2>

<p>Like I said, I’ve used BDD on multiple teams now and it’s been incredibly effective. Here’s what I like about it:</p>

<p>First, writing the feature files increases collaboration, ensuring developers, management, and key stakeholders are all on the same page about what the expected behavior of the system should be <em>before</em> it’s built. The feature file example I gave above may seem simple to write, but you’d be surprised how many questions come up while trying to write one. Developers are awesome at thinking of all kinds of hairy edge case scenarios, and having to write them out drives requirements clarification questions back to management/stakeholders. This removes a lot of wasted time and effort lost due to requirement misunderstandings that are very expensive to fix later in the process. I find after management has been through a few cycles of this, they love it, because they have confidence that their team is building the right thing and it will work (and continue to work!) once it’s built.</p>

<p>Second, it gives developers a systematic way to ensure automated integration tests are actually written. With unit tests, you set a rule that tests should be written for each commit/PR. With integration tests, you set a rule that tests should be written for each feature. Break your project into small, incremental features, and now you are ensuring integration tests are written incrementally as the software is developed.</p>

<p>With both management and developers seeing benefits, you don’t get in situations where you deprioritize integration tests, because priority discussions happen at the <em>feature level</em> and writing integration tests is incremental rather than being this giant, insurmountable task at the very end of the whole project when you’re feeling pressure to launch.</p>

<h2 id="bdd-pitfalls">BDD Pitfalls</h2>

<p>Hopefully at this point, I’ve made the benefits of BDD pretty clear. Maybe you’re interested in trying it on your own team. Great! I highly recommend it. However, I’ve also used this in practice on several teams and wanted to cover some common pitfalls to watch out for when going down this path.</p>

<h3 id="pitfall-1-features-are-too-big">Pitfall 1: Features are too big</h3>

<p>Since integration tests are written for each feature, in order to develop integration tests incrementally, you have to break down projects into multiple features. This practice has many other benefits as well, so I recommend it regardless of whether you’re using BDD or not, but for BDD specifically, if your “feature” is the whole product or project, then you’re back in the same boat of saving writing integration tests until the very end where they’re likely to get cut due to time pressure.</p>

<p>So if you go to write the feature file and it feels like a daunting, never ending task, your feature is probably too big and needs to be further broken down. If you’re practicing Scrum, think of a feature as something that should fit inside of a sprint. If you’re not practicing Scrum, my team’s sprints are 2 weeks, so you can use that amount of time as a guideline. 😊</p>

<h3 id="pitfall-2-using-bdd-for-unit-tests">Pitfall 2: Using BDD for unit tests</h3>

<p>The first book I read on BDD was <a href="https://www.amazon.com/BDD-Action-Behavior-driven-development-lifecycle/dp/161729165X/ref=sr_1_1?ie=UTF8&amp;qid=1539442121&amp;sr=8-1&amp;keywords=bdd+in+action">BDD in Action</a>. It does a great job of explaining the benefits I describe above in more detail. However, it also advocates for not only using BDD at the acceptance test level as I describe above but at the unit test level as well. There are many things I enjoyed about that book, but I think using BDD at the unit test level is a complete waste of time.</p>

<p>When you think about it, what you’re doing with BDD is maintaining a mapping between a human-readable description of how your software should work and the code that actually ensures it works this way. There is overhead in maintaining this mapping, but it’s worth it <em>as long as someone other than a developer reads the human-readable description</em>. Why would a manager/stakeholder waste their time reading a feature file at the unit test level? They shouldn’t, since they should be more concerned that the system behavior meets the requirements and less concerned about the low-level implementation details. I’ve also never seen developers read feature files at the unit test level, because it’s usually easier for them to read the test code itself. So these mappings are being maintained for absolutely no benefit. Just don’t do it.</p>

<h3 id="pitfall-3-having-non-developers-write-feature-files">Pitfall 3: Having non-developers write feature files</h3>

<p>Many BDD books advocate for this idealized world where product managers or stakeholders write the feature files directly. I think the idea is it will force them to actually think through the detailed requirements before handing them to developers. I’ve never seen this actually work in practice. While the feature file language may seem very open-ended and expressive to a developer, it is still a pretty constraining format for a product manager to use, and they tend to be much more comfortable writing actual prose in a document editor like Word.</p>

<p>Also, as I’ll cover below, since scenario steps have to map to executable code, writing feature files becomes a bit of an art where you not only specify requirements, but do it in such a way that the underlying step implementations are maintainable. A product manager will quickly become frustrated when developers code review their feature file and have all kinds of comments related to implementation of the feature scenario steps and fewer comments about the actual scenario content.</p>

<p>Finally, I think having developers translate requirements documents into feature files really helps them internalize the requirements of the feature. It also empowers them to ask many questions about different edge case scenarios that the product team may not have considered. If a developer was just handed a feature file, they may not scrutinize it or think through it the same way they do when they write it themselves.</p>

<h3 id="pitfall-4-scenarios-contain-too-many-low-level-details">Pitfall 4: Scenarios contain too many low-level details</h3>

<p>When developers write feature files, they’re also thinking about the underlying step implementations. Tools like Cucumber provide rich features for parameterizing steps, even allowing tables of data to be passed into a step implementation function. It’s very tempting as a developer to try to minimize duplication in the step implementation functions by pushing more details into parameters which show up in your feature file.</p>

<p>I recommend using the step parameters feature of Cucumber <em>very sparingly</em> and to <em>never</em> use more advanced features like data tables. You should optimize for readability of the feature files by non-developers, which usually means pushing lower level, superfluous details about the scenario down into the step implementation. Do yourself (and your management/stakeholders) a favor and DON’T write scenarios like this:</p>

<div class="language-gherkin highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># Don't do this!</span>
<span class="kn">Scenario</span><span class="p">:</span> Customer creates a checking account
  <span class="nf">When </span>the customer opens an account with the following data
  <span class="p">|</span> <span class="nv">First</span> <span class="nv">Name</span> <span class="p">|</span> <span class="nv">Last</span> <span class="nv">Name</span> <span class="p">|</span> <span class="nv">Type</span>     <span class="p">|</span> <span class="nv">InitialBalance</span> <span class="p">|</span>
  <span class="p">|</span> <span class="n">This</span>       <span class="p">|</span> <span class="n">Sucks</span>     <span class="p">|</span> <span class="n">CHECKING</span> <span class="p">|</span> <span class="n">0.00</span>           <span class="p">|</span>
  <span class="nf">Then </span>the new account should have the following data
  <span class="p">|</span> <span class="nv">First</span> <span class="nv">Name</span> <span class="p">|</span> <span class="nv">Last</span> <span class="nv">Name</span> <span class="p">|</span> <span class="nv">Type</span>     <span class="p">|</span> <span class="nv">Balance</span> <span class="p">|</span>
  <span class="p">|</span> <span class="n">This</span>       <span class="p">|</span> <span class="n">Sucks</span>     <span class="p">|</span> <span class="n">CHECKING</span> <span class="p">|</span> <span class="n">0.00</span>    <span class="p">|</span>
</code></pre></div></div>

<p>Hopefully it’s clear that all this additional detail takes away from the readability of the scenario. While precise, your product manager and stakeholders’ eyes will glaze over as they try to parse the meaning out of the unnecessary details.</p>

<h3 id="pitfall-5-step-implementations-can-turn-into-spaghetti-code">Pitfall 5: Step implementations can turn into spaghetti code</h3>

<p>Good patterns for step implementations is probably worth a separate blog post, but I’ll try to condense this down to the essentials. BDD tools allow each step in a scenario to map to a function call. However, for a given scenario, it’s very common that the steps need data that was collected in a previous step. This means your functions will have to share data between them. Ok so maybe you can make a class to hold your step definition functions and use instance variables to share the data between functions. However, you usually want to group your step definitions into separate logical groups so you don’t have a single monster class full of step definitions, and you’ll inevitably end up writing scenarios that use steps spanning more than one class. So basically, you need some global data that’s shared between step implementation functions. If you don’t have an organized way to manage this global data, and instead set it somewhat randomly as you implement steps, you’re going to end up with a spaghetti mess that’s very difficult to maintain.</p>

<p>The solution I’ve found to work well is to have a single class that manages writing the global data. It can be read from within any step implementation function, but it’s only written in one specific place. For example, when using BDD to test service APIs, I create a proxy class that wraps calls to that service. The proxy class saves any relevant information that may be needed by step implementation functions. Here’s an example of what that might look like in Java:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">BankingServiceProxy</span> <span class="o">{</span>
    <span class="kd">private</span> <span class="kd">final</span> <span class="nc">BankingService</span> <span class="n">service</span><span class="o">;</span>

    <span class="c1">// ...</span>

    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">openAccount</span><span class="o">(</span><span class="nc">OpenAccountRequest</span> <span class="n">request</span><span class="o">)</span> <span class="o">{</span>
        <span class="nc">BankAccountTestData</span><span class="o">.</span><span class="na">clearLastException</span><span class="o">();</span>
        <span class="nc">BankAccountTestData</span><span class="o">.</span><span class="na">setOpenAccountRequest</span><span class="o">(</span><span class="n">request</span><span class="o">);</span>
        <span class="k">try</span> <span class="o">{</span>
            <span class="nc">OpenAccountResponse</span> <span class="n">response</span> <span class="o">=</span> <span class="n">service</span><span class="o">.</span><span class="na">openAccount</span><span class="o">(</span><span class="n">request</span><span class="o">);</span>
            <span class="nc">BankAccountTestData</span><span class="o">.</span><span class="na">setAccountId</span><span class="o">(</span><span class="n">response</span><span class="o">.</span><span class="na">getAccountId</span><span class="o">());</span>
            <span class="nc">BankAccountTestData</span><span class="o">.</span><span class="na">setOpenAccountResponse</span><span class="o">(</span><span class="n">response</span><span class="o">);</span>
        <span class="o">}</span> <span class="k">catch</span> <span class="o">(</span><span class="nc">Exception</span> <span class="n">e</span><span class="o">)</span> <span class="o">{</span>
            <span class="nc">BankAccountTestData</span><span class="o">.</span><span class="na">setLastException</span><span class="o">(</span><span class="n">e</span><span class="o">);</span>
            <span class="c1">// suppress exceptions. Step implementations will check last exception to assert on call failures</span>
        <span class="o">}</span>
    <span class="o">}</span>

    <span class="c1">// ...</span>
<span class="o">}</span>
</code></pre></div></div>

<p>Then your step implementation for <code class="language-plaintext highlighter-rouge">When the customer opens a checking account with a $0 balance</code> looks something like this (annotations are specific to Cucumber-JVM):</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="kd">public</span> <span class="kd">class</span> <span class="nc">AccountSteps</span> <span class="o">{</span>
    <span class="kd">private</span> <span class="kd">final</span> <span class="nc">BankingServiceProxy</span> <span class="n">proxy</span><span class="o">;</span>

    <span class="c1">// ...</span>

    <span class="nd">@When</span><span class="o">(</span><span class="s">"the customer opens a (.*) account with a \\$(.*) balance$"</span><span class="o">)</span>
    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">the_customer_opens_an_account</span><span class="o">(</span><span class="nc">String</span> <span class="n">accountType</span><span class="o">,</span> <span class="kt">int</span> <span class="n">initialBalance</span><span class="o">)</span> <span class="o">{</span>
        <span class="nc">OpenAccountRequest</span> <span class="n">request</span> <span class="o">=</span> <span class="k">new</span> <span class="nc">OpenAccountRequest</span><span class="o">()</span>
            <span class="o">.</span><span class="na">withAccountType</span><span class="o">(</span><span class="n">accountType</span><span class="o">)</span>
            <span class="o">.</span><span class="na">withInitialBalance</span><span class="o">(</span><span class="n">initialBalance</span><span class="o">);</span>
        <span class="n">proxy</span><span class="o">.</span><span class="na">openAccount</span><span class="o">(</span><span class="n">request</span><span class="o">);</span>
    <span class="o">}</span>
<span class="o">}</span>
</code></pre></div></div>

<p>Note that the step implementation leaves saving global data to the proxy class. Then later steps can perform verifications on the saved data:</p>

<div class="language-java highlighter-rouge"><div class="highlight"><pre class="highlight"><code>    <span class="nd">@Then</span><span class="o">(</span><span class="s">"a new (.*) account should be created"</span><span class="o">)</span>
    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">a_new_account_should_be_created</span><span class="o">(</span><span class="nc">String</span> <span class="n">accountType</span><span class="o">)</span> <span class="o">{</span>
        <span class="n">assertThat</span><span class="o">(</span><span class="nc">BankAccountTestData</span><span class="o">.</span><span class="na">getLastException</span><span class="o">()).</span><span class="na">isNull</span><span class="o">();</span>
        <span class="n">assertThat</span><span class="o">(</span><span class="nc">BankAccountTestData</span><span class="o">.</span><span class="na">getOpenAccountResponse</span><span class="o">()).</span><span class="na">isNotNull</span><span class="o">();</span>
        <span class="n">assertThat</span><span class="o">(</span><span class="nc">BankAccountTestData</span><span class="o">.</span><span class="na">getOpenAccountResponse</span><span class="o">().</span><span class="na">getStatus</span><span class="o">()).</span><span class="na">isEqualTo</span><span class="o">(</span><span class="nc">BankAccount</span><span class="o">.</span><span class="na">Status</span><span class="o">.</span><span class="na">OPEN</span><span class="o">);</span>
        <span class="n">assertThat</span><span class="o">(</span><span class="nc">BankAccountTestData</span><span class="o">.</span><span class="na">getOpenAccountResponse</span><span class="o">().</span><span class="na">getType</span><span class="o">()).</span><span class="na">isEqualTo</span><span class="o">(</span><span class="nc">AccountType</span><span class="o">.</span><span class="na">valueOf</span><span class="o">(</span><span class="n">accountType</span><span class="o">.</span><span class="na">toUpperCase</span><span class="o">()));</span>
        <span class="c1">// ...</span>
    <span class="o">}</span>

    <span class="nd">@Then</span><span class="o">(</span><span class="s">"the call should fail"</span><span class="o">)</span>
    <span class="kd">public</span> <span class="kt">void</span> <span class="nf">the_call_should_fail</span><span class="o">()</span> <span class="o">{</span>
        <span class="n">assertThat</span><span class="o">(</span><span class="nc">BankAccountTestData</span><span class="o">.</span><span class="na">getLastException</span><span class="o">()).</span><span class="na">isNotNull</span><span class="o">();</span>
    <span class="o">}</span>
</code></pre></div></div>

<h3 id="pitfall-6-test-slowness">Pitfall 6: Test slowness</h3>

<p>As your suite of feature files grows, test run times can increase quite a bit. Frequently, the tests are doing similar setup/teardown operations, which can take time. I honestly haven’t found a silver bullet solution to this problem, because at this point, the benefits of BDD still far outweigh issues of long-running acceptance tests enough that we haven’t really dug into a good solution to this.</p>

<p>However, here are a few tips:</p>

<ol>
  <li>You can chain multiple When/Then groups into a single scenario to save on redundant test setup steps. Don’t go so overboard with this that your feature file becomes one long scenario. I tend to favor separate scenarios, but sometimes it makes sense to combine them. Use judgement to make sure you’re not compromising the readability of the feature file to non-developers.</li>
  <li>Make your step implementation global data class thread safe and use unique test data for each scenario so you can run your scenarios in parallel. I haven’t found a parallel test runner for Cucumber that I can just plug into our current build setup without much effort so I don’t have a good recommendation there. If others do, please comment! A quick and dirty solution is to setup your automated CI/CD pipeline to run each feature file as a separate test run so they can be run in parallel.</li>
</ol>

<h2 id="conclusion">Conclusion</h2>

<p>When used correctly, BDD is a very effective way to increase team collaboration, remove waste from the development process, and ensure integration tests are built incrementally along with every feature of a product. Hopefully this post sparks your interest in giving it a try!</p>]]></content><author><name>James Hood</name><email>james@jlhood.com</email></author><category term="quality" /><category term="testing" /><summary type="html"><![CDATA[I have yet to meet a software developer or manager who would disagree with the statement, “We should build quality software.” However, ensuring quality can feel like an uphill battle. I used to have this Despair.com poster in a frame on my desk, but it unfortunately got lost during one of the many building moves that happen when you work at Amazon. 😂]]></summary></entry><entry><title type="html">Twitch Livestream on Serverless Applications</title><link href="https://jlhood.com/twitch-livestream-on-serverless-applications/" rel="alternate" type="text/html" title="Twitch Livestream on Serverless Applications" /><published>2018-03-18T00:00:00+00:00</published><updated>2018-03-18T00:00:00+00:00</updated><id>https://jlhood.com/twitch-livestream-on-serverless-applications</id><content type="html" xml:base="https://jlhood.com/twitch-livestream-on-serverless-applications/"><![CDATA[<p>Last week I did my first <a href="https://www.youtube.com/watch?v=85CHEaIDBag&amp;t=13s">Twitch livestream</a> for AWS to get the word out about serverless applications. I had a lot of fun getting to share why I’m so excited about serverless applications, and why I think with the introduction of the new <a href="https://aws.amazon.com/serverless/serverlessrepo/">AWS Serverless Application Repository</a>, serverless applications will become an important evolution in the way we write software. This blog entry is a summary of what was covered in the livestream to help spread the word.</p>

<p>But first… Full Disclosure: I am the tech lead of the Serverless Application Repository, but I solemnly swear marketing did not put me up to writing this. All opinions are my own and do not represent the opinions of Amazon, its partners or subsidiaries, blah blah blah, you get what I’m saying. Ok let’s get to it!</p>

<h2 id="what-is-serverless">What is Serverless?</h2>

<p>Since serverless is still a relatively new concept for many developers, let’s level-set and briefly cover what it is. Building a serverless system means you use technologies where management of servers/hosts is abstracted away from you as the developer/operator. There are still servers behind the scenes of course, but the provider manages complexities like ensuring there are enough hosts to handle steady-state and peak loads, and the provider ensures operating systems are up to date with latest patches, etc. AWS kickstarted the serverless movement when they launched <a href="https://aws.amazon.com/lambda/">AWS Lambda</a> in 2014 and <a href="https://aws.amazon.com/api-gateway/">Amazon API Gateway</a> 2015, enabling both frontend and backend applications to be written without having to worry about host management at all.</p>

<h2 id="what-is-a-serverless-application">What is a Serverless Application?</h2>

<p>The current definition of a serverless application is kind of <a href="https://xkcd.com/703/">tautological</a> in that it is an application built entirely out of serverless technologies. While this is true, it doesn’t capture what I think is really interesting and important about serverless applications. The <a href="https://github.com/awslabs/serverless-application-model">AWS Serverless Application Model (SAM)</a> gets us closer to a workable definition. It defines a serverless application as a collection of cloud resources that don’t require server management. So a serverless application is a collection of resources like AWS Lambda Functions, Amazon S3 Buckets, Amazon DynamoDB Tables, etc. There isn’t really a requirement for which resources must be in a serverless application. For example, you can have a serverless application that does not contain any AWS Lambda Functions at all. However, you would not include an Amazon EC2 Instance in a serverless application.</p>

<h2 id="the-aws-serverless-application-repository">The AWS Serverless Application Repository</h2>

<p>At re:Invent 2017, AWS announced the private preview launch of the <a href="https://aws.amazon.com/serverless/serverlessrepo/">AWS Serverless Application Repository</a>, which later became generally available in Febrary of 2018. The Serverless Application Repository allows you to discover, configure, and deploy serverless applications to your AWS account. You can also publish your own serverless applications for others to deploy.</p>

<p>Companies like Datadog, HERE, and Splunk have already published serverless applications to help customers more easily integrate with their products and services. I think this is a very smart way for businesses to use the Repository.</p>

<p>However, there is another type of serverless application that I am especially excited about and will devote the rest of this blog entry to: Serverless Applications can be used as generic, reusable components to save time building larger, more complex serverless applications. During the Twitch livestream, I talked through a few serverless applications I wrote to showcase the potential of this pattern.</p>

<h2 id="aws-serverless-sqs-event-source">AWS Serverless SQS Event Source</h2>

<p>One of the powerful things about AWS Lambda functions is their ability to be “triggered” by other AWS services. For example, putting an object to an Amazon S3 bucket or putting an item to a DynamoDB table can trigger your Lambda function to take some action asynchronously. While Lambda is integrated with many AWS services, one notable exception is Amazon Simple Queue Service (Amazon SQS). The <a href="https://github.com/awslabs/aws-serverless-sqs-event-source">AWS Serverless SQS Event Source</a> serverless application fills this gap by providing an app you can deploy to poll an SQS queue you specify and invoke your Lambda function to process messages on that queue. Let’s take a look at the application architecture:</p>

<p><img src="https://github.com/awslabs/aws-serverless-sqs-event-source/raw/master/images/app-architecture.png" alt="SQS Event Source App Architecture" /></p>

<ol>
  <li>The SQSPoller Lambda function is triggered every 1 minute by a CloudWatch Events Rule (think of it like a cloud-based cron).</li>
  <li>If messages are received from the queue, the SQSPoller invokes the MessageProcessor Lambda function (given as a parameter when you deploy the application) to process a batch of messages.</li>
  <li>The MessageProcessor function is expected to return a response indicating processing results of the message. Depending on the processing result, the SQSPoller will either delete the message from the queue (success case) or retry the message again later.</li>
</ol>

<p>The use of a user-defined Lambda function as an extension point is very powerful. It allows the SQS Event Source app to stay generic and focused on handling interactions with the SQS queue, while delegating the application-specific message handling logic to the Lambda function you specify at deploy time. Another thing that’s powerful about using Lambda in this way is that, although I decided to write this serverless application in Java, the MessageProcessor Lambda function provided by the user can be written in any language supported by the AWS Lambda runtime. The fact that I used Java is just an implementation detail that doesn’t affect users of the app.</p>

<p>What I really like about this example is it shows that, although AWS’s speed of feature delivery is incredibly fast, rather than waiting for AWS to fill in a feature gap, serverless applications empower you to fill the gap yourself! Then the Serverless Application Repository allows you to share your solution with others so they can benefit too. As this idea becomes more widespread, it’ll become more and more likely that someone else may have already filled the gap for you and you can just use their app, further saving you time.</p>

<p>While filling in feature gaps is great, let’s take a look at an example of an app that provides an event source for Lambda that AWS probably wouldn’t ever support as a 1st party feature…</p>

<h2 id="aws-serverless-twitter-event-source">AWS Serverless Twitter Event Source</h2>

<p>The <a href="https://github.com/awslabs/aws-serverless-twitter-event-source">AWS Serverless Twitter Event Source</a> app turns a Twitter search query into an AWS Lambda event source by invoking a given Lambda function to process tweets found. It works by periodically polling the freely available <a href="https://developer.twitter.com/en/docs/tweets/search/overview/standard">Twitter Standard Search API</a> and invoking a Lambda function you provide to process any tweets returned. Let’s take a look at its architecture:</p>

<p><img src="https://github.com/awslabs/aws-serverless-twitter-event-source/raw/master/images/app-architecture.png" alt="Twitter Event Source App Architecture" /></p>

<ol>
  <li>The TwitterSearchPoller Lambda function is periodically triggered by a CloudWatch Events Rule.</li>
  <li>In stream mode, a DynamoDB table is used to keep track of a checkpoint, which is the latest tweet timestamp found by past searches.</li>
  <li>The poller function calls the Twitter Standard Search API and searches for tweets using the search text provided as an app parameter.</li>
  <li>The TweetProcessor Lambda function (provided by the app user) is invoked with any new tweets that were found after the checkpoint timestamp.</li>
  <li>If stream mode is not enabled, the TweetProcessor Lambda function will be invoked with all search results found, regardless of whether they had been seen before.</li>
</ol>

<p>This app is a little more complex due to the additional “stream mode” feature. However again, the key here is that the app is written in a generic way. You provide the search query text as a parameter to the app when you deploy it to your account. The app handles interactions with Twitter’s Search API, but delegates the actual processing of the tweets returned to a Lambda function you specify. Your Lambda function can do whatever it wants with the tweets that are passed to it by the app.</p>

<h2 id="retweet-leaderboard">Retweet Leaderboard</h2>

<p>In order to show an example of what you could do with a generic app like this, I decided to write a fun, interactive game that the Twitch viewers could play live. During the livestream, we asked our viewers who also had a Twitter account to tweet a specific tweet that had a certain combination of hashtags. The goal of the game was to get as many people as possible to retweet their tweet. The Twitter handles with the most retweets would appear on a leaderboard UI that was updating in realtime throughout the livestream. It was a fun way to engage with the Twitch audience, but more importantly, I built the <a href="https://github.com/jlhood/retweet-leaderboard">Retweet Leaderboard</a> game as a serverless application that relies on the Twitter Event Source app to send it the latest tweets by players of the game. Here’s the architecture of the Retweet Leaderboard app:</p>

<p><img src="https://github.com/jlhood/retweet-leaderboard/raw/master/images/app-architecture.png" alt="Retweet Leaderboard App Architecture" /></p>

<ol>
  <li>The AWS Serverless Twitter Event Source app periodically invokes the TweetProcessor Lambda function to process tweet search results.</li>
  <li>The TweetProcessor updates the Leaderboard DynamoDB table with latest tweet counts for each Twitter user.</li>
  <li>The UI makes a GET request to the LeaderboardApi, which invokes the GetLeaderboard Lambda function to return the latest results. Results are returned in leaderboard order where the largest number of retweets wins. If there is a tie in retweets, number of favorites is used as a tie-breaker.</li>
</ol>

<p>This app was really fun to write and the audience seemed to enjoy the game. However, what I think is really powerful about this pattern is (1) this app does not need to interact with the Twitter Search API directly at all thanks to the Twitter Event Source app, and (2) it was insanely quick to write. I had the idea for the Retweet Leaderboard game literally the day before the Twitch broadcast while having breakfast with my kids. I went to work and had the initial version working that afternoon. Already having the Twitter Event Source app available really accelerated development of the Retweet Leaderboard game, which was really exciting.</p>

<h2 id="whats-next">What’s Next?</h2>

<p>Hopefully at this point, you’re as excited by the potential of serverless applications as I am. I know this is a big statement, but I honestly believe they have the potential to be the next evolution in the way we write software. While serverless technologies remove huge amounts of <em>infrastructure</em> complexity and <em>operational</em> burden from the developer, I believe serverless applications remove <em>application-level</em> complexity and <em>development</em> burden from the developer. This will bring us another big step towards being able to focus more and more time on the unique business logic of our applications by reducing the amount of generic integration logic we have to write.</p>

<p>My hope in writing the above apps is to inspire others to get involved and write more apps like these. As a community, we can unlock many different event sources for AWS Lambda, further increasing our ability to use it in our applications. We can also write serverless apps that solve common generic problems in serverless architectures (I hope to write more on this soon).</p>

<p>If you’re interested in learning more, but aren’t sure where to start, check out the Twitch livestream and then look at the apps I’ve written above. All 3 of them are open source and publicly available on the AWS Serverless Application Repository. If you look at the Retweet Leaderboard app, I include full installation instructions to allow you to deploy and recreate the game that we played on Twitch.</p>

<p>Let me know what you think!</p>]]></content><author><name>James Hood</name><email>james@jlhood.com</email></author><category term="AWS" /><category term="serverless" /><category term="serverless-applications" /><summary type="html"><![CDATA[Last week I did my first Twitch livestream for AWS to get the word out about serverless applications. I had a lot of fun getting to share why I’m so excited about serverless applications, and why I think with the introduction of the new AWS Serverless Application Repository, serverless applications will become an important evolution in the way we write software. This blog entry is a summary of what was covered in the livestream to help spread the word.]]></summary></entry><entry><title type="html">Sprint Demo/Retrospective Best Practices</title><link href="https://jlhood.com/sprint-demo-retrospective-best-practices/" rel="alternate" type="text/html" title="Sprint Demo/Retrospective Best Practices" /><published>2017-08-27T00:00:00+00:00</published><updated>2017-08-27T00:00:00+00:00</updated><id>https://jlhood.com/sprint-demo-retrospective-best-practices</id><content type="html" xml:base="https://jlhood.com/sprint-demo-retrospective-best-practices/"><![CDATA[<p>Scrum is my personal development methodology of choice. A key reason I like Scrum so much is because it allows you to frequently practice estimating software and evaluating how well you did after the sprint is complete through retrospective. I frequently call out late software as the most common first step down the path of the <a href="/bad-habits-we-learn-in-school/#the-vicious-cycle-of-software-development">Vicious Cycle of Software Development</a>, so I’m passionate about helping teams get this right.</p>

<p>Often, teams I’ve spent time with aren’t sure what to talk about during retrospective meetings. They may discuss what went well and what didn’t in the sprint in a freeform way. I’ve seen cases where they just play up accomplishments and minimize failures. Or when discussing failures, they may use the time as a venting session and fail to exit with any concrete plans for preventing making the same mistakes again next time.</p>

<p>Here’s the structure/format I’ve found that has worked well across multiple teams. On the last day of the sprint, have a combined meeting for demo and retrospective. I generally schedule 2 hours for this and then we can always finish early if we run out of things to talk about, but adjust as needed for your team.</p>

<h2 id="demo">Demo</h2>

<p>Sprint Demo is where you get to share the accomplishments from the sprint with your team. A common pitfall I see is for developers to be reluctant to demo their accomplishments, because they think the accomplishments are not significant enough to impress management or stakeholders. Don’t think of sprint demos as being for management and/or stakeholders. I always coach devs to give demos to their teammates, not management. This helps them feel less nervous and removes the pressure of everything having to go perfectly. Sprint demos should not be thought of as a vehicle to impress. I’ve found they are much more valuable as a knowledge sharing, and even bug finding tool.</p>

<p>You may not realize it, but there are probably people on your team who have no idea what you’re actually working on. This can be surprising to some because everyone participates in estimating all sprint stories during planning. But the level of understanding a person needs to contribute to a story-level estimate is different than having a deep understanding of the feature. A demo can really solidify the concept for other devs on the team. This is helpful in a few ways. It increases everyone’s sense of ownership over all of the team’s software, and in teams that practice devops, it provides some of the cross-training necessary to support the team’s software in production.</p>

<p>Demos can also be great for finding bugs. If you remove the expectation that the demo has to impress people, you’ll start getting a lot of questions like, “What happens if you click on X, or enter Y input?” Ideally everything works correctly and the team just learns about how the software is expected to behave in those circumstances, however sometimes the software doesn’t work correctly and can be fixed before causing any customer-facing issues.</p>

<p>Remember, it’s important to celebrate accomplishments, no matter how small they may seem relative to the entire project. Integration tests and backend APIs may seem like they’re not worth demoing, but demo them anyway.</p>

<h2 id="retrospective">Retrospective</h2>

<p>Retrospective is, in my opinion, the most critical part of practicing Scrum. It’s the key opportunity to improve your development process for future sprints. I’ve found the best way to start the discussion is with objective data. The scrum master should prepare the following data prior to Retrospective (ideally through an automated script) and lead off by presenting it to the team:</p>

<ol>
  <li>Number of stories complete/incomplete. Be very strict about this. If it’s not fully complete, do not count it as complete.</li>
  <li>Point completion % = (sum of estimated points on completed stories / sum of estimated points on all committed stories * 100%). It’s important to note I’m only paying attention to the estimated points here. This gives better visibility into how well your estimate ended up matching reality.</li>
  <li>Avg velocity = (sum of estimated points on completed stories / number of available dev days in the sprint * 100%). This is your measured velocity per person, per available day. It’s important to note that number of available dev days is computed as part of sprint capacity planning. So this is the number of days in the sprint * number of devs minus any planned days out of the sprint (vacation, holidays, oncall, etc). For our team, we also subtracted the last day of the sprint for all devs to account for time spent on sprint overhead (planning/demo/retrospective).</li>
  <li>Trending Avg velocity = mean avg of the avg velocity values for the last 6 (or whatever you choose) sprints. This value should be used to set your capacity for next sprint.</li>
  <li>Emergent stories (stories created after planning). Not a metric, but these should be discussed during retrospective. Why weren’t these accounted for during planning? What can we do to minimize emergent work and foresee this kind of work in future sprints?</li>
  <li>Ballooning stories (stories that took longer than estimated). These should be discussed. Why did this take longer than expected? What can we do to improve our estimates for this kind of work in future plannings?</li>
</ol>

<p>Gathering this data forces your team to take an objective look at how successful the sprint was. The goal, of course is all stories complete and a completion % of 100%. On the teams I’ve been on, the completion rate has always started out much lower than this. This starts a great discussion into what happened. <strong>It’s important to understand that retrospective should not be a blaming/shaming session.</strong> If management and team members have put time and effort into creating a healthy, psychologically safe team environment, chances are good that everyone’s doing their best. Focus on finding the root causes of the problem and then determine concrete mechanisms you can put in place to prevent the mistakes from being repeated.</p>

<p>Examples of actions taken in the past are to add items to existing checklists or create new checklists. I’m a strong advocate of checklists as a simple, lightweight mechanism for ensuring consistency. For example, a story may have ballooned because you completely forgot to call out integration tests during planning, resulting in underestimation. A feature checklist can help your team consistently consider creating subtasks for all aspects of a feature. Another learning from the past was if we are adopting new technologies/frameworks, we may need to lower capacity (either at the individual or team level) to account for ramp up time. When we ran into this on one team, our retrospective action item was to add an item to our capacity planning checklist to ask this question in the future, prior to planning.</p>

<p>Another best practice is to review action items from past retrospectives and determine if the changes you tried are actually helping or not. It’s very important to understand that modifying your process does not always mean adding something new. Sometimes tweaking something or removing it completely is best. That way your process stays lean and doesn’t start to become the dreaded bureaucracy.</p>

<p>If you don’t feel you’re getting much value out of your demo/retrospective meetings or worse, you don’t even have them, I encourage you to try out this format and see if it helps. If you have any other tips on demos/retrospective, please add them to the comments!</p>]]></content><author><name>James Hood</name><email>james@jlhood.com</email></author><category term="agile" /><category term="scrum" /><category term="demo" /><category term="retrospective" /><summary type="html"><![CDATA[Scrum is my personal development methodology of choice. A key reason I like Scrum so much is because it allows you to frequently practice estimating software and evaluating how well you did after the sprint is complete through retrospective. I frequently call out late software as the most common first step down the path of the Vicious Cycle of Software Development, so I’m passionate about helping teams get this right.]]></summary></entry><entry><title type="html">Plan All of the Things!</title><link href="https://jlhood.com/planning-all-of-the-things/" rel="alternate" type="text/html" title="Plan All of the Things!" /><published>2017-08-15T00:00:00+00:00</published><updated>2017-08-15T00:00:00+00:00</updated><id>https://jlhood.com/planning-all-of-the-things</id><content type="html" xml:base="https://jlhood.com/planning-all-of-the-things/"><![CDATA[<p>In my previous post, <a href="/bad-habits-we-learn-in-school">Bad Habits We Learn in School</a>, I touched on the fact that software is notoriously difficult to estimate accurately, and when we are wrong, we tend to be wrong on the side of underestimation (sometimes by as much as 4-6 times!). This is hugely problematic, because severe underestimation is the first step towards late software, which puts you right onto the path of the <a href="/bad-habits-we-learn-in-school/#the-vicious-cycle-of-software-development">Vicious Cycle of Software Development</a>. So learning how to increase our accuracy in estimating software is a vitally important skill to develop.</p>

<p>In this post, I want to tackle one common root cause of underestimation: simply forgetting to account for critical work while planning out features or a project. It sounds silly, but it happens far more often than you think.</p>

<h2 id="feature-level-planning">Feature-level Planning</h2>

<p>First, let’s start with feature-level planning. When planning the implementation of a feature, it’s important to explicitly take into account all possible aspects. Here’s how I picture the anatomy of a feature:</p>

<p><img src="/images/feature-anatomy.png" alt="Anatomy of a Feature" /></p>

<p>Not every feature requires all of the above pieces depending on its size and scope. However, I’ve seen teams repeatedly forget to plan for many of the quality measures listed above. Over time this compounds, leading to huge gaps in quality and technical debt that is a hard sell to the business to go back and address after the fact. So planning for quality up front saves you a lot of pain down the road.</p>

<p>Let’s take a look at these pieces in more detail.</p>

<h3 id="core-implementation">Core Implementation</h3>

<p>The first major category of a feature is the core implementation, made up of functional code, unit tests, and integration tests.</p>

<p>Functional code is the code that implements the desired feature behavior. Unit tests test your functional code in isolation. Dependencies are mocked allowing for several edge cases to be covered. Unit tests are your first line of quality defense and should never be skipped, because they’re so easy to write. Some teams push for using <a href="https://en.wikipedia.org/wiki/Test-driven_development">Test-Driven Development</a> (TDD), which ensures unit tests are always included. I’ve found some developers can be really resistant to TDD, so I side-step that argument by instead having a rule that functional code and unit tests must always be included together in the same commit. You can write the functional code first and then your unit tests or the other way around. I really don’t care as long as they’re both there.</p>

<p>Integration tests are more complex tests where you test your functional code against other system dependencies. There are many flavors of integration tests, such as functional tests, system tests, acceptance tests, etc. For the sake of this post, I’m just using the term integration tests to cover any and all of these kinds of tests. Unlike unit tests, it’s not usually practical to write integration tests in the same commit as your functional code changes. As a result, it’s embarrassingly common to forget to account for time spent writing integration tests when planning your feature.</p>

<p>In recent years, I’ve become a fan of <a href="https://en.wikipedia.org/wiki/Behavior-driven_development">Behavior-Driven Development</a> (BDD) as a means to address this, at least at the acceptance (user-facing) test level. BDD feature files are a nice way to document expected behavior of the feature as a whole, and ensure what you plan to build is what the business is expecting. Since you write feature files up front during requirements clarification, it’s easier to remember to plan for actually implementing all or a subset of them as automated acceptance tests later on.</p>

<h3 id="opslaunch-support">Ops/Launch Support</h3>

<p>The second major category of a feature is operations and launch support, made up of metrics, alarms, ops dashboards, and feature toggles.</p>

<p>Metrics give you visibility into how your code is working in production. I have this as a separate component of a feature, however generally, metrics are something I try to think about and insert into the functional code as I’m building a feature. Automated alarms are used to notify you if your code is behaving outside of normal error or latency thresholds. Ops Dashboards give you an at-a-glance view of the health of your system by displaying key metrics. For major feature launches, it can be very useful to have a dedicated dashboard of key metrics to ensure the feature is working correctly. Smaller features may not require a dedicated dashboard, but you should consider whether this feature warrants adding new graphs to any existing dashboards.</p>

<p><a href="https://martinfowler.com/bliki/FeatureToggle.html">Feature toggles</a> are a way to decouple deployment of code changes from release of a feature. These are flags that are embedded in your functional code, allowing you to silently deploy your feature into production. Then when you’re ready to actually make the feature go live, you toggle the feature on (usually by updating a toggle value in a database). Feature toggles are powerful, because they allow you to nearly instantaneously launch your feature, and–equally important–unlaunch your feature if things go wrong, which is far faster than deploying new code to your production systems. Since you have to write your functional code such that it can work one way with the toggle off and another with the toggle on, it’s important to consider whether this is necessary for your feature and plan for it in advance.</p>

<h3 id="dont-forget">Don’t forget!</h3>

<p>One thing I’ve found to help in planning a feature is to use a literal checklist of the above items during backlog grooming/sprint planning to ensure you’re considering which ones are necessary and then explicitly create stories/tasks for them. Similarly, I’ve seen teams who leverage templates in their sprint/issue tracking system include these items in their story templates.</p>

<h2 id="project-level-planning">Project-level Planning</h2>

<p>Like I said before, routinely forgetting things at the feature-level compounds over time causing huge quality problems. However, there are also similar misses that can happen during project-level planning. At larger companies, project-level planning is often important for trying to determine rough counts of how many people will be needed to deliver a project by a certain date. These kinds of estimates are far less accurate due to the huge amount of ambiguity involved when trying to estimate a project that will take several months. The general strategy is to try to enumerate as many big pieces as you can think of and then give them very rough sizings.</p>

<p>Brainstorming these big pieces of a project is another opportunity to forget to account for major pieces of work that are required. In this case, I find teams generally do a good job of thinking of the features that make up the core customer-facing functionality of their project. It’s the non-customer-facing features that tend to be forgotten. Here are the ones I see get forgotten on a fairly regular basis:</p>

<ol>
  <li>Disaster planning - For projects with high availability requirements, it’s important to go through a disaster planning exercise where you walk through key dependencies and exposures in your architecture and brainstorm mitigations. These mitigations often involve building some set of tools to help in disaster recovery scenarios.</li>
  <li>Data Backup/Restore - Setting up backup/restore procedures for your datastores is easy to forget, but very painful if you need them and they aren’t there…</li>
  <li>Administrative tools - You may need to build special tooling for product owners or customer service associates to use to handle problem scenarios (process returns/refunds, ban/block misbehaving/fraudulent users, etc).</li>
</ol>

<p>Again, the above are not always required depending on the size and scope of the project, but it’s extremely frustrating when you need them and realize you forgot to account for them at all and must now scramble with your existing resources to fill the gaps.</p>

<hr />

<p>Accurate estimation of software is tough for many reasons, but hopefully these tips will help you fight underestimation by at least considering all aspects of features and projects. Do you have anything to add to my lists? Feel free to share in the comments!</p>]]></content><author><name>James Hood</name><email>james@jlhood.com</email></author><category term="agile" /><category term="quality" /><category term="planning" /><summary type="html"><![CDATA[In my previous post, Bad Habits We Learn in School, I touched on the fact that software is notoriously difficult to estimate accurately, and when we are wrong, we tend to be wrong on the side of underestimation (sometimes by as much as 4-6 times!). This is hugely problematic, because severe underestimation is the first step towards late software, which puts you right onto the path of the Vicious Cycle of Software Development. So learning how to increase our accuracy in estimating software is a vitally important skill to develop.]]></summary></entry><entry><title type="html">SimpleLeadership Interview</title><link href="https://jlhood.com/simpleleadership-interview/" rel="alternate" type="text/html" title="SimpleLeadership Interview" /><published>2017-08-06T00:00:00+00:00</published><updated>2017-08-06T00:00:00+00:00</updated><id>https://jlhood.com/simpleleadership-interview</id><content type="html" xml:base="https://jlhood.com/simpleleadership-interview/"><![CDATA[<p><a href="https://twitter.com/cmccarrick">Christian McCarrick</a> reached out to me a few months ago after finding my post, <a href="/how-to-set-team-technical-direction/">How to Set the Technical Direction for Your Team</a>. He asked if I would do an interview for his SimpleLeadership podcast to discuss that post further, as well as other technical leadership topics. The interview was a lot of fun and we had a good discussion. The podcast is free and available via <a href="https://itunes.apple.com/us/podcast/setting-technical-direction-for-your-team-james-hood/id1260241682?i=1000390267757&amp;mt=2">iTunes</a>, <a href="https://play.google.com/music/listen#/ps/Ivb3nmaqljrzjir3teixjahsxba">Google Play</a> or stream it directly from the <a href="http://simpleleadership.io/setting-the-technical-direction-for-your-team-with-james-hood/">SimpleLeadership blog</a>.</p>

<p>Hope this helps!</p>]]></content><author><name>James Hood</name><email>james@jlhood.com</email></author><category term="news" /><category term="interviews" /><summary type="html"><![CDATA[Christian McCarrick reached out to me a few months ago after finding my post, How to Set the Technical Direction for Your Team. He asked if I would do an interview for his SimpleLeadership podcast to discuss that post further, as well as other technical leadership topics. The interview was a lot of fun and we had a good discussion. The podcast is free and available via iTunes, Google Play or stream it directly from the SimpleLeadership blog.]]></summary></entry><entry><title type="html">Book Recommendations</title><link href="https://jlhood.com/book-recommendations/" rel="alternate" type="text/html" title="Book Recommendations" /><published>2017-08-05T00:00:00+00:00</published><updated>2017-08-05T00:00:00+00:00</updated><id>https://jlhood.com/book-recommendations</id><content type="html" xml:base="https://jlhood.com/book-recommendations/"><![CDATA[<p>A little while back, I added a <a href="/books/">Books</a> page to my website. However, it just contained an ugly widget of what I was currently reading provided by Goodreads. I finally got around to adding more content to this page. The currently reading data is still dynamically provided by Goodreads, but now its look and feel is more consistent with the rest of the site.</p>

<p>I also added several book recommendations. I opened up comments so you can add your own recommendations too.</p>

<p>Hope this helps and happy reading!</p>]]></content><author><name>James Hood</name><email>james@jlhood.com</email></author><category term="news" /><summary type="html"><![CDATA[A little while back, I added a Books page to my website. However, it just contained an ugly widget of what I was currently reading provided by Goodreads. I finally got around to adding more content to this page. The currently reading data is still dynamically provided by Goodreads, but now its look and feel is more consistent with the rest of the site.]]></summary></entry><entry><title type="html">There is No U in CRUD</title><link href="https://jlhood.com/there-is-no-u-in-crud/" rel="alternate" type="text/html" title="There is No U in CRUD" /><published>2017-07-25T00:00:00+00:00</published><updated>2017-07-25T00:00:00+00:00</updated><id>https://jlhood.com/there-is-no-u-in-crud</id><content type="html" xml:base="https://jlhood.com/there-is-no-u-in-crud/"><![CDATA[<p>REST is built around the concept of resources, represented as URIs. Making an HTTP call specifying an HTTP verb and a resource URI takes an action on the specified resource. Most REST frameworks provide generators where you specify a resource name, and the framework generates scaffolding around it. Unfortunately, many of these generators use the CRUD model (Create, Read, Update, Delete) as the default starting point. The resource is defined as a bag of attributes, using something like JSONSchema or a language-specific data object definition and then method stubs are generated to create, read, update and delete that resource.</p>

<p>While it’s good to give developers a starting point to work from, I have a big problem with using CRUD as that starting point for an API. The U in CRUD is my least favorite, although I’m not fond of the other letters, depending on the use case. But let’s talk about U. Generic update methods allow the client to update any field of the resource and then overwrite the existing version with the new version. However, if you allow clients to do this, your service API provides little value on top of whatever underlying datastore it’s using. One of the key value-adds of a service layer is enforcing business constraints on top of the underlying data, and resources <em>always</em> end up having business constraints.</p>

<p>But can’t we add business constraints to our update method? Let’s use a simple bank account resource as an example and see what happens. First, clients shouldn’t be able to call an API and just update their account balance to whatever they want. There might be a minimum balance for the account. Ok, so you add some checks to the update method such that if the account balance value is changed, it must be within a specified range. Problem solved? Well, no, not really. Any balance adjustment should be recorded as some kind of transaction, right? Was this a credit? A debit? A transfer? What if the client tries to change the account number? Is this allowed at all? Could that break other data relationships? It’s not hard to see how your update method implementation can quickly turn to spaghetti code the more questions we ask. I’ve seen teams go down this path where their code tries to infer what the intent of the client is from which fields are changed, and the code ends up a total mess.</p>

<p>So what’s the alternative? Personally, I’m a big fan of <a href="https://en.wikipedia.org/wiki/Domain-driven_design">Domain-Driven Design (DDD)</a> for designing any kind of API. DDD is based around the idea that software should be modeled after the real-world problem being solved. It creates a language for describing software in terms of key business objects called <em>Entities</em> or <em>Aggregates</em>. It also defines terms such as <em>Services</em>, <em>Value Objects</em>, and <em>Repositories</em>, which work together to solve problems in a particular business domain, or <em>Bounded Context</em> in DDD terms. You don’t have to use REST to use DDD, however, I find it works especially naturally with REST APIs, because REST resources map very well to DDD entities.</p>

<p>So what does all this mean? <strong>It means your API should be centered around domain objects and the <em>business operations</em> they provide</strong>. Business operations are the key alternative to the generic update method and all of its pitfalls. Let’s use the banking example from earlier to illustrate.</p>

<p>For a banking API, an obvious domain object (or entity in DDD terms) is an account, which models a bank account. Rather than following the CRUD model for accounts, we should define specific business operations that make sense to perform on a bank account. Here’s a good starter set of write operations:</p>

<ol>
  <li>Open - open a new account.</li>
  <li>Close - close an existing account.</li>
  <li>Debit - remove money from an account.</li>
  <li>Credit - add money to an account.</li>
</ol>

<p>These operations are specific and can enforce certain business constraints. For example, we may not want to allow crediting a closed account, and we can enforce our minimum balance check as part of the debit operation. On the read side, we can also provide specific queries that match our client use cases:</p>

<ol>
  <li>Load - load single account by its account id.</li>
  <li>Transaction history - list transaction history for an account.</li>
  <li>Customer accounts - list accounts for the given customer id.</li>
</ol>

<p>Now that we know what our business operations are, here’s an example of mapping them to a REST API:</p>

<ol>
  <li>POST /account - open a new account.</li>
  <li>PUT /account/&lt;accountId&gt;/close - close an existing account.</li>
  <li>PUT /account/&lt;accountId&gt;/debit - remove money from an account.</li>
  <li>PUT /account/&lt;accountId&gt;/credit - add money to an account.</li>
  <li>GET /account/&lt;acountId&gt; - load single account by its account id</li>
  <li>GET /account/&lt;accountId&gt;/transactions - list transaction history for an account.</li>
  <li>GET /accounts/query/customerId/&lt;customerId&gt; - list accounts for the given customer id.</li>
</ol>

<p>This looks a lot different than a basic CRUD API, but the key is that the operations allowed are specific and well-defined. This results in a better experience, both for the service implementor, as well as the client. The service implementation no longer has to guess what business operation is implied based on which attributes are updated. Instead, the business operation is explicit, which leads to simpler, more maintainable code. On the client side, it’s much clearer exactly what operations can and cannot be performed. If the API is documented well, for example, using a <a href="https://swagger.io/">Swagger</a> definition, it will also be very clear what the constraints of each API are.</p>

<p>Defining your APIs this way requires more up front thinking than a simple CRUD generator, but I think this is a very good thing. If you’re planning on exposing your API as a public endpoint, you are going to have to support that API for a very, very long time. Basically think of it as forever by software standards. I always encourage teams to take time up front on the things that are hard to change later, and APIs are the first example I give.</p>

<p>So resist the urge to follow the CRUD model for service APIs (REST or otherwise). Instead, use DDD to define your API in terms of domain objects and the business operations that can be performed against them.</p>

<p>If you want to see more examples of defining APIs in terms of domain objects, I recommend checking out the Amazon Web Services APIs. Look up the developer guide for any service and they should start with a section labeled “Key Concepts” or something similar. There, they describe the conceptual domain objects of the service. For example, S3 defines objects like Buckets, Objects, and Permissions. Kinesis has streams and shards. Once you understand the domain objects of a service, look at the API reference and skim the list of APIs for that service. What you’ll notice is the API is built around these domain objects, making it more intuitive to understand and use.</p>

<p>Hope this helps!</p>]]></content><author><name>James Hood</name><email>james@jlhood.com</email></author><category term="rest" /><category term="swagger" /><category term="crud" /><category term="design" /><summary type="html"><![CDATA[REST is built around the concept of resources, represented as URIs. Making an HTTP call specifying an HTTP verb and a resource URI takes an action on the specified resource. Most REST frameworks provide generators where you specify a resource name, and the framework generates scaffolding around it. Unfortunately, many of these generators use the CRUD model (Create, Read, Update, Delete) as the default starting point. The resource is defined as a bag of attributes, using something like JSONSchema or a language-specific data object definition and then method stubs are generated to create, read, update and delete that resource.]]></summary></entry><entry><title type="html">Productivity Tips</title><link href="https://jlhood.com/productivity-tips/" rel="alternate" type="text/html" title="Productivity Tips" /><published>2017-07-07T00:00:00+00:00</published><updated>2017-07-07T00:00:00+00:00</updated><id>https://jlhood.com/productivity-tips</id><content type="html" xml:base="https://jlhood.com/productivity-tips/"><![CDATA[<p>One of the new developer tips I gave in my previous post, <a href="http://jlhood.com/tips-for-new-software-developers/">Tips for New Software Developers</a>, was</p>

<blockquote>
  <p>Tip 3: Set boundaries on work hours from the very beginning…but work hard and efficiently during those work hours.</p>
</blockquote>

<p>I talked about how I’ve worked hard to become more and more efficient but didn’t provide any additional details. In this post, I’ll cover the key productivity tips that work well for me. But first, it’s important to establish the core principle that underlies all of these productivity tips:</p>

<p><em>The key to high efficiency is to <strong>consistently</strong> maximize the amount of <strong>consecutive hours</strong> you spend working on <strong>the things that matter most</strong></em>.</p>

<p>This is by far the most important takeaway from this post. All of the tips I’ll give are just ways I’ve found to achieve this. At first this may sound simple, however doing all 3 of the bolded parts takes a lot of discipline and practice.</p>

<p><strong>Productivity Tip 1: The TODO List</strong></p>

<p>I’ve already written about the way I manage my <a href="http://jlhood.com/the-power-of-the-todo-list/">TODO list</a> so I won’t spend too much time on it. However, looking at the core principle of productivity above, you can see that it ensures you’re thinking about priority on a daily basis, which covers the “consistently” and “the things that matter most” parts of the principle.</p>

<p>One more note on this before I move on: In order to be highly productive, you have to exercise <em>ruthless prioritization</em>. I like that phrase, because it gets across how aggressively you need to prioritize. One analogy I often use is to picture a ladder. You can expend a lot of energy climbing the ladder as quickly as you can. But if it’s leaning against the wrong building, all that effort is waste. Your time is a resource. Spend it wisely.</p>

<p><strong>Productivity Tip 2: Minimize Interruptions</strong></p>

<p>The TODO list helps me know what I need to work on. The final piece of the core principle is to spend “consecutive hours” on these important tasks. In the office, interruptions are the primary obstacle to achieving this. Here are the ways I minimize interruptions:</p>

<ol>
  <li>We have an open office floorplan at work, which can make the office area noisy and full of interruptions. If I have a lot of focused coding work to do, I’ll work from home when I can. Otherwise, I have a pair of noise-cancelling headphones that I use. I really like to listen to <a href="http://musicforprogramming.net/">musicForProgramming</a>.</li>
  <li>I turn off Outlook notifications and I close the program. I only open it at specific times of the day and check my email in batches (I try to carve out a 30-45 minute block of time to check and respond to email). Some people try to act like email is a realtime communication channel. Don’t be fooled. It’s not one.</li>
  <li>I block out large sections of my calendar at the times when I’m most productive (for me it’s in the morning when I first get to work). During that time, I’m careful not to start by checking email. That’s an easy way to squander your most productive time. Instead, I immediately jump into my prioritized list that requires the most brain power and focus. I save checking email for later in the day.</li>
  <li>Since I’m in a senior position, often many different people might approach me with questions, which can be a terrible source of interruptions. What’s worked well for me is to schedule explicit times when I’m available, e.g., office hours. If people still come to my desk I’ll politely remind them about office hours and ask that they bring it to the next session. Of course sometimes things can’t wait or it’s a really quick answer, but this helps reduce the number of random questions.</li>
</ol>

<p><strong>Productivity Tip 3: Meetings</strong></p>

<p>Ah meetings. No developer I know likes them, but they can be a necessary evil of the job. Here are my tips for meetings:</p>

<ol>
  <li>Do not be afraid to decline meetings. If it’s not a good use of your time and you don’t have something significant to contribute, skip it.</li>
  <li>For the meetings that are necessary, do your best to schedule them in batches. Nothing kills productivity like a swiss cheese calendar day (30 minute free blocks scattered throughout the day).</li>
  <li>Bias towards email as a substitute for meetings. Sometimes this ends up being more time-efficient.</li>
  <li>When you call a meeting, make sure it is run efficiently by doing the following:
    <ol>
      <li>State a clear objective ahead of time (it should go into the meeting invite). What are we trying to accomplish? What specific topics need to be discussed?</li>
      <li>Start on time and keep the group on task. If the objective is reached before the end of the alotted time, end early. There’s no need to stretch the meeting out just because you scheduled a full hour.</li>
      <li>Ask people to close their laptops so they’re actually present for the discussion. It can feel a bit uncomfortable to ask this, but people only think they can multitask. If their laptop’s open, they’re missing most of the conversation and are probably not being very effective at what they’re trying to do on their laptop. I tell people, either attend the meeting or don’t. They’re not doing anyone (including themself) any favors by being half present.</li>
      <li>Take notes during the meeting and email them out afterward with key decisions that were made and action items if any. Action items need an owner and a date or they’re not going to happen.</li>
    </ol>
  </li>
</ol>

<p><strong>Productivity Tip 4: Learn a scripting language and automate</strong></p>

<p>Early on while I was in college, I learned shell-scripting, and it has been an invaluable skill throughout my career. Being good at scripting gives you the power to automate mundane tasks away very quickly. Because I’ve used shell-scripting for so long, I always find it surprising when I see developers manually performing repetitive tasks that could easily be scripted. This happens much more frequently than I’d like, especially when working on “non-coding tasks,” like design documents, updating bug trackers, etc.</p>

<p>I’ve found myself saying to people, “Don’t forget you’re a developer! Be a developer!” What I mean by that is developers should not restrict their coding skills just to production code. Computers enhance productivity tremendously, and being a developer means you have the ability to make computers solve customized problems for you. Obviously, there’s a bit of quick cost/benefit judgement that should be employed. Don’t spend an hour writing a script when you only have to do the task once and it takes 5 minutes to do manually. However be aware that there’s also a long-term benefit in building your scripting skills to the point where you can whip out a script in 10-15 minutes that saves you hours.</p>

<p><strong>Productivity Tip 5: Utilize your commute to learn</strong></p>

<p>I have a pretty long commute to and from work, and it turns out to be the perfect time to listen to tech talks, audiobooks, and podcasts. This turns a normally tedious part of my day into an opportunity to learn about various tech topics.</p>

<p><strong>Productivity Tip 6: Exercise and get enough sleep</strong></p>

<p>Last and certainly not least is to exercise and get enough sleep. It can be extremely tempting to work late into the night. You feel like you’ll squeeze a few more hours out of the day and get ahead. But what I’ve learned and relearned (and relearned) in my career is that it always ends up evening out or setting you back. You may get a few hours of work in in the middle of the night, but then you can hardly function for the entire next day. Also, when your brain is exhausted, you take longer to do tasks that would normally be pretty easy. This can have psychological consequences since it can trigger Imposter Syndrome anxiety. Finally, when you’re exhausted, you tend to make mistakes that can create more work for yourself. It’s just not worth it.</p>

<p>This tends to be a very difficult one for developers to follow (me included!). I think it’s because of programmer stereotypes (the image of the lone coder working through the night), but I can’t stress enough how important this one is!</p>

<hr />

<p>Hope this helps! Again, these are just the tips that have worked well for me, but anything that helps you achieve the core principle I described at the beginning of this post works. Give them a try and let me know what you think. Do you have additional productivity tips? Let me know in the comments.</p>]]></content><author><name>James Hood</name><email>james@jlhood.com</email></author><category term="career" /><category term="productivity" /><category term="work-life-balance" /><summary type="html"><![CDATA[One of the new developer tips I gave in my previous post, Tips for New Software Developers, was]]></summary></entry></feed>