Recently there was a blog posting and a rebuttal and I found that I agreed and disagreed with both. I’d like to briefly discuss them and my opinions on them.
The Party of the First Part
Naresh Jain posted about his opinion about TDD and his ‘dilemma’. He discusses what he sees as the costs of unit testing, both the obvious (writing, running, maintaining), and ones he lists as ‘subtle’.
These subtle ones I recognize but perhaps do not entirely agree with: illusion of safety, opportunity cost, getting in the way, obscuring simpler design.
He concludes with:
Its easy to say always write unit tests, but it takes years of first-hand experience to judge where to draw the line.
I do not find this unreasonable.
The Party of the Second Part
In response Robert Martin posted his riposte. It is a piece of parody and while amusing I think is a smidge off the mark. He again draws the analogy between unit testing and double-entry bookkeeping. He uses the same obvious and subtle costs for double-entry bookkeeping (my understanding of double-entry bookkeeping is limited but his parody seems accurate).
It is obvious that Martin does not believe Jain’s conclusion is reasonable.
To me Jain’s post is mostly reasonable. I have a minor disagreement with his obvious cost of ‘…understanding other’s unit tests’. To me this is NOT a problem of unit testing at all but of ANY code. Concerning his subtle costs I can agree with this first, understand his second but disagree with his third and fourth. Unit tests are a safety net. But this do not make you safe from all danger. You need to know what they cover and what they don’t. There are opportunity costs, I would not unit test a spike and a several spikes, each of which I throw away, may definitely be a better use of time then a single attempt at unit testing a solution from scratch. However I will then unit test the final solution. His third and fourth points are again not a problem of TDD but a problem of all code.
Martin’s riposte is amusing and I can imagine him speaking it in his particular style. However I ultimately feel it is a flippant response. I don’t think Jain’s position is worthy of ridicule. I think it is worthy of disagreement.
I am not suggesting some sort of PC-ish self-censoring or to ‘Teach the Controversy’. I disagree with Jain’s post. I have found (warning anecdote:) that TDD outweighs the costs 95% of the time, and in fact the remaining 5% is shrinking as I continue to learn.
In normal mythology the far past golden-age was an age when people were
stronger, more beautiful and intelligent than they are now. We have
diminished over time.
* In 1974 D&D heroes had +1 bonuses if they were lucky. You got d6 hit
points and you were happy (pretty good for the magic user actually).
Everything did d6 damage. Magic was smaller and rarer - there was no
such thing as Magic Missile. Clerics didn't even get a spell until
second level and getting to second level was hard!
STR. Fighters got d10 hit points and it was amazing! Magic was more awesome, but still not everyone had it. * In 2nd edition characters got SKILLS! Clerics had powers * In 3rd edition characters had /FEATS/! It was like everyone got a
bit of magic now! And people started talking about BUYING magic
items - those things were for sale now in game worlds! * In 4th edition - this is the golden age. First level characters have
double digit hip points and do massive damage. There are lots of
'magical' abilities for everyone. I'm sure the local beggars have
some sort of daily begging powers or something. Everyone is studly
and puissant. Thus D&D is the opposite of mythology in a way. But also in a way I
think we may have still diminished a little along the way.
(warning: an odd half-formed thought is contained herein)
- Yaweh let Adam name all the creatures in the world – this gave Adam dominion over all the creatures.
- Medieval magicians believed that knowing the name of a thing would give them power over that thing.
In software development we name things to keep tabs on them. To get a handle on them. Without a name we can’t refer to things — we can’t move things around — we can’t organize them.
More importantly: to have the true name of a thing allows one to have absolute control over it. Without the true name we don’t have full power.
Naming seems to be a special case of the power of language. With language we have the power to communicate, to do things collaboratively. Names let us do actions to things, and to collaborate on those actions.
 In a discussion on Naming in the context of Software Craftsmanship I made an odd statement linking naming in software with medieval magic and the naming of all the creatures from the Judeo-Christian Genesis myth. I thought I could expand it slightly here.
 A mashup of the two Genesis myths (1:36 & 2:20).
