Chapter 12: Emergent Architecture and Design


Overview

I Can t Get No Architecture

(Sing to the tune of (I Can t Get No) Satisfaction by the Rolling Stones)

I can t get no
Architecture
I can t get no Architecture
Cause I tried
And I tried
And I tried
And I tried
I can t get no
I can t get no

Well I m refactoring my code
Yeah I m movin this and I m changin that
Every time I get the urge
But I m still sittin here waiting for
The architecture to emerge

I can t get no
No no no
Hey hey hey
That s what I say

I don t need no
Infrastructure
I don t need no
Infrastructure
Cause I tried
And I tried
And I tried
And I tried
I don t need no
I don t need no

When I m posting to the newsgroup
And a man comes on and tells me
That I should not say YAGNI
But he can t be a man cause he does not write
As much C code as me

I don t need no
No no no
Hey hey hey
That s what I say

GROUCHO  

Get a few people together and spend a few minutes sketching out the design. Ten minutes is ideal ”half an hour should be the most time you spend to do this. After that, the best thing to do is to let the code participate in the design session ”move to the machine and start typing in code. [1]
”Ron Jeffries

GROUCHO  

The larger the scale, the more you must rely on emergence. [2]
”Kent Beck

Emergent architecture (also called emergent design by XPers) is central to the XP way. The question is, in a complex, real-world project, does emergent design provide a sufficient substitute for planning ahead?

In this chapter we discuss emergent design from a few different angles. We start by revisiting YAGNI, the XP design mantra that in many ways sums up emergent design. Then we critique the description of emergent design given in the book Extreme Programming Installed . Finally, we compare emergent design with its deadly rival, up-front design with early prototyping (our colleague Mark Collins-Cope recently gave up-front design its own acronym, JEDI ” Just Enough Design In-front).

But before we get serious about emergent design, because we have the power of satire on our side, here s a little story that was inspired by the previous quote about letting the code participate in the design session (all right, we admit it, we ve just spent too many hours reading the Wiki Web while writing this book, and it s beginning to affect us just a bit).

start sidebar
SATIRE WARNING
The XP Society s Annual Picnic

(All the characters in this story are fictional.) The members of the XP Society were extremely excited at the prospect of their first-ever annual picnic, to be held the very same day that it had been announced.

What should the picnic involve? Society Chairman Ronnie Lips asked. None of us know, the picnic crew s unofficially elected spokesman, Tom Bradshaw, replied morosely.

Well, never mind, Chairman Ronnie empowered. We don t have to plan that far ahead. The main thing is to get the picnic underway, then we can decide what we need at a more appropriate time.

Great! Tom exclaimed, chirping up immediately. Now, let s have a quick think tank to get some initial ideas, then we ll get going.

That s the spirit! encouraged Ronnie. Now, what s the first, most important thing that any picnic should have?

Tom frowned, suddenly a little unsure of himself. Then his worried expression cleared and he quipped, Food! We want food, so let s bring food.

Excellent! confirmed Chairman Ronnie. That s more than enough detail to get us started. Now, I m going to gather everyone around for their early-morning stand-up show and tell them today is a special day: the last day of Planet Irk. No more irksome problems for us ”it s all plain sailing from here. And that s why this will be the best picnic in the whole world . . . ever!

But where should the picnic be? asked Tom. Don t worry, Ronnie chuckled. Remember, you have the Power of XP on your side. Just tell everyone to meet at the picnic site. When it is time to know where it is, they will know.

Master, you are truly wise, Tom replied. Yes, yes. Now get your thinking cap on, there s a picnic project to kick off! Chairman Ronnie departed to round up the rest of the team, leaving an air of hushed intoxication in his wake. Tom immediately telephoned his friend Jim and breathlessly told him the exciting news.

Jim was not so enthusiastic, though, because (he explained) today was his 1-year wedding anniversary and he already had plans.

Jim, Tom admonished in a mock- stern voice, remember this is XP ”and you re not allowed to say no! [3]

So poor old Jim reluctantly left a note for his wife, grabbed some randomly chosen food from the kitchen (some sausage rolls and a cake with Happy Anniversary, Bunnikins written on the top in special colored marzipan), and sped over to Tom s place.

Now, enthused Tom once Jim had arrived, we need to think this next stage through. Do you think we ought to have something to carry all the food in?

Jim seemed slightly gloomy at first but was soon swept up by Tom s infectious enthusiasm for the project. Perhaps a picnic hamper, he offered .

Can you eat a hamper? Tom immediately challenged. No, I didn t think so. Our customer s one requirement was that we bring food ”edible things. Our first and primary test for this is whether everything we bring is edible. And our tests are, after all, our picnic specification. Now, I rather think a picnic hamper would fail that test, don t you?

So they gathered up as much food in their arms as they could without dropping any and stumbled out to Tom s station wagon as best they could.

Fear my agile palm solution! Tom chuckled proudly, as an unboiled egg slipped out of the pile of food balanced precariously in his arms and hit the asphalt with a messy splat . Who needs frameworks? We re doing the simplest thing that could possibly work!

We sure don t! We sure are! Jim responded, trying to get into the spirit of the occasion.

Once they had made about 20 short trips back and forth to the station wagon, they piled into the vehicle and got underway. That was a lot of work, Jim commented, wiping perspiration from his brow.

Yes, Tom responded with his unrelenting enthusiasm, but we were sure as heck moving fast, weren t we?

We were the best! agreed Jim. Now, once we ve been driving for about 20 minutes, we ll decide where we need to go, said Tom.

