{"id":49,"date":"2016-12-01T14:36:44","date_gmt":"2016-12-01T14:36:44","guid":{"rendered":"http:\/\/freedville.com\/blog\/?p=49"},"modified":"2016-12-01T14:36:44","modified_gmt":"2016-12-01T14:36:44","slug":"test-driven-development-with-christmas-lights","status":"publish","type":"post","link":"https:\/\/freedville.com\/blog\/2016\/12\/01\/test-driven-development-with-christmas-lights\/","title":{"rendered":"Test driven development with Christmas lights"},"content":{"rendered":"<p>Several years ago\u00a0my wife decided to make custom multi-colored Christmas light strands by changing the individual light bulbs on solid-colored strands. The task seemed simple, if tedious, enough:<\/p>\n<p>Step 1. Get 100 bulb strands of red, white, green lights.<\/p>\n<figure id=\"attachment_56\" aria-describedby=\"caption-attachment-56\" style=\"width: 300px\" class=\"wp-caption alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-56\" src=\"http:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/christmas_lights_boxes_cropped-300x155.jpg\" alt=\"Boxes of red, white, and green Christmas lights that you can buy at any big box hardware store\" width=\"300\" height=\"155\" \/><figcaption id=\"caption-attachment-56\" class=\"wp-caption-text\">Boxes of Christmas lights<\/figcaption><\/figure>\n<p>Step 2. In each strand, skip one bulb, remove two and place into bins, repeat until end of strand.<\/p>\n<figure id=\"attachment_59\" aria-describedby=\"caption-attachment-59\" style=\"width: 300px\" class=\"wp-caption alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-59\" src=\"http:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/christmas_light_bulbs_separated-1-300x225.jpg\" alt=\"Light bulbs pulled out of light strands, separated by color, for later re-assembly\" width=\"300\" height=\"225\" \/><figcaption id=\"caption-attachment-59\" class=\"wp-caption-text\">Separated Christmas light bulbs<\/figcaption><\/figure>\n<p>Step 3. In each strand, take bulbs from the other two bins, replace lights in order, repeat until end of strand.<\/p>\n<figure id=\"attachment_58\" aria-describedby=\"caption-attachment-58\" style=\"width: 300px\" class=\"wp-caption alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-58\" src=\"http:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/unlit_christmas_lights-300x225.jpg\" alt=\"Newly constructed light strand with alternating red, white, and green\" width=\"300\" height=\"225\" \/><figcaption id=\"caption-attachment-58\" class=\"wp-caption-text\">Newly constructed light strand with alternating red, white, and green<\/figcaption><\/figure>\n<p>Step 4. Plug in each light strand.<\/p>\n<p>We followed this process, and after an hour we were ready for step 4. Veteran Christmas decorators know what happened next.<\/p>\n<p>Two bad strands.<\/p>\n<p>Why? \u00a0Christmas light bulbs are wired in series, meaning that one bad bulb will prevent the strand from lighting. For one more hour, we worked up and down the faulty light strands, looking for the bad bulb. We checked each bulb for a tight fit. Then we pulled each bulb out, furiously examining the connections, occasionally tweaking them. Every time we&#8217;d test the strand, we did not see any lights. Finally, we were able to fix all the strands. In total, we spent two stressful hours to create three multi-colored strands.<\/p>\n<figure id=\"attachment_57\" aria-describedby=\"caption-attachment-57\" style=\"width: 300px\" class=\"wp-caption alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-57\" src=\"http:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/lit_up_christmas_lights-300x225.jpg\" alt=\"Lit up light strand including alternating red, white, and green light bulbs\" width=\"300\" height=\"225\" \/><figcaption id=\"caption-attachment-57\" class=\"wp-caption-text\">Functioning multi-color Christmas light strand<\/figcaption><\/figure>\n<p>That night I laid in bed thinking about our experience. When we started, I felt great! We had an efficient plan. We would do the jobs in batches: finish one task (pulling out lights) before moving onto the next (putting in new lights). With no task-switching, it felt like we&#8217;d get done in no time. Unwittingly, we had followed the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Waterfall_model\">waterfall process<\/a> of doing Christmas lights.<\/p>\n<p>Our downfall, and the waterfall&#8217;s downfall, was not knowing where we introduced the errors. In that second hour, testing the lights like crazy but never certain that we were making things better instead of worse. In both hours, we were so busy that our perceived productivity was high, but our actual productivity does not. We did not introduce any testing until the end, like a software team that does not test until development is done.<\/p>\n<p>I realized an <a href=\"http:\/\/agilemanifesto.org\/\">agile<\/a>, <a href=\"https:\/\/www.agilealliance.org\/glossary\/tdd\/\">test-driven development<\/a> process would be the way to go. We would introduce regular testing into our process. Instead of time-boxed iterations we used lightbulb-boxed iterations. On the next set of strands, we stopped and tested each of the strands every three bulbs. While we had a lot of task-switching, we also had a high degree of certainty. Each test, either the whole strip worked, or one of the last two changed bulbs was faulty. Progress was slow but steady. We finished and had three working strips in 90 minutes.<\/p>\n<p>In the waterfall process of Christmas lights, we sped through the bulb changing (development) but got hung up in test. With the agile approach, our bulb changing (development) time increased 50% but the final test was a breeze. In each case, we made the same total number of mistakes, but in the agile approach we caught and corrected them faster.<\/p>\n<p>Test-driven development is a powerful concept. In my software development career, it has made me a better software developer. My wife&#8217;s Christmas lights showed me how powerful agile techniques are outside the compiler.<\/p>\n<figure id=\"attachment_64\" aria-describedby=\"caption-attachment-64\" style=\"width: 700px\" class=\"wp-caption alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-64\" src=\"http:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/christmas_lights_on_fence-3-700x467.jpg\" alt=\"Red, white, and green Christmas light strands\" width=\"700\" height=\"467\" srcset=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/christmas_lights_on_fence-3-700x467.jpg 700w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/christmas_lights_on_fence-3-300x200.jpg 300w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/christmas_lights_on_fence-3-768x512.jpg 768w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/christmas_lights_on_fence-3-175x117.jpg 175w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/christmas_lights_on_fence-3.jpg 960w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption id=\"caption-attachment-64\" class=\"wp-caption-text\">Using the new Christmas light strands to decorate our backyard fence (new strands in background)<\/figcaption><\/figure>\n<figure id=\"attachment_61\" aria-describedby=\"caption-attachment-61\" style=\"width: 700px\" class=\"wp-caption alignnone\"><img decoding=\"async\" loading=\"lazy\" class=\"size-large wp-image-61\" src=\"http:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/full_christmas_lights_display-700x467.jpg\" alt=\"Colorful Christmas lights display\" width=\"700\" height=\"467\" srcset=\"https:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/full_christmas_lights_display-700x467.jpg 700w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/full_christmas_lights_display-768x512.jpg 768w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/full_christmas_lights_display-175x117.jpg 175w, https:\/\/freedville.com\/blog\/wp-content\/uploads\/2016\/11\/full_christmas_lights_display.jpg 960w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption id=\"caption-attachment-61\" class=\"wp-caption-text\">Our final Christmas lights display (front yard)<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Several years ago\u00a0my wife decided to make custom multi-colored Christmas light strands by changing the individual light bulbs on solid-colored strands. The task seemed simple, if tedious, enough: Step 1. Get 100 bulb strands of&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[7,6],"_links":{"self":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts\/49"}],"collection":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/comments?post=49"}],"version-history":[{"count":3,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts\/49\/revisions"}],"predecessor-version":[{"id":66,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/posts\/49\/revisions\/66"}],"wp:attachment":[{"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/media?parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/categories?post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/freedville.com\/blog\/wp-json\/wp\/v2\/tags?post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}