Artigo XP

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

Machine Translated by Google

focus
reports from the field

LaunchingExtreme
Programming at a Process-
Intensive Company
James Grenning, Object Mentor

a company with a large formal software development process. In-


fined Process Systems is a big company (the name is fictitious). The
This is a story about
division startingwith
I worked a project using an adaptation
was developing of XP
safety-critical in
systems and
The company that was building a new system to replace an existing legacy product. The project
has traditional was an embedded-systems application running on Windows NT and was part
formal of a network of machines that had to collaborate to provide services.
processes
launched a What we were facing
Through a systems engineering effort, DPS
project usage divided the system into subsystems, each of The standard practice in the division was
many Extreme which was later designed by a development created in response to past and current
Programming team. I was brought in to help one of the problems. Most of the developers had one
teams start their part of the project using iter- to three years' experience. The most senior
practices. The
active development, use cases, and object- developers had the role of reviewing and
author covers oriented design techniques. approving the work of the less experienced
how XP was Shortly after starting this project, I spent developers. To their credit, the review team
proposed to
a week in XP Immersion I, a one-week in- took the formal review process very
tensive training class in the techniques and seriously. They were good at it: they captured
management,
philosophy of Extreme Programming.1 En- issues and defects on the Web, prepared re-
how the project thused by XP, I talked to the DPS team viewers, and held crisp review meetings.
seed began and about applying some XP practices to our In the world of Big Design Up Front and
grew, and some work. The company had already decided to phase containment, these guys were good. I
try iterative development and OO tech- could end this article right now except for
of the issues
niques, departing from the division's one problem: all this process added
the team faced standard process. They were game for overhead to the development of software.
during its first some-thing different, but how different? We To de-design something, they needed to figure out
six months. decided to take the idea of incorporating the design, document it in Rose, schedule a
XP practices to the director of engineering. review meeting, and distribute materials to

Authorized license use limited


0740-7459/01/$10.00 © 2001to: UNIVERSIDADE FEDERAL DO MARANHAO. Downloaded on March 26,2024 atNovember/December
IEEE 18:11:48 UTC from2001
IEEE Xplore.
IEEE Restrictions apply.
SOFTWARE 27
Machine Translated by Google

review. Then reviewers had to review the dex card. We decided to choose our battles.
materials and enter issues on the Web, have We needed to get some of the benefits
The need for a review meeting, document the meeting practices into the project and not get hurt
outcome, repair the defects and then close by leaving other practices behind. We did
documentation them on the Web, fix documents, and have don't omit practices that we didn't feel like
was ingrained the changes reviewed again. doing; we tried to do as many as we could.
However, all this process work was not We used the practices and their interactions
in the culture, keeping bugs out of the product. Unrealistic as ways to sell around the objections.
so we expected deadlines and surprises late in the project We started by identifying the project's
concern over were taking their toll. Products were delivered goals—to build a working product with re-liable
late. Engineers were just getting their operation and timely delivery, with
XP's skills to a decent technical depth, but they enough documentation to enable effective
lack of formal were also burning out and heading for systems maintenance (no more, no less), and with
engineering or management. understandable source code. This was as
documentation. The team struggling with how to begin the objectionable as motherhood and apple pie.
new project. Its requirements were in progress The standard process would identify the
format and fully understood only by the person same objectives.
who wrote them. We all agreed that a reliable working
To summarize: the existing process had a product was a critical output of the project.
lot of overhead, deadlines were tight, engineers This was particularly important, as this was
were running away, requirements were a safety-critical system. A tougher question
partially defined, and they had to get a project was, what was enough documentation? This
started. With all these issues, something had to was where it got interesting. This application
change. Did they need something extreme like was not your typical XP target application—it
XP? I believed and hoped XP would help. was part of a larger system that multiple
groups were developing at multiple
Choosing your battles websites. These other groups were using the
The DPS culture values up-front require- standard, waterfall-style DPS process, not
ments documents, up-front designs, reviews, XP or short-iteration development. We had
and approvals. Writing the product features a potential impedance mismatch between
on note cards, not doing any up-front de- the XP team and the rest of the project.
design, and jumping into coding were not
going to be popular ideas. To people unfamiliar How much documentation?
with XP, this sounded a lot like hacking. Proposing no documentation would end
How did we get by these objections? the conversation. We decided to keep the
Having been introduced to XP, the group conversation going and answering a question
understood what the main objections would with a question. What did we want from
be as we tried to sell XP to the management our documentation? We needed
team. Like good lawyers, we prepared
anticipated questions along with their answers ÿ enough documentation to define the
for our presentation. We expected that the product requirements, sustain technical
decision makers would consider some of the reviews, and support the system's main-
dangerous and unworkable practices at tainers;
DPS. The need for documentation was in-grained ÿ clean and understandable source code;
in the culture, so we expected concern over XP's and
lack of formal documentation. Can the code be the ÿ some form of interface documentation,
design? Can we due to the impedance mismatch be-tween
really build a product without up-front de- groups.
design? What if there is thrashing while refac-
toring? What about design reviews? These answers did not all align with XP out of
To paraphrase Kent Beck, one of XP's the book, but they kept the conversation going. XP
originators, “do all of XP before trying to is not anti-documentation; it recognizes that
customize it.” I think that is great advice, documentation has a cost and that
but for this environment we would never not creating it might be more cost-effective.
have gotten the okay to mark up the first in- This, of course, violates conventional wisdom.

