022 TDD with a Stack Overflow Master Developer

SCRUM NOIR is available on Amazon at: https://www.amazon.com/s?k=scrum+noir&ref=nb_sb_noss

AGILE NOIR is available in the US and Europe via Amazon: https://www.amazon.com/Agile-Noir-Lancer-Kind/dp/1533516499/ref=sr_1_10?keywords=scrum+noir&qid=1549945095&s=gateway&sr=8-10

AGILE NOIR is available in India at Pothi: https://pothi.com/pothi/book/lancer-kind-agile-noir

The simplified chines edition of AGILE NOIR can be purchased here: https://weidian.com/s/161651986?wfr=c&ifr=shopdetail

NOTE: THIS IT RADIO DRAMA STARTS WITH EPISODE 14, WHY DEVS DON’T TDD. START LISTENING THERE. 

CONNECT

Visit Agile Thoughts and register to receive free development, analysis, or leadership and management materials and learn to excel at developing software. I’ll also send information on my books and online courses. 
 

 
TDD with a Stack Overflow Master Developer

(Agile Thoughts plays in the background)

Vanilla: 

And so Mr. ah, Mr. Lecter is it?

Hannibal: 

Dr. Lecter.  But please, call me Hannibal.

Vanilla:

Dr.  well that’s how TDD works.  Can we give it a go?

Hannibal: 

This process seems so very simple and is wonderfully contradictory to a developer’s habitual workflow.

As of now i have questions about not only the efficacy, i also have questions about the value.

Vanilla: 

Uh, yeah.  Back to the workflow, do you understand the steps?

Hannibal:

The workflow appears to be, 1, study the existing product code to discover the area you’d like to alter.

Vanilla:

Yeah, that’s the same.

Hannibal:

2, determine a design.  This means think if the alteration is adding a new method or simply adjusting the existing code.

Vanilla:

And then?  This the KEY?

Hannibal:

Yes Clarice. Step 3 is–

 

Vanilla:

Uh Clarice?

Hannibal:

Please don’t interrupt.  Step 3 is where the fun starts.  Instead of going about altering the code we will write–

Vanilla

(Excited)

A test!

Hannibal:

Yes.  A micro test for the alteration.  Sometimes this test will use an existing interface, or it could be for authoring a new object and function and then later, test drive calling that new interface in the existing code.  Specing in the micro test the simplest next step of functionality.

 :

(dramatically )

And tttthen?

Hannibal:

Step 4, run the microtest and observe it fail.  And observe the red bar. Which,  (sternly) do you see it Clarice?  Do you see it?

Vanilla

ahh…

Hannibal:

It establishes that the micro test CAN indeed fail.  Because do you know what Clarice?

Vanilla

ahh…

Hannibal:

(angrily) There is no sense in writing automated tests that cannot indeed fail!

Vanilla

true

Hannibal:

And do you know the second reason? We can later observe the test result change its state from fail to passing after product code is added or altered.

And the third reason, writing the test first puts you in the viewpoint of the caller, the caller being the user of this new functionality.  And there is nothing like eating your own soufflé, as it were, that quickly teaches you to get your interfaces built in a sensible way.  All of this which is a more skill full way of writing code.

Vanilla

(embarrassed and awkward) Eh, yeah.  That all sounds about right.  So shall we get started?

Hannibal:

Yes. Let’s break this story down into two pieces.  The one half, we do TDD.  The second half, we do not. And we’ll use a timer to measure the difference in effort.

Vanilla:

Eh. Ok. Why?

Hannibal

Clicks his toungue. Well my dear Clarice, don’t you see? We must determine if TDD actually saves time in the development and test phases. Otherwise why do it?

Vanilla

Yeah. That makes sense.

Hannibal

The timer started. Let’s go.

(Typing sound.  Music.  Time passes. Ding.)

Vanilla

The test has passed.

Hannibal

This is marvelous Clarice! TDD has more Benifits than I predicted! I didn’t realize there would be this positively delicious feeling of accomplishment signaled by the green bar! And look at this test report! We got 6 tests passing, confirming the cases we decided are required to be handled by our code. All in an hour. And observe! With a simple click of the run button, the tests execute within a second. Each micro test only requiring mere hundredths of a second. Fascinating.

Vanilla

Yeah.

Jose

Whatcha you dudes doing?

Junior Joe

Vanilla Pop is pairing with someone, who, would you believe is the top rated developer on Stack Overflow?

Jose

Pops is going big on making another XMan?

Hannibal

I’m so stimulated. My mouth is simply watering.  I could eat you.

Vanilla

Woah. Dr. Let’s calm down.

Junior

It is lunch. How about we take Mr…

Hannibal

Doctor

Junior

Take the good doctor to lunch.

Vanilla

Well… I’m not—

Hannibal

Brilliant! Yes we positively must find some quiet, secluded, place.  Ideally where shouting won’t cause any alarm. I don’t live far from here.  How about I have the three of you over for lunch?

Jose

Sure—

Vanilla

Jose and I have an errand to run.

Jose

