Skip to content

Commit efdaa99

Browse files
committed
Review chapter 27
1 parent 6fc6c1b commit efdaa99

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

chapter_27_hot_lava.asciidoc

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ and the end of our journey with this To-Do app and its tests.
1111
Let's recap our test structure so far:
1212

1313
* We have a suite of "functional tests" that use Selenium to test that the whole app really works.
14-
On several occations, the FTs have saved us from shipping broken code,
14+
On several occasions, the FTs have saved us from shipping broken code,
1515
whether it was broken CSS, a broken database due to filesystem permissions, or broken email integration.
1616

1717
* And we have a suit of "unit tests" that use Django's test client,
@@ -175,6 +175,9 @@ The problem is that these things don't scale linearly.
175175
The more database tables you have,
176176
the more relationships between them,
177177
and that starts to increase geometrically.
178+
// SEBASTIAN: That holds true as long as relationships number grows with database tables.
179+
// I would add here or in the section about architecture that keeping project decoupled by having autonomous modules
180+
// will replace geometrical penalty increase with linear one.
178181

179182
So you can see why, over time, these kinds of tests
180183
are going to fail to meet our desiderata because they're too slow
@@ -313,6 +316,8 @@ Often people use it to mean the same thing as functional tests or end-to-end tes
313316
But as taught to me by one of the legends of QA at MADE (hi Marta!),
314317
_any_ kind of test can be an acceptance test,
315318
if it maps onto one of your acceptance criteria.
319+
// SEBASTIAN: Great point! I think of acceptance tests as part of second, parallel classification of tests.
320+
// Unit tests, for example, are about scope of SUT. Acceptance tests are about purpose of testing.
316321
317322
The point of an acceptance test is to validate a piece of behaviour
318323
that's important to the user.
@@ -347,6 +352,10 @@ the use of mocks comes with painful trade-offs.
347352
* And in the extreme, you can sometimes end up with mocks testing mocks,
348353
almost entirely disconnected from what the code actually does.
349354

355+
// SEBASTIAN: Tight coupling to implementation details is debatable. That happens if one mocks whatever they feel like.
356+
// If one mocks 'stable interfaces', e.g. Gateways or Service layer of another 'unit'/'module' then it's not coupling to implementation details
357+
// Perhaps there is some middle-ground here, like Mocks lead us astray to mock whatever stands in our way and skipping this part of building solid abstractions?
358+
350359
Ed Jung calls this https://youtu.be/CdKaZ7boiZ4[Mock Hell].
351360

352361
This isn't to say that mocks are always bad!
@@ -407,7 +416,7 @@ because "Cosmos" is the opposite of "Chaos", in Greek.
407416
*******************************************************************************
408417

409418

410-
==== Ports and Adapters/Hexagonal/Onion/Clean Architecture
419+
==== Ports and Adapters/Hexagonal/Onion/the Clean Architecture
411420

412421
The classic solutions to this problem from the OO world
413422
come under different names, but they're all variations on the same trick:
@@ -424,7 +433,9 @@ image::images/twp2_2601.png["Illustration of ports and adapaters architecture, w
424433

425434
This pattern, or variations on it, are known as
426435
"Hexagonal Architecture" (by Alistair Cockburn),
427-
"Clean Architecture" (by Robert C. Martin, aka Uncle Bob),
436+
"the Clean Architecture" (by Robert C. Martin, aka Uncle Bob),
437+
// SEBASTIAN: it's "THE Clean Architecture", not just "Clean Architecture".
438+
// https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html
428439
or "Onion Architecture" (by Jeffrey Palermo).
429440

430441

@@ -486,8 +497,11 @@ that it can provide them most of the feedback they need about whether the system
486497
487498
Not everywhere is Facebook! But it's a good indication that automated tests
488499
aren't the be-all and end-all.
500+
// SEBASTIAN: This could use a mention of "shift-right" and perhaps a link or two in further reading to discover this fascinating world of testing in prod
489501
*******************************************************************************
490502

503+
// SEBASTIAN: In this section, I very much miss any mention about internal project's modularity, such as can be achieved by using 'vertical slices'.
504+
// Shameless plug: in my book, I devoted a whole chapter to it. From maintainability perspective, it's much more rewarding in the long term than horizontal slicing or decoupling from IO/external world as achieved with P&A/the Clean architecture etc.
491505

492506
=== The Hardest Part: Knowing When to Make the Switch
493507

0 commit comments

Comments
 (0)