XP Values, Principles and Practices
Adapting Extreme Programming (XP) for your local environment can be risky and challenging. To do this correctly, you must remain aware of the XP values and principles to avoid trouble. I’ve seen recent discussions in various forums about the meaning of XP values and principles. Here are my current working definitions.
Values. A description of preference between alternatives. Often the alternatives represent candidate courses of action and the value guides the selection among the alternatives. Sometimes values are basically axioms. They can be irrational in the sense that we might not be able to explain them intellectually or they might be primarily based on emotions.
Principles. Statements describing a model. A scientific principle is a statement describing an aspect of physical reality. Principles might also describe a model of social activity, for example. Principles can be fundamental or logically derived from fundamental principles. It’s commonly believed that principles are derived from values, but sometimes people have certain values because of specific principles. For example, the XP "value" of communication can be derived from the principle that communication improves cooperation and coordination effectiveness. This circularity between values and principles can be confusing at times.
Practices. A pattern of activity that can be repeated to achieve goals within a context. A person defining a practice is applying principles within a framework of their values (preferences). A related collection of practices might be called a process or methodology.
The XP values and principles describe the basis for the XP practices. That’s interesting, but why should we care much about that?
If the practices work, do we need to know the values and principles behind them? I believe we do, because the effectiveness of a practice very often depends on the context.
Adapting Extreme Programming (XP)
Sometimes the practice fits the context reasonable well, sometimes it’s better to tailor or eliminate the practice. There may also be situations where we need different or new practices that work well with our existing set of practices. Although the idea of tailoring or adaptation of practices causes concern for some agile practitioners (and they have some good reasons for that concern), the common need for adaptation has been discussed by influential thought leaders in the agile community.
You can use the principles to understand the practices better and to improvise complementary practices when you don’t find one that suits your purpose. While the statement of practices is intended to be clear and objective ("write a test before changing code"), understanding how to apply the practice in your context may not be obvious. The principles give you a better idea of what the practice is intended to accomplish. Also, no fixed list of situated, context-dependent practices cover all of software development. You will create new practices occasionally to fill your specific needs. Understanding the principles gives you the opportunity to create practices that work in harmony with your existing practices and your overall goals.— Kent Beck
One of the biggest issues with XP, and indeed with any agile method, is how to do the essential local adaptation where you alter the process to fit the local conditions. The principles help provide some guidelines on what bits of adaptation will work, and which go against the XP grain.— Martin Fowler
Issues with XP Adaptation
So why does adaptation create so much concern? The documented XP values and practices can be difficult to understand. Some values look like principles and vice versa. Some of the principles seem more like practices. The values and principles describe a model, but only vaguely. This description is not enough to really understand why and how the practices will work in specific contexts. One benefit of trying the practices as documented for awhile is that you will be more likely to develop and understand the model underlying the XP principles. Reading an XP book or two is not enough to gain that understanding. On the other hand, someone who has not read any of the XP books might have a similar model based on their own experience and thinking over the years.
As an example of potential sources of confusion, in Extreme Programming Explained (first edition), feedback is listed as a value and rapid feedback is a principle. In the second edition, Beck dropped rapid feedback as a principle. Is feedback (rapid or otherwise) a value, a principle, or what? It’s a little more clear if we rephrase the principle as "people tend to learn better with a shorter time interval between action and feedback".
XP and Continuous Improvement
That’s fine, but why is learning important?
Learning is a form of adaptation. Maybe the principle is more general: "people tend to adapt more effectively with rapid feedback". Combined with the principle that "adaptation can be an effective strategy for being successful in dynamic and uncertain environments", we can conclude that rapid feedback will often help us be more effective in business and technology contexts that change frequently and where we have incomplete knowledge. I’ve intentionally used qualifiers like "tend to [have this effect]" and "will often [have this effect]" because principles must be considered in context. Here’s some other meta principles that might be useful: "principles are only valid in context", "understanding the context where a principle applies will allow a person to apply it more effectively", "looking for counterexamples for a principle can help to understand in which context a principle applies or not". For feedback, we might review the principles of cybernetics and where feedback leads to problems. We can also evaluate our own experience for counterexamples. The risk of the latter is that it can be very difficult to remain objective when evaluating personal experience.
If you rely on the XP documented values and principles it can be very confusing. You really must think about it more deeply and define your own values and principles, possibly using the XP suggestions as a rough starting point. If your resulting values and principles are consistent with XP, then consider using some or all of the XP practices. Otherwise, you should find or create development practices that are a better fit for your world view. Kent Beck, the creator of XP, discusses some of these issues in the following video.