|
Simple design in XP means, to paraphrase the poet Wallace Stevens,
"the art of what suffices." It means coding for today's specified
requirements, and no more. It expressly means not coding for extensions
or changes programmers suspect might be required later.
So it means
not adding APIs, layers of abstraction, scaffolding, and other infrastructure
that are nifty and scalable but not strictly necessary
today.
Fortunately, by working test-first, we tend to constrain ourselves
to the simplest design that will get the current outstanding test
to pass. It can be amazing to new XP teams how much time is saved
simply by successfully resisting the urge to add stuff that has
not yet been requested.
So what happens, you say, if your simple design does need to be
drastically extended by future requirements? Haven't you shot yourself
in the foot with your simple design?
In a word, No. XP teams realize that what matters when making slight
or drastic changes to code is the overall level of craft and
extensibility of the code,
and the quality of the unit tests. If the test coverage is good
enough, and the code is extensible enough, you can make whatever
changes become necessary, straightforwardly.
Many systems eventually require drastic changes. You cannot anticipate
them all, so stop trying to anticipate any of them. Code for today,
and keep your code and your team agile, capable of turning on a
dime as the customer requires. You will be able to handle far more
system change this way, and handle it faster and more readily.
[Next Practice]
|