Testability and Cost of Change
Join the DZone community and get the full member experience.Join For Free
that thoughtworks consultants, with others, were at google for a year and a half on a mission to help socialize better testing practice, is now a matter of public record thanks to then team-mate mike bland. his 9699-word blog entry details a lot of google inside-knowledge and experience from the "test mercenaries" mission as well as his participation with "testing grouplet" which existed long before and after the test mercenaries mission. "design for testability" their war-cry before the mercenaries team was created, and will be i'm sure long after we've retired.
here's a synopsis of the 'cost of change curve':
"bugs are cheaper to find/resolve in a design stage, which is cheaper than finding them in development, which is cheaper than finding them in qa, which is cheaper than finding them in production"
it is an industry claim of course. it has been doing the rounds since barry boehm's 1981 book (software engineering economics), if not before that in 1976 in a ieee magazine article also by boehm. it is pertinent to traditional (waterfall) software development
one debatable aspect of the above is whether this is equally true for defects and changes. defects/bugs are implicit mistakes against an intended design. they range from tiny to large ones that have a negative financial impact. those impacts could merely be the cost of remediating it and re-deployment if that's applicable, or could include losing a fortune (say a trading platform buys stock instead of sells). changes could be small again (ui tweaks at a rapid-prototyping stage) through to "whoops, we've hockey-sticked and rexx is the wrong language for scale, everything needs to be rewritten from scratch' (very big). in fact the line between perceived defect and change is sometimes fine-grained.
design for testabilty fan fiction
back to the google mission: i conjured up some dollar values in order to use 'cost of change' to motivate google developers. i chose figures that are probably only applicable to google, and dwelled on cost of defect rather than change in the absence of defect.
indeed google, by my reckoning, had an incredibly low cost-of-change engineering setup. they achieved this by having an incredible build infrastructure, a hard-core focus of development best practices, and a rabid code approval rule-set than meant that all devs became better all the time. in terms of tooling, hard-core refactoring was a reality, at least for the java bits and pieces as eclipse and intellij were the two choices for ide. each of those ides had custom plugins to leverage what amount to a super-computer for compilation.
anyway, here's the line i used on occasion
"the bosses have done the analysis to determine that defects found in analysis/requirements/planning cost $1,000 to correct. similarly bugs in development range to $10,000 if they are serious enough, up to $100,000 if found during formal qa and 1 to 10 million dollars if they become bugs in production that might require a rollback, crisis management, or law-suits / regulator fines."
of course, none of that had any basis in fact, and in no way came from management. i also have no evidence to suggest anyone was ultimately swayed at all, but it did focus attention for a conversation about the importance of design for testability.
anyway, consider the diagram below:
google risks changes/defects close to that upper bounds. i guess investment banks could go 50x higher than that for the 'in production' discovery that bought a billion shares at market value, when it should have sold. if a costly defect is caught before you go live, then it's not a regulator-fine-you, or clients-switch-to-competitor-or-take-you-to-court level of cost. even without the fine/penalty the remediation costs can be large for bigger teams who's release schedules are turned on their head to create room to rework whatever is wrong. smaller startups are going to be nearer the lower edge. team size and inherent nimbleness aids them, as does the reality that many of their are not charging for their service. cuil (the search engine) was an interesting 'startup' case, where the cost was ultimately huge. they may not have succeeded anyway, as 'search' is a crowded market. that said, startups can always plan to be acquired, and powerset showed (microsoft bought it and turned it into bing.com).
mark striebeck (the first test-mercenaries manager) in a 2009 speech , cited different figures:
they estimated that a bug found during tdd costs $5 to fix, which surges to $50 for tests during a full build and $500 during an integration test. it goes to $5000 during a system test. fixing bugs earlier would save them an estimated $160m per year.
his were more likely born from analysis, as opposed to mine which were made up (sorry again!). brad green (took over from mark in the last quarter of the mission) hasn't blogged/spoken on the mercenaries mission :-(
kent beck's extreme programming (xp) claims that the cost of change can be closer to a flatline. this is the case as xp mandates 'most stable' code developed in a test driven development (tdd) style. also, perhaps, an ide that's an infallible facilitator of refactoring nirvana. you can make arbitrary changes using the refactoring tools and watch your code move around quickly without introducing defects. our mercenaries mission was to not flip every team we encountered to xp, just to draw on individual practices. indeed, the flatter cost of change curve for xp is only for an "embrace change" vision of development. it is not for a 'oh shit we're giving ads away for free' defect that's still hugely costly. xp, and test-first with high test coverage, is about moving the defects leftwards though. thus, the likelihood of worst-case scenario is reduced. here are a couple of graphs (all in this page are drawn in omnigraffle to outline a hypothesis) for change & defect (xp projects):
(a quick reminder, the above and below are for well factored code made via tdd)
so our hypothetical project is four iterations before it goes live. it goes live at the moment of close of the last iteration. that isn't very realistic, but makes for a simple graph. say each iteration had a list of stories/items that were perfectly completed within it. say twenty per iteration. the stories/item may have varied in duration, but we'll consider that each transition through stages: the first was the business analyst talking to the customer (or product owner) about a invest-centric slice and writing it up. the next was development followed by qa, followed by a sign-off in the form of a desk-check, followed by a status update to "ready for production", at which moment all activity around the story/item specifically ceases. any subsequent work on this story/item is likely because a defect in it is discovered while working on another story/item. xp projects don't plan for that, they plan for that not to happen.
what if all hundred items (4x 20) were plotted on a rough 'start to finish' timeline, with their stages synchronized, and we plotted the incidence of defect and the cost. that workflow timeline, with defect incidence may look something like this:
hmm, i'm still not sure that's right. anyway, it shows a greater frequency towards the left (earlier) stages. through enthusiasm for testing, and a number of facilitating techniques and tools, defects are found sooner, and consequentially not so costly.
other googly/ test mercenary things
miško hevery with help from jon wolter, wrote an actionscript app that showed the enthusiasm for testing for developers within a project team. jon wolter blogged about it after we rolled off , because misko was up to his neck with the development of the revolutionary angularjs .
i've always been obsessed with the abolition of singletons (the design pattern) in enterprise application development, and in favor of dependency injection. i talked of the need for a "singleton detector" and one of miško's summer interns, david rubel, coded it in a few days against java bytecode . it uses asm for the bytecode traversal. some of the unfortunate naming might be my fault, and that is not for the first time .
here is a screenshot made via stephan heiss' tide project, which has integrated gsd to some degree. screenshot from the project site :
spending some time with yed to find the optimal line-detanglement algorithm, printing this on a large format printer, and pinning it up is imo a useful exercise towards testability.
i've wished for this in .net recently :(
obsession with documentation
google bosses created a culture of "write it down". from what i understand that was as simple as declaring it so in the early days. thus, and using their own technologies, googlers documented the shit out of everything. weekly progress reports ("snippets"), team machinations, initiatives, interest groups, trends, research, know-how, directions, and rationales were all recorded. this was also true of 20%-time activities. all of this was enthusiastically typed into collaborative documents, with news feeds attached. there was also an intent that documents were kept fresh where appropriate. also, the tables of contents and cross-references had to be pretty good as page-rank isn't that great for a 'closed' system where new content is naturally more relevant than historical content. at least the search-ability wasn't that great at the end of 2008. many users of corporate wikis will attest that search is the weakest attribute of the service. if there was one single cultural change i'd make in thoughtworks it would be to replicate google's enthusiasm for compounded knowledge.
google's selenium-farm facility was huge boon to developer productivity. jason huggins was lured to google from thoughtworks to join that team before the mercenaries mission started. i finally got him to agree that my bit of selenium (the your-preferred-language-steers-the-browser-over-tcp/ip bit) was more relevant than his (instructions-in-html-tables-steer-adjacent-iframe)! selenium2 (simon stewart also left thoughtworks to join google) was starting to take over generally by the time i left. i'll bet that's complete by now. the selenium farm itself was very much virtualized, and there was nothing physical to see.
trunk based development
google do "trunk based development" of course, using perforce. that's not been a secret for a while . a git front-end was released by the perforce folks a couple of weeks ago, and they pre-announced it in a blog entry at the start of the year. google, back then, had their own in-house version of the same, that some hard-core developers used to juggle local branches.
do i miss google?
a little i guess. most of all i feared that google would be the pinnacle of my tech career. it's not panned out that way. i've encountered other enterprises with tremendously inclusive corporate cultures. a national budget airline, for one. most recently i finished up a director of technology stint for an rbi subsidiary which was hugely educational (actually it was a schooling for me in such matters). so there's always new challenges, and i'm better being the sum of all of my experiences.
Published at DZone with permission of Paul Hammant, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Front-End: Cache Strategies You Should Know
Building A Log Analytics Solution 10 Times More Cost-Effective Than Elasticsearch
TDD vs. BDD: Choosing The Suitable Framework
Observability Architecture: Financial Payments Introduction