About 20 minutes later, as Tom drove in silence and Jim furiously studied a battered old roadmap, Jim said, Well, there s Jimbo s Picnic Area about 20 minutes drive from here. In fact, it s right by your house. If only we d studied the map before we set off!

Oh, you and your grand designs, snapped Tom. You and your stupid, oldfashioned ivory tower logic. Well that s not how we do things here. See, there s no time lost really. I can turn the car around ”for free! Now we re simply heading back in the opposite direction.

Well, Jim replied, bristling, if we d thought this through from the start, we could have gone to the Grand Conifer Nature Reserve and eaten our picnic with the tame bears! But no, it s too late for that. Jimbo s Picnic Area it is.

They arrived at Jimbo s Picnic Area about 40 minutes later (having taken a few wrong turns). To their delight, Chairman Ronnie was already there, waiting for them with a broad, beaming grin on his shiny face. Behind Ronnie, the entire XP Society stood grinning. Tom and Jim cheered up at once and quickly forgot their earlier quarrel.

Where s Bill? Jim asked as they bounded out of the station wagon. Bill s pair-programming from home today, Ronnie explained. Although . . . we haven t quite worked out how tele-pair-programming is going to work yet. Anyway, let s get this picnic set up!

Singing and cheering happily, they brought out the food: Jim s anniversary cake and sausage rolls, plus some canned fruit, a microwavable suet pudding, a frozen chicken, three dozen half-baked baguettes ( Mmm, you should taste these ultra -fresh dough treats once they re fully baked! ), a bottle of undiluted orange-squash cordial, and several bottles of fizzy wine.

They started with Jim s sausage rolls but were appalled to discover that the rolls were uncooked.

Yes, Jim explained enthusiastically, they re much fresher this way. You just heat them in the oven for 40 minutes. Oh, hang on . . . we need an oven.

Standing in a circle, the group descended into a slightly depressed hush. I tell you what, Tom offered. My house is just around the corner. Why don t I take the sausage rolls home now, cook them for 40 minutes, and bring them back when they re done?

Splendid idea! Chairman Ronnie exclaimed. Except . . . I m sure Derek over there has a fan-assisted oven. He could get them cooked in half the time.

That s right! Derek quipped, stepping forward. He grabbed the sausage rolls and drove away in a cloud of dust.

But doesn t Derek live an hour s drive away? Tom queried, sounding hesitant. Excellent point, Chairman Ronnie confirmed. Still, not to worry. We can eat the cake while we re waiting.

They quickly discovered that they didn t have a knife with which to cut the cake, so another XPer was sent away to find a cake knife . When he returned an hour later, they discovered that they had no paper plates on which to put the slices of cake. Another XPer was sent away to find some paper plates.

That XPer arrived back at about the same time as Derek, who proudly showed everyone his stack of sausage rolls (which by this time had cooled down and turned slightly rubbery).

They stood around in a disconsolate circle and munched the cold, rubbery sausage rolls.

Minutes later, Derek was sent away again to quickly defrost and cook the frozen chicken.

Anyway, Chairman Ronnie announced, sensing that his troupe was in need of some morale boosting , it s time for the cake! Jim kindly informs me that he has probably sacrificed his marriage and future happiness to bring us this cake, so I am sure it will taste quite nice.

Do we have any plastic forks? someone asked from the back. I don t like to get my hands grubby with cake goo.

An increasingly disillusioned Jim was sent away to find a shop that sells plastic-forks.

As the afternoon wore on, various Society members were, in turn, sent away to find paper napkins, a can opener , small plastic bowls, a corkscrew, folding chairs for everyone to sit on, a small foldaway table to keep the food away from the ants , cups, mosquito netting (as it was long since dark by this stage and the mosquitoes were having a heartier feast than the increasingly morose Society members), and ”the last straw ”a shotgun to fend off a nearby bear.

As the picnic drew to a natural close and wrapped up, the disgruntled members- began to pack up their things and go their separate ways. It was midnight by this stage, and no one was really speaking to anybody else. Almost everyone had mosquito bites, and one member had been badly mauled by the bear.

As they departed, a frustrated-looking Derek returned and announced that despite his best efforts, the chicken was still frozen solid.

Never mind, offered Chairman Ronnie. If any task looks as if it s going to take too long, we just don t have to do it. That s one of our most important rules. And anyway, he added, in a last-bid attempt to rally the silently departing Society members, I have decided that tonight s grand finale shall involve fireworks! The grandest fireworks you have ever seen! And . . . and a 40-piece orchestra.

The rest of the Society members just ignored him and silently departed, their heads hung low.

The following week, the Society Web site described the annual picnic as a bit chaotic , but a roaring success nonetheless, and urged everyone to bring a friend along the following year ”same date, same place.

That is, the Web site blurb added, assuming that we choose the same venue and date. We will let you know on the day.

end sidebar
 

[1] Ron Jeffries, Ann Anderson, and Chet Hendrickson, Extreme Programming Installed (New York, NY: Addison-Wesley, 2000), p. 70. (Emphasis ours.)

[2] Kent Beck posting to the C2 Wiki page Can An Architecture Emerge, http://c2.com/cgi/wiki?CanAnArchitectureEmerge.

[3] See http://www.objectmentor.com/resources/articles/xpepisode.htm.




Extreme Programming Refactored
Extreme Programming Refactored: The Case Against XP
ISBN: 1590590961
EAN: 2147483647
Year: 2003
Pages: 156

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net