This is what a completed century looks like: Everything else are just details.
The dramatis personae of this story are: a 40 year old male: and a 39 year-old lady
The trip was approximately the following route.
The fact that it ended up being a Century was a bit of a self-trick on my part. I planned on the trip to Salem and maybe further. Of course when i got to Salem I felt great (only 15-20 miles) so I went off to Manchester-by-the-sea; and still felt great so off to Gloucester etc. Thus after 50 miles I was standing on the train platform in Rockport looking at the sign: and thinking – yes, time to head back.
Along the way I saw some lovely sea-sides, like the dock at Rockport where Gale posed for me and Independence Beach in Beverly: Also somewhere, I passed this lovely marsh:
It wasn’t all lovely however, the roads were not always pleasant, the hills steep, and the pilgrims unfriendly:
Salem, where I took my longest stop in either direction seemed to have only one bike rack in the center of town The sad monuments in Gloucester made me remember the loved one I left behind when I “[went] down to the sea [by bike]”
In the end it was a great trip. The day was lovely and I managed not to back down from the challenge. I set myself a goal of riding a century this year and have done it. It’s very good to know that I can set myself a goal and carry it out. I hope to take this knowledge and remind myself of it when I hit low points in my other goals/projects.
 (I say approximately since I took several wrong turns here and there (more like wrong straight-ons-when-should-have-turned-s) but that luckily found a slightly nicer track right when I got into Beverly by going on Lothrop Street which led me along the water.)
