Home > Articles > Programming > Java

Crafting Java with Test-Driven Development, Part 12: TDD at Cassatt: An Interview with Jerry R. Jackson

In this installment, Jeff Langr takes a break from developing the poker game to engage in a conversation with Jerry Jackson, veteran software developer and the coauthor of one of the first handful of books ever published on the Java language, Java By Example (Prentice Hall, 1996, written with Alan McClellan). Jerry has been doing object-oriented development for more than 20 years.
Like this article? We recommend

I met Jerry Jackson while working at a now-defunct dotcom called ChannelPoint; I was there from 1998 through 2000. ChannelPoint, which had been founded by a number of former Sun developers (including Jerry), had a higher-than-average population of Java authors. I believe there were five, including Jerry and me.

I hadn’t seen Jerry until about three years ago, when I ran across him at a chess tournament. Both our sons were competing. Chess tournaments are a long day for non-competitors—you’re usually unable to watch the games, and there are long waits between games. (Figure on spending a full Saturday for the ordeal to play out.) So I had an opportunity to catch up with Jerry. We talked about test-driven development (TDD), which Jerry had read about but hadn’t yet tried. I talked about some of the successes I had seen from it, and about what it had done to improve my notions of design.

Fade to 3–4 months later and another chess tournament. As I approached Jerry, the first words out of his mouth were, "This TDD stuff is so cool!" This is a typical reaction; after trying TDD honestly for at least a month, virtually everyone I’ve met comes back to me glowing. A frequent comment is that they’ll never go back to the old way of doing things.

Since that second chess tournament, Jerry has moved on to Cassatt, a software company headquartered in San Jose. He works in Cassatt’s Colorado Springs development team. Cassatt’s main product is Cassatt Collage, which creates an automated, on-demand computing infrastructure from a customer’s existing servers, networks, and storage.

Jerry took with him to Cassatt what he learned about TDD. Today they’re still practicing it with great success. The Cassatt team is currently working on release 3.4 of Collage.

Jeff: How many developers are doing TDD at Cassatt, and how long have you all been doing TDD?

Jerry: There are approximately thirty developers at three sites, depending on how you classify people. Most are now doing TDD. Probably the main exceptions would be the functional and system test developers. TDD for them would threaten an infinite regress.

A subset of the team who worked together before coming to Cassatt started doing TDD at a previous company. We’ve been doing TDD for more than three years (ever since the chess tournament). We switched our development style practically overnight. That’s not to say that we had it all figured out right away, but that we could tell there was no going back.

Jeff: What do you mean by "infinite regress"?

Jerry: I just meant that they’re developing tests as their product, so one could argue that they should develop them test-first, but then, shouldn’t those tests be developed test-first as well?

It just seems strange to develop test code test-first.

Jeff: How did you get the developers to agree do TDD?

Jerry: I was ready to lobby hard for it early on, but there turned out to be almost no resistance from the team at the local site. Some of the others had heard about it as well and were already interested. It was a much harder sell for the people at other sites. We were the newcomers at that company and habits were pretty entrenched. Our remote connection to a lot of the other developers was too low-bandwidth to give us much leverage. We weren’t really very successful in convincing many of the existing developers.

Jeff: How did they learn?

Jerry: Learning about TDD didn’t turn out to be a big problem. After I circulated a pointer to an online article about TDD, everybody got the basic idea. After that, we read some more but mostly learned by doing. There are things that are difficult to approach with TDD, but even trying to do so is very educational.

Jeff: How did you keep the team on track with TDD?

Jerry: We decided from the beginning at Cassatt that no code could be checked in without tests, and took some pride in watching the test suite grow. In addition, there was a significant cultural "attitude" that formed. Code that had no (or few) unit tests came to be widely considered unreliable and suspect (as it is). Eventually, the idea of writing code without driving it via tests became very disturbing to most of us.

Jeff: Tell me a bit more about the resistance you’ve encountered.

Jerry: I’ve seen four main kinds of resistance:

  • The first is basically inertia. Most people don’t like change. They’ve developed in the same basic way for a decade; why should they change now? This can eventually be overcome simply by demonstrating the benefits. Even with inertia, if the benefits are significant, most people can motivate themselves to change.
  • The second area of resistance I’ve seen is pride. "Who is he to tell me how to write software? I know how to write software. I’m really good at it." Some people are simply unwilling to entertain the idea that they could have been doing their jobs a lot better throughout their careers. This seems to be more common among more senior engineers—who, after all, are already supposed to know a lot about developing software.

    The way to address this resistance is to play to someone’s ego rather than against it. "It’s no doubt obvious to a person of your ability and experience that this development model can produce significant benefits...." Once you point that out, a really good developer is usually quick to see the light, and you can get a pretty fast about-face.

  • The third barrier is a deep-seated dislike for writing tests. Most developers think of writing tests for their code as an unpleasant chore they have to do after the fun part of the job is over. I think there are two reasons for this. First, writing code is like any kind of writing. There is a tendency to develop a bit of writer’s block after completing a major work. It’s right then that one is expected to go back and write tests. Nobody wants to do that. They’re done with that code—it’s time to move on. Also, when one is confronted with a huge piece of completed code, the task of writing unit tests for all of it is daunting and there is never enough time to do it right. Once you’ve declared code finished, the company wants you to write other code (and rightly so—you said it was finished). This is a formidable barrier.

    It’s hard to convince someone of how different it is to write unit tests as part of development rather than after the fact. I really don’t know a good approach to this one other than to hope that time and discussions with other developers will eventually wear down the resistance.

  • The fourth and last kind of pushback I’ve run into is actually somewhat valid. Some kinds of development are difficult to do using TDD.