Authorized license
2 8 IEEE use limited
SOFTWARE to: UNIVERSIDADE FEDERAL
November/December 2001 DO MARANHAO. Downloaded on March 26,2024 at 18:11:48 UTC from IEEE Xplore. Restrictions apply.
Machine Translated by Google

After recognizing and addressing the given to the maintainers describes the state
project's objectives, I led the team through of the software at the time it was shelved or
the cost-of-change pitch from Beck's Ex- 1 The transferred. This document can and should Documentation
Programming Explained. direc- treme be written in a way that avoids needing frequent
tor, the manager, and some senior technologists modification. As maintenance pro-ceeds, the
and reviews
agreed that XP addressed many of document will likely be neglected. were going to
their current development problems. They Make the document high-level enough so
be the big
also thought XP right out of the book that the usual maintenance changes and bug
would not work for them. What did we do? fixes do not affect it. Let the documentation road blocks.
want to do differently? guide the future developers to the right part
Documentation and reviews were coming of the code—then they can use the high-quality,
to be the big roadblocks. We heard, “Requirements readable, simple source code to
on note cards!?!” “I can't give a work out the details.
stack of note cards to the test team.” “Bob Following this strategy will not result in a
in firmware needs the cards too.” “Someone huge document. Remember, you have some
will lose the cards.” I noticed that the company's of the best detailed documentation available
“standard” process allowed use cases in the form of automated unit tests—working code
in the form described by Alistair Cock-burn.2 Thisexamples of exactly how to use
is a text-based method, similar each object in the system. XP does not pro-hibit
to user stories but with more details. Other documentation; just realize it has a cost
DPS groups needed to look at the use cases, and make sure it is worth it. You can plan
so we decided not to fight that battle—we documentation tasks into any iteration. The
had enough lined up already. We decided to advice here is to document what you have
use use cases. built, not what you anticipate building.
Another objection was “We need documentation The next follow-on objection was that
for the future generations of engineers that will we'd never do the document at the end of
maintain the product we the project. My reply: So, you would rather
are building. We need our senior people to do a little bit at a time, and have to keep
look at the design to make sure your design changing and rewriting it? Doesn't that
will work.” Our answer was that a good sound like it would take a lot of time? It
way to protect future software maintainers do! So the management team must stick to
is to provide them with clean and simple its guns and do the high-level documentation
source code, not binders full of out-of-date task at the end of the project. Pay for it
paper. Maintainers always go to the source with less time wasted during development.
code; it cannot lie, as documents can. XP re-lies
on the source code being simple and expressive Reviews
and uses refactoring to keep it that The director did not completely buy into
way.3 The source code is the most important documenting only at the end of the project
part of the design. At some point, the main-tainers and hence made a final objection: “I still
will need a high-level document to have my concerns. What if the design is not
navigate the system. good? Do I have to wait until the end of the
A follow-on objection was that what one project to find out?” Pair programming was
person thinks is readable source code is not not reason enough for the management team
to another. XP addresses this through pair to give up its review process. The big problem
programming. If a pair works hard at making the with DPS's development process was that
source readable, there is a really it guaranteed that development would go
good chance that a third programmer who slowly. The process went something like this:
sees the code will find it readable, too. Plus, create a design, document it in Rose, schedule a
with collective code ownership, anyone can review meeting, distribute the materials,
change the source code if necessary. have everyone review the materials, have the
Another expected objection was that code review meeting, collect the issues, fix the issues,
was not enough—we needed a documentation or maybe do another review, then finally
transition strategy for whenever a write some code to see if the design works.
project is put on the shelf or transferred to This made sure the cost of change was high.
another team. Ideally, the documentation Because of the safety-critical nature of the

