In this free introduction to the London vs. Chicago comparative case study, Bob and Sandro explain the premise of the competition, and the rules of the game.
And so it begins! London is first up. Sandro Mancuso takes the lead for the next five episodes, creating a Twitter-like app using the outside-in "London School" approach.
In this episode Sandro completes the first few use cases. The acceptance tests for those use cases pass. The unit tests and the production code are written.
And, in this episode, we see the first hint of the double edged sword of mocking: we see how the outside-in approach drives architecture. We see how the unit tests drive design. And we also see how the prodigious use of mocks may make the unit tests and production code fragile.
Note: You can find the code here. Three branches are of interest:
The starting-point branch is where both implementations began.
The openchat-outside-in branch captures the tomato by tomato history of the London approach.
The openchat-unclebob branch captures the tomato by tomato history of the Chicago approach.
Enjoy!
This was a very intense session, and I nearly lost it at the end.
We discovered that our concept of unit and acceptance tests differ markedly and we use them for different purposes. Sandro uses acceptance tests to probe the architecture. He uses unit tests to drive the architecture. His acceptance tests do not completely probe behavior. His unit tests do, but at the expense of the fragility imposed by mocks. Will that fragility cause trouble in the end? The benefits are clear, but are the costs worth it?
DUCK! Everybody take cover! Uncle Bob takes the keyboard!
Well, just for a tomato or two. I wanted to try the outside in approach while Sandro coached me. It was a fun exercise.
We got a lot done in this episode, and concluded it with a little Lagavulin 16.
It's getting pretty mechanical now. The use cases are popping out of the sausage machine with an almost clockwork regularity. Uncle Bob takes the keyboard again, and this time manages to actually complete a use case. Wow.
The end is in sight. One more episode ought to do it...
This episode goes into overtime to complete the application. During the episode the crank keeps turning; and the clockwork production of the use continues.
In the end, the application is done. Everything works. Time to dance a jig.
Ah, but wait! It's going to be Uncle Bob's turn next!
Chicago! Uncle Bob begins, inauspiciously. He starts with UML! He creates global variables. He assiduously refuses to use the mocking framework. He seems to struggle against the constraints of the tools, preferring the slings and arrows of outrageous fortune! How can this end well?
The existential struggle between Uncle Bob and Frameworks continues. Indeed, he gets himself into a bit of a pickle in the middle of the episode as he struggles against the forces arranged against him. But in the end, he realizes his enemy, and determines to face it down. The enemy is...the UUID!
Wow! One API done. OK, but there are issues with globals, and issues with the framework, and issues with....
Wait! It's 4:30AM and Uncle Bob has had a revelation! A revelation about the tests!
Sandro has a secret: he knows something that I don't. He's waiting to spring the trap on me yet again.
But, other than that, things are moving along with a semblance of clockworks. The development steps are becoming rote. The design and architecture are becoming apparent. Three APIs done and the sausage machine is starting to crank.
Back and forth and back and forth and around and around. Or at least that's the way it seems. And in all that retracing of steps Uncle Bob forgets a critical behavior. And all the while Sandro smiles.
At this point the problems have become a bit mundane. Sorting date times, etc. The crank continues to turn, and the clockwork production of use cases proceeds. But then, Sandro points out an issue—a debugging issue.
This episode is just more crank turning. All the major decisions have been made. All the initial problems have been solved. The momentum is high, and the failure rate is low.
And besides, Sandro has to go to a Bull's game tonite, so nobody's working late.
Two more tomatoes of crank turning. And the application is done.
We have built Twitter—twice.
Where are our billions?
So, this is the episode you've been waiting for. This is where Sandro and Uncle Bob square off and debate each other's approaches. The issues are on the board. The gloves are off. The Ultimate Design Championship is on the line!