Jeff: At Cassatt, what are some of these difficult things?

Jerry: The main areas that are hard are the parts of the application that run on top of the asynchronous infrastructure. We have significant application logic that has to run in an environment where asynchronous inputs can come in from monitoring, the user, timers, etc., and any ongoing activity has to adapt. The state of the system that’s tracked by the logic is very complicated and it’s hard to simulate. So our tests require a lot of support and take quite a while to run. This makes it a lot more painful to use TDD (though we still do).

I’ve heard people say that GUIs are hard to write test-first. We’ve only done web UIs so far, and they seem pretty amenable to TDD.

Jeff: How would you describe your source base?

Jerry: There are significant areas of our source base in which developers feel very comfortable making large-scale changes. It’s extremely liberating to be able to make a change and know immediately whether it’s correct or not.

In addition, people find it easier to work in unfamiliar areas since the test failures that occur when they make changes guide them to an understanding of the code. ("Ah, I changed x and that caused y to fail...I see the connection.")

Finally, even in areas where it’s difficult to do everything using TDD, the attempt to do so usually leads to less coupling and better-organized code in general.

Jeff: What are some of the things you have to watch out for with respect to doing TDD?

Jerry: One of the things I run into sometimes is that a test suite can become brittle because it incorporates a lot of assumptions. Some pieces of code perform conceptually simple high-level functions, but are complicated enough to require elaborate interior structure. The interior subsystems don’t stand alone—they don’t really perform meaningful operations out of context. So testing them effectively often requires setting up quite a bit of contextual data. A later change in high-level information flow can change the way the subsystems interact and break a lot of tests, even if the actual required changes to the subsystems are minimal. When this occurs, it’s not unusual to spend far more time getting the tests working again than fixing the actual code.

I’ve learned to spot the warning signs of this situation when I start setting up a lot of context for unit tests. It usually means it’s time to rethink how I’m structuring the code at a high level. Still, it’s not something I can always avoid.

Jeff: Do you have any stories about how TDD "saved the day," or helped solve a particularly difficult problem?

Jerry: We never know about most of the times that TDD saves the day! A lot of nasty bugs never occur because they’re filtered out of the code during TDD. The kinds of situations we do get to see are the ones I alluded to earlier: It’s much easier to make big changes to a code base when necessary. More than once I’ve found myself making wholesale changes and thinking, "I would never have had the confidence to make these changes in the current timeframe if I had written this code the old way."

I do think TDD helps in attacking the most difficult problems because it lets you carve off small pieces of the problem, get them working, and then forget about them. Since you have the test suite in place, you don’t have to constantly keep them in mind to make sure that you don’t violate their assumptions. It significantly reduces the cognitive load when working on something complicated.

Jeff: What has TDD taught you about development?

Jerry: I believe I’ve become more proficient at structuring software from a user’s point of view. I used to approach code by thinking about how I could "make it do x," while x was fairly loosely defined. Even when I had written or received functional specifications up front, there was still enough fog around the actual use of the software to lead to issues down the road. Now I am a user of the code and I’m exposed to all sorts of interaction and use issues early enough to deal with them effectively.

Also, I’ve discovered I’m not as smart as I thought I was. [He grins.] I used to assume I could keep a whole system in my head despite the fact that I would have to go back and rediscover it when I had bugs to fix. Now when I go back and look at tests, I realize I would never have remembered, on my own, all the subtleties they embody.

Jeff: What are some of the things your co-developers value in TDD?

Jerry: Mostly the same things I do, I think. We’ve done enough talking about it among us that we’ve cross-fertilized on most of the benefits.

Jeff: How has Cassatt benefited from doing TDD?

Jerry: We’ve been able to move fast and develop a lot of code with a high level of quality, and people don’t (always) have to worry about breaking things when they commit code to the codebase.

Jeff: Any additional comments?

Jerry: I think TDD is one way to forcibly inject reality into software development. Unrealistic thinking and expectations show up everywhere in the software development process. Here are some examples:

  • Unrealistic belief in the correctness and detail of specifications. I’ve seen people actually surprised when development goes off course—after all, a functional specification had been done. TDD takes the specification to the next level very early in the process and exposes the fuzzy areas.
  • Unrealistic expectations for the time required to produce production quality software. TDD helps prevent this problem, since it moves some of the back-end testing time into the development process, where a developer has to bid it.
  • Unrealistic expectations for the future of a project. A lot of developers seem to think that software will never need to be modified—and, if it does, the original author will be the one to do it. This issue is often used as a justification for increased code documentation, but I’ve never been that impressed with how much value is added by excessive commenting. Comments can get out of sync with code and are often simply translations from code into English, anyway. Tests developed via TDD, by definition, cover all the behavior of the code and can’t get out of sync. A good test suite is a much better hedge against future change than some extra comments.

Jeff: Thanks, Jerry! Best of luck to you and Cassatt.

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