Over the past few days a TDD debate has been raging (again) in the blog-o-sphere and on Twitter. A lot of big names have been making bold statements and setting out arguments, of both the carefully constructed and the rhetorically inflammatory variety. I'm not going to revisit those arguments - go read the relevant posts, which I have collected in a handy timeline at the end of this post. Everyone is right Instead of joining in the argument, I want to consider a conciliatory post by Cory House entitled "The TDD Divide: Everyone is right." He proposes an explanation for these diametrically opposed views, based upon where you are in the software development eco-system: Software “coaches” like Uncle Bob believe strongly in TDD and software craftsmanship because that’s their business. Software salespeople like Joel Spolsky, Jeff Atwood, and DHH believe in pragmatism and “good enough” because their goal isn’t perfection. It’s profit. This is a helpful observation to make. We work in different contexts and these affect our behaviour and colour our perceptions. But I don't believe this is the root cause of the disagreement. So what is? How skilled are you? In Japanese martial arts they follow an age old tradition known as Shu Ha Ri, which is a concept that describes the stages of learning to mastery. This roughly translates as "first learn, then detach, and finally transcend." (I don't want to overload you with Japanese philosophy, but if you are interested, please take a look at Endo Shihan's short explanation) This approach has been confirmed, and expanded on, in modern times by research conducted by Stuart and Hubert Dreyfus, which led to a paper published in 1980. There's a lot of detail in their paper, but this diagram shows the main [...]
How busy are you? Are you close to a deadline? Is the team feeling pressure? Every team I visit seems to be under the same heavy workload, and consequently has a lot of improvements to the process, the environment, the technology that they can't quite get to yet. They know they need to get to them, and they will.... when they have time. But they won't get time. Ever. TL;DR: Build slack into your iteration The nature of time When I started trying to write a book I spoke to a colleague, Jon Jagger. I whined that I just didn't seem to be finding the time and he replied with wise words: "You won't find the time. You've got to make the time." The same is true for any tasks that support the development team that don't obviously deliver immediate working software for the customer. The reasons for this are many, but the root cause is normally disempowered teams. Teams who ask their product owner to prioritise tasks that the product owner has no way of prioritising appropriately. Most POs should not be asked to choose between a user story that delivers a feature they understand and a technical task that they don't. It's a no-brainer - they'll always choose the user story to maximise customer value. Even if the technical task will actually deliver greater customer value. Before I continue, I'd like to remind you of two things: sustainable pace and commitment Sustainable pace The agile manifesto is quite restrained in its pronouncements. One of the 12 principles it states is this: "Agile processes promote sustainable development. The sponsors, developers, and users should be able to maintain a constant pace indefinitely." This doesn't mean we don't work hard. It doesn't mean we never come in early, [...]
Inspired by Sandi Metz's BaRuCo 2013 presentation "Rules" (which you should watch if you haven't yet) I started thinking about whether there were some rules that might be useful in the continuous delivery domain to "screen for cooperative types". I came up with these as a starting point: Check in everything - we're used to putting source code in version control, but we're often less good at configuration management. Do you control your test data? Your database scripts? Your operating system patch level? If not how can you be sure that the environment you provision tomorrow will be identical to the one you provisioned last week? Automate everything - "to err is human", as the saying goes. Any manual process is susceptible to failures, so get rid of as many as you can. Some continuous delivery pipelines still have manual approval steps in them as part of the process, but the presence of the human is not functionally essential. Continuous != occasionally - the more we do something, the easier it gets. One of the reasons to do something continuously is to decrease the cost and remove the fear. If it "costs too much" to deploy often, then work on reducing the cost not reducing the frequency. Collaborate - people are not plug compatible. To get the most from the different people in the organisation we need to work together. For me, this was one of the major "innovations" of devops - no more 'us' and 'them', just 'we'. One step at a time - it's hard to do everything all at once, which is why we iterate in software development. Continuous delivery is no different - don't expect everything to "just happen". Do these make sense to you? What essential ingredients [...]
I find myself recommending the same books over and over again. When speaking to techies I invariably recommend GOOS; when speaking to managers The Mythical Man Month or Waltzing With Bears. Over the past year or two, I've also pointed a lot of organisations at Continuous Delivery by Jez Humble and Dave Farley. It's an important book, but I think it could have been shorter, and that's an important consideration for the target audience. If you consider the other books I recommend that weigh in at 384, 336 and 196 pages respectively, Continuous Delivery extends to 512 and it feels longer. That's not because it isn't good - it is - but because it is detailed and quite dense. Last week I finally heeded Liz Keogh's advice and read The Phoenix Project ("a novel about IT, Devops and helping your business win"). In terms of prose style, it doesn't compete with Liz's own efforts, but it is very readable and does a great job of getting some quite tricky concepts across (Lean, Theory of Constraints, The Three Ways). The authors acknowledge their debt to Goldratt's The Goal, and indeed they are ploughing the same furrow, but in the field of software. Amazon says the print copy is 343 pages long, but I read it on the Kindle and it felt shorter than that. The reason I'm adding this book to my recommended list isn't just because it's short and readable. It's because it makes some very frightening concepts very easy to digest. I didn't know how to explain quite why I liked it so much until I found myself reading a Venkat Rao post this morning, where he describes how we change our minds: You have to: 1. Learn [...]
There has been a flurry of discussion about how to teach TDD, sparked off by a recent post from Justin Searls. In it he lists a number of failures that range from "Encouraging costly Extract refactors" to "Making a mess with mocks" all of which distract attention from the concept that "TDD's primary benefit is to improve the design of our code". He concludes by suggesting that once you have written a failing test, rather than get-to-green in the simplest way possible you should "intentionally defer writing any implementation logic! Instead, break down the problem by dreaming up all of the objects you wish you had at your disposal". In essence, design the elements of the solution while the first test is still red. It's an interesting post that raises a number of issues, but for me its value lies chiefly in opening the subject up for debate. The introduction is particularly pertinent - just setting a class a bundle of katas to do does not, of itself, encourage learning. The pains experienced while doing the exercise need to be teased out, discussed and have alternative approaches described. If you don't hear the penny drop, then it hasn't dropped. Pitching in with characteristic vigour and brimstone came Uncle Bob with a robust rebuttal containing both heat and light (though some have been put off by the heat and never got to the light). Bob makes some good points regarding the fallacy of writing tests around extracted classes, the tool support for extract refactoring and the central place of refactoring in the Red-Green-Refactor cycle. By the conclusion, however, Bob has switched tack. He states that while refactorings are cheap within architectural boundaries, they are expensive across them. Whether he's right or [...]
The software development community experiences fad after fad. Consultants and thought leaders dream up new methodologies; old practices are relabelled and promoted as the next big thing; flame wars are fought over names, tabs and brace position. One of the few practices that has stood the test of time is that of "eating your own dog food", which essentially means that you'll be the first user of any software that you're developing. In more polite (and optimistic) circles this is also known as "drinking your own champagne". When it comes to development practices, I think we need to adopt the same approach. If you're going to make dogmatic statements about how software should be developed, then you as a developer should be prepared to stick to them yourself. No more "do as I say, not as I do". It's time to eat your own dogma food.
Allan Kelly posted an article on DZone this week predicting that TDD would be a required skill for developers by 2022. Vishal Biyani asked on Twitter about how one might test TDD skills, and I promised to blog about my experience of using Cyber-Dojo in interview situations. Cyber-Dojo is a browser-based dojo environment developed by Jon Jagger that supports a lot of programming languages and xDD frameworks. It's great for dojos because it has few of the productivity frills that we've come to depend on over the years - no syntax highlighting; no autocompletion; no suggested fixes. That means we have to think about what we're doing, rather than relying on muscle memory. As Jon eloquently puts it in the FAQ: "Listen. Stop trying to go faster, start trying to go slower. Don't think about finishing, think about improving. Think about practising as a team. That's what cyber-dojo is built for." That might be what cyber-dojo was built for, but it turns out that it's also excellent as an interview environment. Your interviewee writes real code and has to diagnose with real compiler/runtime errors. They'll have to use a browser to remind themselves of all the basic knowledge that has atrophied during years of nanny-IDE development. And, best of all, there's no save, build or run functionality provided by cyber-dojo. There's only a single button and it's labelled nice and clear: TEST. Use one of the katas whose instructions have been helpfully included with cyber-dojo, or roll one of your own, and see how your interviewee responds. Every time they press the TEST button, all the code they've written is sent over to the server to be built & run and the response is returned, along with a traffic light: green for "all tests passed", red [...]
No, I'm not trawling through my xmas cracker jokes. I was looking through the programme for DevWeek 2014 and both my sessions are tagged as "Test". This is following a pattern started at ScanDev last year and followed by several other conferences at home and abroad. Why am I bothered? It's not that I mind being associated with testing at all. I don't think of testers as a lower form of life. I *love* testers. It's for the same reason that Dan North and Chris Matts started using the "should" word instead of the "test" word all those years ago - developers think that the test track is not for them. Both my sessions at DevWeek are about types of testing that developers should be doing routinely. "So long, and thanks for all the tests" explores what makes a test valuable and what practices developers should consider adopting. "Mutation testing - better code by making bugs" is an alternative to code meaningless coverage metrics that can help developers ensure they're sticking to their definition of done. Q. When is a tester not a tester? A. When they're a developer. You're right. It's not funny. So, it's ideal for a cracker.
This is a quote from Aslak Hellesoy on the Cukes Google group. "Even on this list, the majority of people seem to think that Cucumber == Automated Tests == BDD, which is WRONG. What people need to understand is: Cucumber is a tool for BDD Cucumber is a tool for Specification By Example Specification By Example is just a better name for BDD Specification By Example / BDD means examples (Scenarios) are written *before* implementation Specification By Example should happen iteratively, in collaboration with non-technical stakeholders Automated Tests are a by-product of Specification By Example Writing Automated Tests does *not* imply you're doing Specification By Example Using Cucumber for Automated Tests without doing Specification By Example is stupid Cucumber is not a tool for Automated Testing, it's a tool for Collaborative, Executable Specifications" Aslak Hellesoy - 12th December 2013 Cukes Google Group https://groups.google.com/forum/#!topic/cukes/XFB7CjWuI14
We're very good at rationalising. Almost any statement can be justified by the retroactive application of the twin constraints of "context" and "definition." As an example, Chris Matts (@papachrismatts) talked about the "death of Agile" in a recent blog post of his, and I took issue with that. We talked about it briefly at a couple of conferences and he explained why it made sense to him: - context: "Agile" as a set of recipes, not values (c.f. Scrum, SAFe, DAD and accompanying certifications) - definition: "Dead" means devalued through repeatedly over-promising and under-delivering I still don't think that agile has died, and neither does Chris in the general sense, but given the specific circumstances of his post the statement makes sense. But it took me time and effort to gain that understanding - time and effort that someone looking for a reference to support their view might not invest. Neil Killick (@neil_killick) makes a good point that we often use controversy to stimulate debate, so should we care that our words can be misinterpreted, or quoted out of context? I think the answer is sometimes. Influential members of any community should consider carefully how the constituency that they are addressing might (mis)interpret their statements. No matter how much you may hope that people will think for themselves, the pronouncements of "thought leaders" carry a weight that cannot be ignored. Misinterpretation of the written word is all too common, however. The "Three Amigos" meeting at the heart of Behaviour Driven Development (BDD) emphasises the need to have frequent, open, high bandwidth collaboration between technical and non-technical participants for just this reason. The differing perspectives of the participants challenge the implicit assumptions of the others. If you make strong assertions in your [...]