Home > Articles > Programming

An Interview with Stephen Vance, Author of "Quality Code: Software Testing Principles, Practices, and Patterns"

  • Print
  • + Share This
Software tester and coach Lisa Crispin interviews Stephen Vance, author of Quality Code: Software Testing Principles, Practices, and Patterns, about his book, why TDD is a skill independent of your ability to code, why pairing is so effective, and what he thinks about Code Retreats.
Like this article? We recommend

Lisa Crispin: Given that there are already several books on TDD and automated unit testing, what's different about your book?

Stephen Vance:  Although I'm a big fan of TDD, the book is really about the mechanics of bringing code under test for automation and what testable designs and code look like--implementation patterns for code-level testing if you will. While existing books touch on the techniques, they do it while trying to convey a different point and only touch my content incidentally and incompletely. I've found the mechanics to repeatedly be the missing ingredient for people trying to write code-level tests. 

Lisa: That's a good point. When I've worked on teams that had to learn TDD, the programmers really struggled. It took them several months to get traction, and years to feel they were really good at it. Will your book ease the path over the "hump of pain" (as Brian Marick put it) of learning?

Stephen: It addresses a piece of the TDD learning curve but certainly not all of it. I've found that different people struggle with different aspects of TDD. Newer programmers don't have enough experience in using good APIs and so struggle to create them through tests. Others think in terms of the implementation, a tendency reinforced by much of our computer science educational system in my opinion; rather than their intent, which is why I wrote two chapters addressing issues of intent with examples. There's a big tendency in our craft to try to eat the whole enchilada, whereas TDD is about consuming it in nibbles. The bottom line is that TDD is a skill independent of your ability to code, conceptualize solutions, design algorithms, or any of the other skills we associate with the craft of software. Ultimately, the best way to learn TDD is to pair with someone experienced in it, which is why I like approaching it from a player/coach position after a little bit of educational introduction to TDD.

Lisa: You make an excellent point about pairing. My current team pairs 100% for writing production code, using TDD. New team members have commented how fast this got them up to speed. But I still hear a lot of push back against pairing in the community. People still say, "Oh, that would be too expensive, two people doing the job of one" or "I can't pair all the time, I need time to think and research on my own." If someone read your book and said, "I think my team should start pairing to master TDD, but our manager won't let us," what would you tell them?

Stephen: Your question gives me quite a chuckle. Pairing has to be one of the most polarizing topics among developers these days. While I'm a big fan of pairing and it works well for me personally, I'll be the first to admit that it's not best for all people or situations. The best reason to have everyone pair 100% is to give them the experiential knowledge of when pairing works and doesn't so they can base their decisions more on the work than their discomfort. I tell people that pairing is one of the most intimate things you can do while programming, and that's a big part of the discomfort often experienced when starting with it.

Without going on any more of a tangent, though, I would have a couple of responses to that question. First, regardless of what you think about pairing, it can be one of the best ways to share knowledge and skills when done effectively. I would also probe into the manager's reasons. Are they supportive of TDD? Do they think that formal training would be better? Do they have another plan to share the skill? Are there mitigating circumstances that make them want to defer the hit of any learning curve such as a tight deliverable deadline? Does the manager trust the team to make the right decisions about producing a quality product?

Lisa: Would you recommend that testers read your book?

Stephen: The target audience is people who are doing hard-core TDD. Someone doing code-level testing will get a lot out of this. 

Lisa: Will it also help people doing ATDD?

Stephen: Yes, but some of the techniques are fairly low-level. Others are more general and can apply across the whole range of testing granularities.

Lisa: Tell me more about the craftsmanship angle. Why is this important?

Stephen: In our industry, people generally feel the need to rewrite code every three or so years. Craftsmanship is about writing sustainable software, so you don't have to throw it out and rewrite it.

Lisa: How do you judge if you crafted your code well enough?

Stephen: Artists say that a painting is done when you stop working on it. While that may be somewhat true in software, we have a significant and immediate financial accountability most of the time.