do my 'usual' loop backwards (/e.g./ home -> Norumbega -> Walden ->
Concord -> Bedford -> Lexington -> Home (plus something more to fill in
extra mileage). It did not turn out as expected... For one, it was cuter than expected. I saw a total of 10 chipmunks
(3 suicidal), 1 groundhog, a serene black-and-white cat sitting on a log
in the woods and 1 duck with bevy of ducklings paddling along in a
culvert. That along with the usual set of squirrels and birds made for
a high cute-level of the ride. Secondly the ride was longer than expected. I was 6-7 miles short when
I stopped off at home to refresh my water and make some. I decided to
take the loop around the Charles, boring, but would be easy enough -
even with the remnants of Bruins fans littering the ground. However
when 50 showed up on my odometer I decided to press on - I was feeling
pretty good. In all I rode 62.39 miles. That put me just into the
100km territory - thus I have unlocked my next 'achievement': Metric
Century. One other oddity of this ride: tourists at the Norumbega tower. I was
sitting there at my first way-point sipping my coffee when they arrived
in two cars and came up and started reading the plaque. As I prepared
to leave I told them about the plaque at Mt. Auburn Hospital and the
Lief Erikson statue on the Commonwealth Mall. Then they asked what else
I knew about this odd guy - thus I became briefly a sort of tour-guide
for New England's bogus Viking heritage. I am annoyed with myself that
I never asked them what brought them to the tower however. Trip Statistics:
* Miles: 62.39
* Riding Time: 5:38:44
* Total Time: (uh... more...)
* Average Speed: ~11mph I am quite pleasantly surprised that even after such a long ride my
knees/legs/butt is doing pretty well. Right after the ride I was pretty
beat, and the next day as well my knees (especially the right)
complained about stairs. Now on the 2nd day after there seems to be no
problems and riding my bike today felt great. A hundred miles seems
very doable given time in the day. I'm going to do a few more 62 mile
runs and at least one 75 before I do my Century. I might be able to do
it as early as September which might make a great thing to do for my
birthday. Footnotes:  Here usual means the route I've taken twice before.  They must have been metric chipmunks since on average they appeared
1 per 10km  Of course about a mile later, one knee and the opposite calf
started complaining. Typical.
Norumbega is a mythical place, a sort of place holder name for unknown locations in the New England area. Today I biked there, battling thunderstorms, mobs of Steampunk cosplayers, and mechanical failures, to the dark, abandoned, closed tower which is the lonely outpost of the area’s long lost Viking past.
Eben Norton Horsford held the Rumford Chair of the Application of Science to the Useful Arts at Harvard in the late 1840’s. He later founded the Rumford Chemical Works and produced an improved recipe for baking powder. This baking powder is still being produced as Rumford Baking Powder. He also held the controversial idea that Lief Erikson sailed up the Charles River, as far as Waltham (near present day Brandeis University) and ultimately building a house in Cambridge.
I decided that I would trace Leif’s trip up Charles River, Gale would be my longship and we’d brave all trials and tribulations we might find along the way.
The expedition started as all good expeditions do with a good breakfast (in this case supplied by my lovely wife Wendy who cooked some delicious pancakes), and the laying in of supplies (16oz of Clover™ brewed New Guinea coffee put into my thermos from the local Starbucks). With these preliminaries completed I started my fateful trip.
Stopping first to contemplate the location of Lief Erikson’s house.
It lay just outside the back of Mt. Auburn Hospital, I wondered just what this spot must have looked like in the year 1000 BCE; probably less traffic.
From there I started the long ride up the river to my next destination. I had not before ridden so far up the river (usually just stopping at Watertown dam). I took several wrong turns because I didn’t know how the “Blue Heron” path ran so I missed it in a few places; and worse turned in the wrong direction entirely when part of it turned out to be closed in Waltham. The clouds were rolling in and so was the thunder, I was worried that I was going to be caught in the rain and I had not yet found the tower. Riding through Mt. Feake Cemetery the rain caught up with me. Through the cemetery quickly and then ducking into the Brandeis-Roberts train stop I hoped to wait out the rain. I sipped some coffee and waited. The rain continued but it looked like it was brightening. Checking my map I knew I was close to the tower. I decided that the rain was lightening up so I recounted for the final stretch.
Mother Nature, that fickle woman, was up to her usual tricks and mere moments later I was soaked as the rain quickly got worse. I pressed on to the tower and was pleasantly surprised to find it much easier to find than expected.
The tower marks the location where there had been a Norse fort/city according to Horsford.
At one point it seemed that the public could climb the inside of the tower to enjoy the view from the top, but now it was all blocked off with welded in gates. Some of them had been broken/pulled off but the holes were not big enough for me to enter but I could still contemplate the dark mysteries that might have been hidden within.
The rain was fluctuating in intensity and since I was already wet I decided to just start heading back. For the first five or so miles I held out the hope that the rain would stop and the sun would come back out. After that I gave up that hope. I was so wet that stopping to get out of the rain would be useless. I probably would be drying if I had jumped /into/ the Charles River. I even decided to ride /past/ home to finish this expedition.
My final stop before turning to home was the Lief Erikson statue at the beginning of the Commonwealth Avenue Mall.
Having attained pictures of the statue, I hoped back into my longship and rode it over the Harvard Bridge into Cambridge and finally home.
The expedition, though wet, was a success. Total ride length: 31.21 miles. Total ride time: 3:00:22.
 It appears on a map dating from 1570
 I didn’t know that it was the Steampunk Festival in Waltham. Quite surprised to turn onto Moody street and see lots of be-goggled folk. And Morris dancers! Who let the Morris dancers in?!
 Gale’s chain needs replacing, it is at that stage where it will jump off the rear cog if I am pedaling over hard bumps. Furthermore she has taken to shifting randomly from 1st into 2nd.
 He was appointed to the chair in 1847.
 And, frankly, silly.
 Thanks Wendy!
 The name of “Mass Ave. Bridge” is “The Harvard Bridge”. Of course no one calls it that since it is no were near Harvard.
 My cyclocomputer only counts time that the wheels are spinning. So times I took a break or waited in traffic are not counted in this time.
The past week was my first week at the new job. I learned a few things:
- I learned how good pair programming can be. (But I worry I hogged the keyboard)
- I learned a bunch of IntelliJ features/keystrokes.
- I learned the beginnings of Java vs. Groovy.
- I learned the power and the pain of “magic”.
- I learned that working hard and going home at 5 without feeling guilty is great (and also actually taking lunch too).
- I learned that having lunch with the team is really nice.
- I learned that there is such a thing as a good retro meeting
- I learned that pairing is a great way to be productive on the first day on the job.
- I learned that knowing the programming language isn’t really that important at the start of the job.
(a half-baked thought)
In a previous post I realized that to me TDD has a little bit of the same feel as working in a REPL. When I first learned the technique it really clicked for me since I always preferred what i referred to as exploratory coding, that is, cycles of trying out little changes and moving toward the solution of the whole problem.
In a language with a REPL this exploratory coding is pretty normal. It is very natural to try something, play with ideas, and periodically save off the code you want. Without a REPL and TDD the cycle is slower, which leads to making larger changes since the cost of small changes is so high. Without a REPL, but with TDD, the cycles can be kept pretty short: short cycles of unit tests, longer cycles of integration and end-to-end testing.
So TDD gives one the ability to try out ideas quickly like in a REPL. It is not as good as a REPL. Of course TDD has other effects so the fact it is not a REPL is made up for. But, to me, the benefit of being able to play with ideas, trying lots of things, saving the good and discarding the bad should not be forgotten.