Authorized license use limited to: UNIVERSIDADE FEDERAL DO MARANHAO. Downloaded on March 26,2024 atNovember/December
18:11:48 UTC from2001
IEEEIEEE
Xplore. Restrictions apply.
SOFTWARE 29
Machine Translated by Google

application, the management team was not build a high-quality product. XP's iterative
willing to give up on reviews. nature could help the team determine how fast it
At the beginning I proposed a more efficient way to do the could go and give management the feedback it
reviews: the ask-for-forgiveness (rather than needed. So, it's about getting the job done. XP
of a project, ask-for-permission) design process. We let is a set of techniques that seemed promising.
you need to the development team works for a month at Projects can get stalled in the fuzzy front
believe that the a time on the system. At the end of the end.4 This is a problem, especially in water-
month, they assembled and reviewed a de- fall projects, where you must define all the
design can and design-as-built review package. This took the requirements prior to starting the design
will evolve. review off the critical path, so the review process. In XP, as soon as you have defined
process did not slow down the team. We a couple weeks' worth of user stories, devel-
agreed to document the significant designs opment can start. Think of how hard it is
within the iteration and review them with shave a month off the end of a project. Now
the review team. We gave the remaining is-sues think of how easy it would be to save that
that the reviewers found to the next it-eration as just month by starting development as soon
stories. The idea here was to as you have identified a month's worth of
spend a small amount of time in the iteration stories. Throughout the rest of the project,
documenting the design decisions that story development occurs concurrently with
month.month. As it turned out, we really didn't story implementation.
have to ask for forgiveness at all.
The first iteration
It's not about XP The team had three people—a customer
It's about building better software pre- and two developers, including me. We started
dictably and faster. We committed to by getting the unit test tool CppUnit set up
number of issues, but we did have agreement and integrated with our development
to use most of the XP practices: test-first pro- environment, VC++. This didn't take long—the
gramming, pair programming, short iterations, tools are relatively easy to use.
continuous integration, refactoring, The project's customer (our systems
planning, and team membership for the cus- engineer) gave us a requirements document. To the
tomer. Table 1 describes the XP practices we we identified a functional requirement, we
used and how we modified them to suit our wrote it on a card. Each card named a use
needs. We added some process and formality: case. We didn't bother to elaborate the use
use cases, monthly design reviews, and some cases, just name them; in a few days, we had
documentation. This adaptation of XP was a identified 125 use cases. Picking the most
significant change in how DPS developed important ones was relatively easy using this list.
software, and we hoped to prove it was an In XP, the customer chooses the most
improvement. The director thought XP of-fered valuable user stories and discussions them
a lot of promise for a better way to with the programmers. We were using use
work that could lead to improved quality, cases, a similar idea; our customer chose the
faster development, better predictability, and most valuable use cases and elaborated
more on-the-job satisfaction (“smiles per them. For the early iterations, we decided to
hour”). He said we were “making footprints ignore use case extensions (which hold the
in the sand.” If we could improve one special cases or variations) and keep the
development factor—quality, job satisfaction, product definition simple.2 We just assume
pro-ductivity, or predictability—the director there were no special cases or error cases;
thought it might be worth doing XP. If we because we were using XP, we believed we
could improve any two of those factors, he could ignore the details and not be penalized
thought there would be a big payoff. later. We also didn't bother using use
The problems of poor quality, delivery de- case diagrams, because they did not add any
lays, long delivery cycles, and burned-out en- value to the development team. Our main
gineers plague the software industry. XP goal in the first iteration was to build a lit-tle
struck a cord with our team leaders. The tech- bit of the product, get some experience,
niques appeared to address some of the problems and build some skill and confidence.
the team was facing, and the focus on At the beginning of a project, you need to
testing and pair programming could help it believe that design can and will evolve.

