The semicircle (episode 5 -- Brownbag Lunch)
Jeremy arrives first, he settles in near the projector and takes a sandwich out of his brown paper lunch bag. "So if I understand correctly, you propose that we spend the lunch break on the XXL code." "Yes. But just experimenting, mind you. It's a trial." "Don't bother justifying, I am joking."
Farid and Audrey now show up and take a seat. Farid asks, "Could you remind us what you mean by Mob Programming? I forgot." "Rather than trying to explain it, I suggest we try if you want to?" "Okay said Audrey. The question is: on what code?"
The projector is now on. You search the source directories of the XXL project, saying, "We need an in-progress story, I think." "Take number 106."
You click on a yellow rectangle and a pop-up appears.
As a user, I want to be able to allocate the budget over any period.
Jeremy points out, "It's unclear."
Audrey explains: "Today the budgets are calculated on a semester basis. The user enters an amount, and the program splits the amount into months by dividing by six. What's needed is to be able to enter any number of months, and the amount would be spread over all those months." "A number of months and also a starting month, you mean?" "It isn't specified." "How should the program determine the starting month? Should it guess?" "Jeremy, you really should have come to the backlog grooming meeting." "I had soccer duty." "That isn't funny."
Breathe. You say to yourself, "I should have started with the bowling kata." You say out loud, "If we need to, we can always call Charlene." "OK." "Here's how we'll get organized: the person sitting in front of the keyboard is the driver. The other participants are navigators. The driver's role is to implement what navigators tell him to implement. The driver can't decide alone what code to write, he waits for instructions from the navigators. The driver is not allowed to think."
"OK! Can I be the driver?" asks Jeremy. "We'll switch the driver every ten minutes, so that everyone gets a chance to try both roles." "First dibs!" says Jeremy.
He takes your spot in front of the keyboard.
Audrey starts. "The first thing to do is look at the code of the SemesterBudgetManager
class. Here. Go to the DefineBudget
method. It takes the amount of the budget as an argument." "How does it know which semester we're using?" Farid asks. "It's one of the class fields."
Sitting in the back of the meeting room, you stare at the class code, but not without difficulty because Jeremy is moving the editor window around far too quickly.
Farid says, "This code is hairy."
Audrey explains, "It was part of the business layer of the Gramma app that we inherited after the company bought out GM-Soft." "I wouldn't have written it like that." Farid says. "Actually, I'm surprised you never got into this code." "Maybe you are, but that's the truth. I have plenty enough work with the front end, as a matter of fact."
Audrey says to Jeremy, "We just need to add a StartingMonth or BeginMonth field, something like that." "Which one, StartingMonth or BeginMonth?" asks Jeremy. "BeginMonth doesn't mean anything," intervenes Farid. "You might as well be coding in Greek." "It doesn't change the problem," answers Jeremy. "How will the class know that the starting month isn't already in a budget?" "We only have to add a parameter to the constructor." "Add a parameter to the constructor?"
Your cell phone rings. Ten minutes have passed. You say, "I'll take the keyboard. Jeremy, you join the navigators." Jeremy resumes. "So, how will the class validate that the starting month isn't already budgeted?"
Audrey answers, "It isn't described in the story. But I think that if you look in the CalendarBudgetManager
class, there must be a method that takes care of that. ToF, open the CalendarBudgetManager
class. It's in the Calendar
module."
You navigate in the subdirectories. You see this code base suddenly in a new way. It's like a room full of rubble, dimly lit by a generator that a rescue team was able to bring by. You don't see very far, but far enough to take an inventory together.
You listen to Farid and Jeremy debate what step to take next.
"You declare a new constructor, different from the default constructor, which will take the starting month as parameter." "No way! There are rules for persistence. You can't go tinkering with new constructors whenever you feel like it." "It's temporary. Just until we know how we can make this class work with the new story." "Temporary, my ass. If you do that, we're no longer following the original design. And besides, we'll be undermining the Single Responsibility Principle." "Remind me what that is?"
He reminds him what it is. Eight minutes have passed, and you haven't edited the code once. Audrey tries to reach Charlene for additional information, to no avail. Jeremy says, looking at the code bitterly, "That's a completely half-assed solution, that idea of yours." "It would at least be a step forward."
The alarm goes off. Farid takes the keyboard. You suggest, "Could we run the code now, putting a break and a print command to know what happens when the method is invoked?" "Ok, let's."
Farid puts in the break and the print command. Then he runs the application. The application doesn't start up because a setting in the acceptance environment is no longer there. You look for the setting. You accidentally launch a script twice, which has the effect of changing all the results of the previous calculations. Now the budget item chosen for the test can no longer be reset and put into the budget.
After three rounds of drivers, you can finally start the budget calculation. The calculation is done, and the program returns to the menu. It didn't go through the break point set by Farid.
Jeremy laughs. "No kidding! The method is never called." "Oh my, oh my..." "Well, it doesn't surprise me, because I was thinking this code doesn't look like the normal code in the business layer. It isn't formatted the same way." "For all we know, it's dead code." "If that is the case, let's delete it."
Audrey intervenes. "Please don't touch anything. I spent enough time in Maria's office last week. I wouldn't want to have to go to pains to explain to her in all manner of detail, why we have regression defects in the Budget module."
You consider the extent of the damage. This generator has limited autonomy. It is already one thirty.
Jeremy offers a solution. "What we need is to review the model with the P.O. and completely redesign the module. To do it right, we would have to redo the design of the entire business layer in fact." "As if we could embark on a redesign..." "So what about my story? What are we going to do?"
You propose a round of feedback before ending the session.
Farid says, "Mob programming is interesting, I think it can work, but you need a very clear agenda. And more precision in the user story, too."
Jeremy says, "The intention is good, but you have to be realistic. The current design of the app doesn't lend itself to this way of working. And frankly, we should do a source code scan to detect dead code, and get rid of it once and for all."
Audrey says, "I was interested in the idea, especially after what I saw at the Dojo two weeks ago. But now my impression is that all we do is notice all the problems and take no action. And we don't agree at all on possible solutions."
"We can agree," says Farid, "It's just that we need more time." "I don't agree," says Jeremy. "If we don't have the same fundamental design principles, we might as well work alone, as long as we stay in our separate areas." "And what, integrate only in the end?" Farid asks. "That'll be a gorgeous application." "It depends on your perspective," Jeremy replies.
Audrey's looking at you, while interrupting the discussion with a bold hand gesture. You say, "I'm a little disappointed. On the one hand, we are finally discussing the famous business layer, and I've been wanting to do that for a long time. On the other hand, given the time four of us need to run a simple bit of budget recalculation code..." "... and understand what's going on!" "And understand what's going on, I have doubts about the process."
Jeremy gets up, "Well, I am swamped. I have to go back to my technical story." The group cleans up and puts the chairs back. Audrey is already in the hallway, on her way to her 2 p.m. meeting. She adds, "Turn off the lights when you leave!"
(to be continued) Previous episodes : 1 -- If the code could speak 2 -- See/Advance 3 -- Communication Breakdown 4 -- Driver/Navigator