We do?

Junior

Well I’ll take you up on that.

Vanilla

No, we need your help too.

Junior

You do?

Hannibal

Oh how disappointing…

Junior

No, no. Pop.  The doctor and I will go. I can help you later.

Vanilla

But—

Hannibal

Off we go Clarice.

(Sound of them fading into a hallway) I’ve got this tantalizing roque that is to die for. all it needs is some very fresh meat…

Jose

Ok Pop. What gives? We don’t have anything planned over lunch.

Vanilla

I don’t trust that man.

Jose

You’re being paranoid.  Anyhow. Let’s get a burger. I am hungry.

Vanilla

I fear we will never again see our Junior Joe.

(Suspense sound)

(Door sound)

Vanilla

Oh you’re back doctor Lecter.  Where is Joe?

Hannibal

Joe said he had to run and do an errand. You should have joined us Clarice. Enjoying Good food is to be seated next to god, I always say.

Vanilla

Ah.. let me give Joe a call.

Hannibal

Nonsense. We’ve got code to write. There! I’ve started the timer. Now let’s build this second part without TDD and see what we observe.

(Typing music)

Hannibal

Fascinating, wasn’t it?

Vanilla

Yes. We wrote the code first like developers usually do, then we used the debugger to exercise it and discover and fix problems. I was surprised how much time it took to get the code right.

Hannibal

Correct. With TDD, the discomfort is great because we are doing design work too. With regular “hack n slash” development, we got busy just writing the code and banging on it with the debugger until it worked.

Vanilla

We even made a small program to exercise our code. What a waste since nothing is automated. I have this feeling that we still didn’t test as deeply.

Hannibal

Agreed.  There is no record of what we tested. No artifacts are checked in. It’s like we’ve never tested it.  The team only has our word.  I dare say my dear Pop, had we decided there was no time, we could have skipped testing completely. Based on the stop watch we saved 10% of time but—

Vanilla

But we don’t have automated tests. So we are actually behind.

Hannibal

Precisely.

Vanilla

And if we ever adjust this functionality, we’ll not—

Hannibal

(Yummy slurp sound) Have that tasty green bar to tell us that everything is in good condition.  The value of knowing all the code is in good shape is tremendous. We could ship immediately afterwards. (He stands, ready to go) Mr Vanilla Pop, this has been extremely educational. I thank you. The setup cost to writing a micro test with TDD is small compared to the continual value it returns. Every moment, someone could run those tests. Manual testing with the debugger delivers value only once. For example, what if I said, my lovely Vanilla, let’s change our untested code a bit and then redo our manual tests?

Vanilla

I fear sir that I would rebel. It would take us at least twenty minutes to redo what we did in the debugger.

Hannibal

Correct! So Micro tests deliver value everyday. Manual testing is good for only a moment as tenuous as a spring flower. Manual testing is such a bore, really. The psychological toll of manual testing is huge. But alternatively, I click run and Bam! All done. The cost to execute micro test automation is essentially zero.”

Jose

Has anyone seen Junior Joe? He’s not answering his phone.

(Suspense)

Hannibal

Excuse me. I’ve got to run.

(Door sound)

Vanilla

Oh dear. It just as my worst nightmare. Poor Joe. I knew we shouldn’t have let him go with that… that monster!  And now, Joe is gone.

Jose:

You and Lecter checked in your code right?

Vanilla

Yes. Why do you ask?

Jose

The Continuous Integration dashboard is reporting a micro test failure.

(Suspense)

Vanilla

Impossible we ran all the tests before checking in… hold on. See this here? Someone else has checked in a regression.

Jose

Oh look, the build has started another test run. Now will you look at that. Whoever it was has fixed the problem. The build is passing now.

Vanilla

Let me see who submitted that code. The build is reporting that it’s Junior Joe. He must be working from home.

Jose

He just slacked me that he skipped lunch to run home. He once told me his cell reception at home is bad.  Now what was it you were saying about a monster?

Vanilla

It’s just. Aah nothing.

Jose

Say, look at the street below. Is that Dr Lecter and Code Dog?

Vanilla

Oh my dear… it appears the catfish has been replaced by a salmon.  Well, good luck to the salmon.

Narrator:

If you’ve enjoyed the use of dramatic story telling to learn about TDD, you’ll also enjoy reading Scrum Noir, a project management comic that teaches you about Scrum by following the adventure of Ace, a hard boiled Agile Consultant. If comics aren’t your thing,  Agile Noir, a novel about a project manager who must transform his waterfall project into an Agile delivery model in order to survive. Both the comic series and the novel are available on Amazon. Agile Noir is available in India on Pothi.com, and available in Chinese on my WeChat store, LancerKind1234.  Links to these items are in the show notes.

Some sound effects were used from the following FreeSound.org users: keweldog, risto_alcinov,

FIND ALL THE EPISODES FOR THIS SERIES AT THE SERIES PAGE.

Agile Thoughts
Agile Thoughts
022 TDD with a Stack Overflow Master Developer
Loading
/

Comments are closed.