Authorized license
3 0 IEEE use limited
SOFTWARE to: UNIVERSIDADE FEDERAL
November/December 2001 DO MARANHAO. Downloaded on March 26,2024 at 18:11:48 UTC from IEEE Xplore. Restrictions apply.
Machine Translated by Google

Table 1
Summary of XP practices used
XPpractice Adoption status Our experience
planning game Partially adopted The team practiced scope limiting, task breakdown, and task sign-up techniques. We
used cases rather than user stories. We wrote the use cases from an existing
requirements document and stored them in a database.
Small releases Adopted Iterations were one month long each.
metaphor Not adopted A metaphor had not yet evolved, and we didn't develop one. Instead, a high-level
design evolved and was recorded in a small set of UML diagrams and explanatory
text. It played the role of our metaphor.
Simple design Adopted The design did not have anticipatory elements. A monthly design-as-built review
let the senior people monitoring the project see the team's design decisions.
Functional testing Adopted We developed functional tests in a custom scripting language. The tests demonstrated
that the application logic met the customer's need. However, the team got behind on
automated acceptance tests. This is not recommended.
Test-first design Adopted We wrote the first line of production code using test-first design. We wrote the program in C++
and used CppUnit 1.5 as our unit test tool.
Refactoring Adopted We refactored regularly, and the design evolved smoothly.
Pair programming Adopted We could develop tests, interfaces, and simulations on our own but used pair programming to
create production code.
Collective ownership Adopted We collectively owned the code. On one occasion, new code that required special
knowledge resulted in a module owned by one programmer. Development slowed down
on that part of the system.
Continuous integration Adopted During our first iteration, continuous integration was no problem. As soon as we added a
second pair to the project, the team had integration problems. We quickly learned how to
avoid collisions and do merges.
40-hour week (also known as Adopted The team worked at a sustainable pace. A couple times, we put in overtime to meet the
sustainable pace) iteration goals.
On-site customer Partially adopted A systems engineer acted as the on-site customer. We derived our acceptance tests from the
use cases. The customer was not directly responsible for these tests. The team scared the
customer a couple times by delivering his use cases in less time than it took him to define
them.
Coding standards Adopted The main coding standard was “make the code look like the code that is already there.”
The team used header and C++ file source templates to provide the company-required
comment blocks. The comment blocks were mainly noise that hid the code.
Open workspace Not adopted There was no open workspace. Workstations were in the corners, making pair
programming awkward. The roadblocks to building a team workspace were political.

Otherwise, the desire to do up-front specifica- about half a day with a whiteboard looking
tion work will put the team into analysis at design ideas. Because we were unsure of
paralysis. Knowing that the design can evolve XP, we weren't sure if we could really start
sets the team free to start building the system coding without doing some design. We did a
as soon as some functionality is identified. little bit of design, or as we called it a Little
Simplifying assumptions keep complexity out Design Up Front (LDUF). Ron Jeffries calls
of the code, at least temporarily. John Gall this a Quick design session.6
wrote, “A complex system that works is in-variably In our LDUF session, we found a group
found to have evolved from a simple of collaborating objects we thought would
systems that works.”5 Thus, it really helps to meet the needs of our first stories. We
make these simplifying and scope-limiting decisions worked from hand-drawn copies, not both-using
in each iteration. This lets the core features drive with a diagramming or CASE tool. We
the design. we knew things would change, and we didn't
We had a planning meeting and discussed want to spend our time making it look
the features that were to be included in the pretty. It gave us confidence and a vision of
first iteration. My partner and I had OOD where we were going.
experience but no real XP experience (except During the iteration planning meeting
for the week I spent in class). We wanted a and our LDUF session, we identified some of
guide to our first iteration, so we spent the interfaces we needed to support the interface

