Skip to content

Commit 45ebe54

Browse files
committed
Comments on Chapter 27
1 parent 6fc6c1b commit 45ebe54

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

chapter_27_hot_lava.asciidoc

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Let's recap our test structure so far:
1919
They've enabled us to build the app incrementally, to refactor with confidence,
2020
and they've supported a fast unit-test/code cycle.
2121

22+
// DAVID: For me it reads weirdly to put functional tests and unit tests in speech marks, at this point of the book.
23+
2224
We've also spent a good bit of time on our infrastructure,
2325
packaging up our app with Docker for ease of deployment,
2426
and we've set up a CI pipeline to run our tests automatically on push.
@@ -43,13 +45,13 @@ outline several desiderata (desirable characteristics) for tests:
4345
| *Deterministic*: if nothing changes, the test result shouldn’t change.
4446
| *Fast*: tests should run quickly.
4547
| *Writable*: tests should be cheap to write relative to the cost of the code being tested.
46-
| *Readable*: tests should be comprehensible for reader, invoking the motivation for writing this particular test.
48+
| *Readable*: tests should be comprehensible for readers, invoking the motivation for writing this particular test.
4749
| *Behavioural*: tests should be sensitive to changes in the behaviour of the code under test. If the behaviour changes, the test result should change.
4850
| *Structure-agnostic*: tests should not change their result if the structure of the code changes.
4951
| *Automated*: tests should run without human intervention.
5052
| *Specific*: if a test fails, the cause of the failure should be obvious.
5153
| *Predictive*: if the tests all pass, then the code under test should be suitable for production.
52-
| *Inspiring*: passing the tests should inspire confidence
54+
| *Inspiring*: passing the tests should inspire confidence.
5355
|===
5456

5557
We've talked about almost all of these desiderata in the book:
@@ -143,13 +145,19 @@ and your database "should" be outside of that.
143145
Why do they say that?
144146
Apart from the smug from should-ing us?
145147

148+
// DAVID I don't understand that last sentence, is there a typo?
149+
146150
As you can tell,
147151
I think the argument from _definitions_ is a bit of a red herring.
148152
But you might hear instead, "the database is hot lava!"
149153
as Casey Kinsey put it in a memorable DjangoCon talk.
150154
There is real feeling and real experience behind these comments.
151155
What are people getting at?
152156

157+
// DAVID: "I think the argument from _definitions_ is a bit of a red herring." - I found this sentence difficult
158+
// to understand.
159+
// DAVID: Is it worth a sentence at this point explaining the hot lava connotations? Not
160+
// having seen the talk, I don't exactly get the analogy -- is hot lava dangerous? Fast? Unpredictable?
153161

154162
==== Integration and Functional Tests Get Slower Over Time
155163

@@ -171,6 +179,9 @@ and associated expenditure on CI.
171179
We're now spending a lot of effort on trying to move more of our unit
172180
tests to being "true" unit tests.
173181

182+
// DAVID: More like 12 minutes now!
183+
// DAVID: Will people know which Kraken you're talking about? Worth a footnote?
184+
174185
The problem is that these things don't scale linearly.
175186
The more database tables you have,
176187
the more relationships between them,
@@ -208,6 +219,7 @@ if you spend your time waiting for a slow test suite to run.
208219
Anything longer than a few seconds and you're going to let your attention wander,
209220
you context-switch, and the flow state is gone.
210221
And the flow state is a fragile dream.
222+
// DAVID: saying it's a dream implies it's not possible. Maybe just 'And the flow state is fragile.'?
211223
Once it's gone, it takes a long time to come back.footnote:[
212224
Some people says it takes at least 15 minutes to get back into the flow state.
213225
In my experience, that's overblown,
@@ -247,6 +259,8 @@ that will still sound like a bit of a mystery.
247259
So, how can we get to a position where our tests are giving us maximum feedback
248260
on our design?
249261

262+
// DAVID: It might be worth engaging with the counterargument in the Test Driven Development section in John Ousterhout's
263+
// A Philosophy of Software Design, in which he argues that TDD impairs design?
250264

251265

252266
=== The Ideal of the Test Pyramid
@@ -422,6 +436,9 @@ call this approach "Ports and Adapters" (see <<ports-and-adapters>>).
422436
.Ports and Adapters (diagram by Nat Pryce)
423437
image::images/twp2_2601.png["Illustration of ports and adapaters architecture, with isolated core and integration points"]
424438

439+
// DAVID: I don't think this diagram is self-explanatory. Nice to break text up with a picture, but
440+
// maybe this particular one doesn't add much.
441+
425442
This pattern, or variations on it, are known as
426443
"Hexagonal Architecture" (by Alistair Cockburn),
427444
"Clean Architecture" (by Robert C. Martin, aka Uncle Bob),
@@ -569,6 +586,8 @@ Inverting the Pyramid::
569586
for what to do with a project like ours would end up,
570587
with too many slow tests and not enough fast ones.
571588

589+
// DAVID: Grammar seems off here.
590+
572591
Integration tests are a scam::
573592
J.B. Rainsberger has a
574593
http://blog.thecodewhisperer.com/2010/10/16/integrated-tests-are-a-scam/[famous rant]
@@ -583,6 +602,8 @@ Integration tests are a scam::
583602
analysis of how slow tests kill productivity].
584603
((("integrated tests", "benefits and drawbacks of")))
585604

605+
// DAVID: That footnote isn't rendering correctly.
606+
586607
Ports and Adapters::
587608
Steve Freeman and Nat Pryce wrote about this in <<GOOSGBT, their book>>.
588609
You can also catch a good discussion in

0 commit comments

Comments
 (0)