Many people can quote the part of the Agile Manifesto that states, “Working software over comprehensive documentation,” but they fail to mention the very important explanatory component that follows: “While there is value in the items on the right, we value the items on the left more” [BECK]. Scrum teams still value documentation; they just change the timing of that documentation to be more consistent with their level of knowledge.
For example, imagine you are in a university world history class. You get to the point in the class when it’s time to discuss Western European history. Your professor says, “I want each of you to buy my new book Western European History: The 30th Century. Come prepared for an exam on the first five chapters in two weeks.”
You would probably look around the room, wondering if what you just heard was correct and ask a fellow student, “Did he just say thirtieth century history?”
Common sense tells you that without time machines, it is impossible to read a factual account of future events—they haven’t happened yet! Sure, there are predictors and indicators that suggest what might happen, but nothing is certain. This then begs the question: If this approach is wrong for a university class that may reach a few thousand, why is the exact same approach accepted when developing software that has the potential to reach millions?
Before we’ve begun any work on a project, we are often asked for exact details as to what will be delivered, by when, and at what cost. To determine these things, teams often write volumes of documents detailing how the system will work, the interfaces, the database table structures—everything. They are, in essence, writing a history of things that have yet to occur. And it’s just as ludicrous for a software team to do it as it would be for your history professor.
That doesn’t mean we should abandon documents, and it doesn’t mean that we should leave everything until the end, either. A certain amount of documentation is essential at each stage of a project. Up front, we use specifications or user stories to capture ideas and concepts on paper so that we can communicate project goals and strategies. When we sign off on these plans, we agree that what we have documented is the right thing to do.
The question, then, is not whether we should document, but what we should document and when. The answer has everything to do with necessity, volatility, and cost.
Why Do We Document?
Every project needs a certain amount of documentation. In a 1998 article on Salon.com titled “The Dumbing-Down of Programming,” author Ellen Ullman notes how large computer systems “represented the summed-up knowledge of human beings” [ULLMAN]. When it comes to system documentation, we need to realize that we’re not building or writing for us; we are writing for the future. I think Ullman summarizes it best with this snippet from the same article:
- Over time, the only representation of the original knowledge becomes the code itself, which by now is something we can run but not exactly understand. It has become a process, something we can operate but no longer rethink deeply. Even if you have the source code in front of you, there are limits to what a human reader can absorb from thousands of lines of text designed primarily to function, not to convey meaning. When knowledge passes into code, it changes state; like water turned to ice, it becomes a new thing, with new properties. We use it; but in a human sense we no longer know it.
Why is Ullman’s concept of code as a process that changes state important? Because we need to realize that, in a human sense, we use the system and we know the system. That is why we document.
So, what is essential to document, and what is needless work? Much of that depends on the type of system you are building and the way in which you work. Teams that are colocated need to document less than do teams distributed across continents and time zones. Teams that are building banking systems need to satisfy more regulatory requirements than do teams building marketing websites. The key is to document as much as you need and nothing more.
What Do We Document?
The list of essential documents is different for every project. Going through my list of past projects, some frequent documentation items include the following:
- End-user manual
- Operations user guide
- Troubleshooting guide
- Release and update manual
- Rollback/failover manual
- User stories and details
- Unit tests
- Network architecture diagram
- Database architecture diagram
- System architecture diagram
- Acceptance test cases
- Development API manual
- Threat models
- UML (Unified Modeling Language) diagrams
- Sequence diagrams
We didn’t write all these documents before the project began. And we didn’t wait until the final sprint to start them either. We did them as the information became available. Many of the user stories, for instance, were written up front. But some of them were changed, and others were added as the project progressed and requirements became clearer. Our unit tests were written as we coded. And at the end of every sprint, we updated the end-user manual to reflect new functionality. We included in our definition of done what we would document and when we would write it (see Chapter 7, “How Do You Know You’re Done?”).
When and How Do We Document?
So, if we don’t do it all up front and we don’t save it all for the end, how does documentation happen in an agile project? Documentation, any documentation, costs money. The more time it takes to write and update, the more it costs. What agile projects strive to do is minimize write time, maintenance time, rework costs, and corrections.
Let’s look at a few approaches we can take when documenting our projects:
- Document heavily in the beginning.
- Document heavily in the end.
- Document as we go along.
Document Heavily in the Beginning
Traditional projects rely on early documentation. As you can see from the diagram in Figure 27-1, a typical waterfall team must capture requirements, build a project plan, document the system architecture, write test plans, and do other such documentation at the beginning of the project. If we were to overlay a line that represented working software, it would not begin to move up until the gray line started to flatten.
FIGURE 27-1 Traditional project with up-front documentation
The benefit of this approach is that people feel more secure about the system being built. The major drawback is that this sense of security is misleading. In point of fact, though a great deal of time, effort, and money has gone into writing the documents, no working software has yet been created. The chances of getting everything right up front are marginal on stable projects and next to zero on volatile projects. That means factoring in costly rework and extra time. Chances are good that these high-priced, feel-good documents will turn into dusty artifacts on the project bookcase.
Document Heavily at the End
When we document heavily at the end, we document as little as possible as the software is developed and save all the material needed to release, sustain, and maintain the system over time until the end of the project. Figure 27-2 illustrates this approach.
FIGURE 27-2 Documenting heavily at the end of the project
The benefits of this approach are that working software is created quickly and that what is eventually written should reflect what the system does.
There are many problems with this approach. People often forget what was done and when, and what decisions were made and why. Team members on the project at the end are not necessarily the people on the project in the beginning; departing team members take much of their knowledge with them when they go. After the code for a project is complete, there is almost always another high-priority project that needs attention. What usually happens is that most of the team members move on to the new project, leaving the remaining team members to create the documentation for the system by themselves. Countless hours are spent hunting for data and trying to track down and access old team members, who are busy with new work and no longer have time for something “as insignificant as documentation.”
Though saving documentation until the end is cheaper in the beginning because more time is spent on actual software development, it is usually expensive in the end because it can hold up a release or cause support and maintenance issues, as it will likely contain gaps and faulty information.
Document as We Go Along
Agile projects do things differently. We acknowledge that while we can’t know everything up front, we do want to know some things. We also maintain that documentation should be part of each story’s definition of done, so that it is created, maintained, and updated in real time, as part of the cost of creating working software. Figure 27-3 illustrates the document-as-we-go approach.
FIGURE 27-3 Documenting as you go
The product owner works with the stakeholders and customers to build the requirements while the team works with the product owner to achieve emergent design and architecture. The team keeps the code clean, creates automated tests, and uses code comments and other tools to slowly build other required documentation for the system, such as the user manuals, operations guide, and more.
The one drawback is that it does take a little longer to code when you document as you go than it would to fly through the code without having to write a comment or update an architectural diagram. This drawback is more than offset, though, by the benefits. There is less waste, less risk of eleventh-hour holdups, and more emphasis on working software. Much of the documentation is updated automatically as changes are made to the code, reducing maintenance and rework costs. Just as news reports capture the details of a story for posterity, real-time documentation of decisions and behavior minimizes gaps in knowledge and creates a living history of the software for future teams and projects.
Documenting in an Agile Project
So, we agree that in most cases, agile teams will want to document as they go. What exactly does that look like on a typical software project? To illustrate, let’s use a document that is familiar to almost everyone: the user manual. A waterfall approach would be to write the entire manual at the end. We’ve discussed why this method is a workable but risky solution. The more agile way to approach a user manual is to include “update the user manual” as one of the acceptance criteria for a story that has to do with user-facing functionality. By doing that, the manual is updated each time working software is produced.
Let’s say, for example, that I’m writing the user manual for an update to Adobe Lightroom (my current favorite piece of software). I’m in sprint planning, and the product owner explains that the story with the highest priority is “As an Adobe Lightroom user, I can export a series of photographs to Adobe Photoshop so I can stitch them together to make a panorama.” As we’re talking through that story, I recommend that we add “update user manual to reflect new functionality” as one of the acceptance criteria for that story.
As I write the code or as I finish the feature, I would also edit a document that provides the user instructions on how to use the feature. Depending on how stable the feature is, I might even include screenshots that walk the user through the instructions for both Lightroom and Photoshop. If the feature is less stable, meaning the core components are built but the user interface team is still hashing out the user interface through focus groups, I would document the behavior but probably only include placeholders for the screenshots. The key here is that the story would not be done until the user manual is updated.
Updating the user manual would be appropriate to do at the story level, as I described, but could also be accomplished at the sprint level. For instance, if we have several stories that revolve around user-facing functionality, we might add a story during sprint planning that says, “As a user, I want to be able to learn about all the new functionality added during this sprint in my user manual.”
What I am doing is balancing stability versus volatility of the feature to determine how deep I go and when. It would not, for example, be prudent to make updating the user manual part of the definition of done for a task. Too much might change before the story is complete. Nor would it be acceptable to wait to update the user manual until right before a release. That’s far too late to start capturing the details of the new behaviors.
When determining when to document your own systems, you also should balance cost, volatility, and risk. (For more on determining your definition of done, refer to Chapter 7.)
Starting Projects without Extensive Documentation
One challenge you will face is to help stakeholders and customers understand why you are not documenting everything up front. Tell them a story similar to the one Carter told at the beginning of this chapter (or share that story with them). Remind them that while documenting heavily up front drives down the perceived risk, you never know what you don’t know until a working solution is in place.
Eschewing extensive documentation up front does not mean you are off the hook for a project signoff piece. But it does mean that the piece will look different to your stakeholders than it has on other projects. Rather than give them the specific artifacts they request, answer the questions they are asking in regard to schedules and requirements in the most lightweight way possible for your project and situation. A PMO might, for instance, ask for a Microsoft Project plan, but what the PMO really wants to know is what will be done by about when. By the same token, a stakeholder might ask you for a detailed specification, when what she really wants to know is, “Are you and I on the same page with regard to what I’m asking you to do?”
Signoff and approval will occur early and often. The product owner will hold many story workshops to build the product backlog, work with the team to build the release plan, and then communicate that information to all interested parties, soliciting enough feedback to ensure that the team will deliver what the stakeholders had in mind (which is rarely exactly what they asked for). The documents the product owner uses for these tasks are only a mode of transportation for ideas and concepts, and a document is not the only way to transfer those ideas. Up-front documentation can just as easily take the form of pictures of whiteboard drawings, sketches, mockups, and the like—it does not need to be a large formal document.
The beginning of the project is when you know the least about what you are building and when you have the most volatility. What your stakeholders need is the peace of mind that comes from knowing you understand what they need and can give them some idea of how long it will take to deliver. Expend the least amount of effort possible while still giving them accurate information and reassurance. At this point in the project, everything can and will change.