Let computers do what computers do best. Use all the static analysis and coverage tools at your disposal to catch bugs, check your style, and give you feedback on the thoroughness of your testing. Configuring these tools gives you a benchmark in a few dimensions of craftsmanship. That lets you focus on the design and architecture, the aspects we don’t have as much automated support for.

Lisa: Tell me why it appears to be so difficult for developers to learn how to do TDD. 

Stephen: Oftentimes, people don't know what testable software looks like. Two chapters of Quality Code are dedicated to intent, because in order to do TDD well, you have to conceive what you’re writing from the outside in, not the inside out. Computer scientists aren't trained to look first at "What is the form this should take for someone to want to use to solve this problem?” They immediately start thinking about for loops, data access and SQL queries rather than usable interfaces and behaviors.

Lisa: In my experience, developers who learned TDD still were writing bad code--they realized that years later. Is there no way around this? If they read your book would they avoid this?

Stephen: It would help. People think they know how to code, so they must know how to test, and how to test-drive. Although you use programming in order to unit test and test-drive, these are separate skills. Test-driving is a skill. Test-driving leverages programming and unit testing, unit testing leverages programming.

Similarly, people say, "We're going to adopt agile," and really they're saying, "We're going to learn 20 skills simultaneously and become experts." This goes against what we know about the idea of needing 10,000 hours of practice to become an expert. Their expectations are just wrong.

They need to start out by saying "I need to learn this new skill, test-driving, which I don't have yet." By focusing on this skill they can learn it faster.

I teach TDD with simple code katas because they’re ostensibly so easy; you don't have the distraction of the complexity of the problem to take you away from the application of the skill. Programmers think they already know how to code Fizz-Buzz, and they realize it's not really that easy. A couple days’ practice with increasingly difficult katas allows them to start learning how to work with their production code. But they still need a lot of coaching and mentoring on how to apply it to production going forward.

It's hard to find anyone who already knows how to do this, and even harder to get those people to work for you. It is much like the old C++ adage: “Of the 10 best C++ programmers, nine work for AT&T and the other doesn’t work for you.”

Lisa: What do you think about Code Retreats? Do they teach test driving?

Stephen: It depends on the variety of participants. The structure of it and the participants affect the success, but they certainly promote paired test-driving. But to me, Code Retreat is about practice. How can programmers practice? Go back to your katas all the time. It’s like practicing the fundamentals of any activity. Even professional baseball players practice the fundamentals of hitting and fielding all the time.

Lisa: Do you let your programmers do this on company time?

Stephen: Absolutely. The hardest thing is getting people to realize that they need to do katas, and that it's useful. I try to reinforce that in training and coaching. "This particular kata might be good to practice that kind of thing." I like to build professional development time into their schedules so people can practice their craft without inflicting their learning time on production code.

Lisa: How do you pick what to "shave off"?

Stephen: Teams need to discuss this. When they need to change a part of the app, they need to answer some questions. Will it lay the foundation for creating new features quickly? Or is it something that won't change, or maybe something that shouldn't even be done in code? It comes down to understanding your business and having good collaboration so you can decide priorities and make decisions.

That said, tightly coupled implementations and bridging disparate technologies suggests more of an outside-in, “peel the onion” approach. Understanding your dependencies is key.

Lisa: Is it important to educate business executives and managers on the importance of craftsmanship and quality? 

Stephen: Yes, but it can be challenging.

Lisa: How do you do that?

Stephen: I don't really have a fixed technique for this because so much depends on their starting attitude. Sometimes you have to gamble that you can prove it's worthwhile before they discover you're doing things differently. I think a lot of this is due to so many people doing utilization thinking instead of flow thinking: "If I keep all my developers 100% busy I will be better off."

It’s really about streamlining the delivery of value, but we haven't figured out how to measure value, especially over long periods of time. The total cost of software justifies the sustainability, which justifies the craftsmanship, but we usually don't measure this.

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020