marijnz0r
Joined 7 years ago
Karma
19
Submissions
24
Member since
Nov 14
Joined 7 years ago
https://www.goodreads.com/book/show/34890015-factfulness
I can highly recommend it.
function test_addition() {
given_two_integers(2,3);
when_summed_up();
then_the_result_should_be(5);
}
Whereas I would prefer something like function test_addition() {
int a = 2;
int b = 3;
int result = new Addition(a, b);
Assert.AreEqual(result.Sum(), 5);
}
For a non-coder it might seem more intuitive to read the first example, because it only contains natural language.
For a coder it seems more intuitive to read the second example, because it prevents "method hopping" (I have to go into the methods from example one to see what's actually happening inside them).