Authorized license use limited to: UNIVERSIDADE FEDERAL DO MARANHAO. Downloaded on March 26,2024 atNovember/December
18:11:48 UTC from2001
IEEEIEEE
Xplore. Restrictions apply.
SOFTWARE 31
Machine Translated by Google

Figure 1. Simulating
the interface
by creating a Application Service Interface
logic class
Mock Object,
shown in Unified working on the project. Meetings were a
Modeling Language. <<extends>>
real productivity killer. Pair programming
Service Simulated (mock) was fun and intense; we were able to stay on
service task. If one partner lost track of where we
implementation
implementation
were going, the other partner quickly re-
synched their efforts. We taught each other
about the tools and learned new skills.
Hardware The coding standard is a team agreement
API to make the code look the same—it is the
team's code, so it should all look the same. It
turned out that my partner and I had a
compatible coding style. As more people joined
the team, we established a self-documenting
Figure 2. The Write to coding standard: “Make the new or modified
test-first design test for new code looks like the code that is already there.”
process. feature
Cool, the one-line coding standard! However,
Refactor there was pressure to use the division's coding
Compile
as needed
standard. From a “choosing your battles”
point of view, we gave into using the standard
comment blocks in front of each function.
Run the Fix
test and compile Later iterations
see it pass errors
We planted a seed of functionality at the
center of this subsystem application and
Write Run the simulated its interactions with its environment. We
the test and
code see it fail
brought in new stories that made
the seed grows, incrementally adding new
functionality and complexity. From its simple
beginning of a half dozen classes and a
action 1 features. These acted as placeholders few simulations, the clean, loosely coupled
for the real hardware. We then added a simulation design evolved to about 100 classes.
of the interface by creating a Mock Unit test volume grew. The unit tests saved
Object (see Figure 1).7 This facilitated devel- us numerous times from unexpected side-effect
opment and also kept volatile entities such defects. We could fix the defects immediately
as the database schema, GUI, hardware de- because we just added the code that
pendencies, and protocol from creeping into broke the tests.
the application logic. We witnessed an ex- We created our own acceptance test script-
ample of designing for testability leading to ing language to drive transactions into the
reduced coupling in the application. system and used text file comparisons of
So we sat down to write our first line of simulation output to confirm system operations. We
code. We picked a candidate class from our were able to design simulations that stressed
hand-drawn LDUF diagram and followed the system beyond the limits expected in the
the test-first design process. Figure 2 field. Unfortunately, the team got behind in
represents the test-first design process, XP's acceptance testing. I do not recommend this.
innermost feedback loop. Our first line of
code was a test. The test did not compile. Evolutionary design
We fixed the compilation. We ran the test. It Evolutionary design relieved a lot of
failed. We fixed the test. We were finally in pressure from the team. We didn't have to
maintenance! create the best design of all time for things
We also established pair-programming we were not quite sure about—only the best
guidelines. We could develop test cases, design for what we knew about at that
simulators, and interface classes on our own moment. We made good design decisions one
but had to do all other production code in at a time. Our automated tests and refactoring gave
pairs. The first iteration had significant us the confidence that we could
downtime, considering only one pair was continue to evolve the system.

Authorized license
3 2 IEEE use limited
SOFTWARE to: UNIVERSIDADE FEDERAL
November/December 2001 DO MARANHAO. Downloaded on March 26,2024 at 18:11:48 UTC from IEEE Xplore. Restrictions apply.
Machine Translated by Google

Object-oriented design is important impressed with our results in terms of pro- About the Author
supporting practice of XP. OO program-ming ductivity and quality. Because of this project,
James
languages let you build software in two other pilot projects were started.
Grenning
small independent pieces, a practice that is the director
test-first programming promotions.8 of consulting
at Object
Mentor and
Project manager surprises want XP, the management doesn't, and is currently
Not only were the programmers happy I n my experience, when
if management wantsthe engineers
XP, the engineers practicing

with their creation, but the project manager don't. Where is the trust between management and coaching
Extreme Programming. Areas of interest
it was as well. After the fourth iteration, he said, and engineering? are organizational change, software
“I'd only have three documents by now! In- To managers: Try XP on a team with process improvement, and the business impact

stead I have a piece of the system that works!” open-minded leaders. Make it okay to try of agile software development. He helped
create the Manifesto for Agile Software
The manager discovered another benefit. new things. Encourage the XP practices. Pro- Development (http://AgileAlliance.org)
Usually a project manager coordinating a vide good coaching. Challenge your team to and is a signatory. He is also a member of
the ACM. He earned a BS in electrical
team's work with other teams spends a lot of go against the status quo. Recruit a team that
engineering and computer science from the
time juggling priorities and figuring out tasks wants to try XP rather than force a team to University of Illinois, Chicago. Contact
dependencies. On the XP team, dependencies use XP. Make sure the organization sees that him at Object Mentor, 565 Lakeview Park-
between features were almost nonexistent. no one will be punished for trying something way, Ste. 135, Vernon Hills, IL 60061;
grenning@objectmentor.com.
We built features in the order of customer different. When hand-picking XP practices,
priority, not internal software framework or-der you might compromise the self-supporting
dictated by a BDUF (Big Design Up Front). nature of XP. Try as much of XP as you can.
The team was agile and able to adapt to the Iterations are short. Feedback comes often.
other subsystems' changing needs. To engineers: Develop a sales pitch.
Identify problems that you might solve. Identify
Building the team the benefits, identify the risks. From a pilot
We built the team slowly, while we were project. Iterations are short. Feedback
developing skills. We felt we could absorb one eats often.
or two people per iteration. We didn't let
newcomers take tasks right away, but used Acknowledgments
them mainly as pair partners during their first I thank the real client who provided the experience
iteration. Then, as they got to know the sys- to write this article (who wished to remain anonymous). I also
want to thank Chris Biegay and Jennifer
tem and our practices, they started to take on
Kohnke for a job well done in helping me prepare this
tasks at the iteration planning meetings. We article. I presented an earlier version of this article at XP
didn't assume that team velocity would in- Universe in July 2001.

crease when we added a new person to the


team—we measure velocity, not predict it. References
The DPS way of developing software 1. K. Beck, Extreme Programming Explained, Addison-
Wesley, Reading, Mass., 1999.
made up for programmer inexperience by
2. A. Cockburn, Writing Effective Use Cases, the Crystal
having senior engineers review the least ex- Collection for Software Professionals, Addison-Wesley,
experienced engineers' work. In XP projects, Reading, Mass., 2000.
3. M. Fowler et al., Refactoring: Improving the Design of
you must still address the spread of experience;
Existing Code, Addison-Wesley, Reading, Mass.,
for instance, it is critical to have at least 1999.
one senior engineer on the team. We don't 4. S. McConnell, Rapid Development, Microsoft Press,
Redmond, Wash., 1996.
give senior people a big title or special role,
5. J. Gall, Systemantics: How Systems Really Work and
but we need them. They help spread the How They Fail, 2nd ed., General Systemantics Press,
wealth of knowledge, and both they and Ann Arbor, Mich., 1986.
6. RE Jeffries, Extreme Programming Installed, Addison-
their pair partners learn.
Wesley, Reading, Mass., 2001.
7. T. Mackinnon, S. Freeman, and P. Craig, Endo-Testing:
The end of the story Unit Testing with Mock Objects, XP Examined, Addison-
Wesley, Reading, Mass., 2001.
Unfortunately, I cannot present the story
8. R. Martin, “Design Principles and Design Patterns,”
of how the project completed, because it was www.objectmentor.com/publications/
mothballed due to changing market needs. Principles%20and%20Patterns.PDF (current 12 Oct.
2001).
This is in the spirit of one of XP's mantras:
Work on the most important thing first. Nev- For more information on this or any other computing topic, please visit our
ertheless, the team and the managers were Digital Library at http://computer.org/publications/dlib.

Authorized license use limited to: UNIVERSIDADE FEDERAL DO MARANHAO. Downloaded on March 26,2024 atNovember/December
18:11:48 UTC from2001
IEEEIEEE
Xplore. Restrictions apply.
SOFTWARE 33

You might also like