How John started to like TDD (instead of hating it) - Talent Arena (March '25)
icougil
90 views
44 slides
Mar 03, 2025
Slide 1 of 44
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
About This Presentation
John, a typical developer, used to dread writing tests, finding them boring and unnecessary. Test Driven Development (TDD)? Even worse—he couldn’t see how it worked outside of basic exercises. But something clicked. Through his journey, John discovered the magic of writing tests before the produ...
John, a typical developer, used to dread writing tests, finding them boring and unnecessary. Test Driven Development (TDD)? Even worse—he couldn’t see how it worked outside of basic exercises. But something clicked. Through his journey, John discovered the magic of writing tests before the production code: fewer bugs, quicker feedback, and cleaner code. Now, he’s hooked and won’t code any other way. This is the story of how TDD turned a skeptic into a believer. 😅
PS: Think of John as a random person, as if he was even the speaker of this talk 😉!
How John started to like TDD (instead of hating it) March, 2025
2
3
4
5
6 And at some point … 6
Lack of testing 7
Long-lived branches 8
Make others wait (until your work is done) The task XXX is not finished “Is because <write here your excuse argument>” “We were waiting to do Y… based on what you have to finish with Z” “Our feature was based on your implementation around X” 9
New requests came in 10 Sometimes were… Interesting Incompatible Incomprehensible Not mature enough … Too late
Many things to take into account 14 Remember that… “When you have to do X … you must have a record in the Database with Y” “Activate this flag in Z before running A” “Remember to write into Kafka B after doing C” “For testing D we need a license for E” “F is incompatible with the version G” …
15 Limited time
16 Building tests was boring
At the end… many reasons 17 Lack of testing Long-lived branches Make others wait New requests came in Adapt to changes Complexity Invalid documentation Many things to take into account Limited time Building tests was boring
18
19
20
21 Same problems again !?
22
Questions came to his mind 23 “There are surely practices to improve” “There must be practices that should help minimizing the risks” To share/deliver things faster and with small chunks To not having to keep many things in our mind To adapt to changes easily Have a better documentation Enjoy writing tests
Learn from others 24 Started attending meetups… Someone mentioned many practices and concepts that he didn’t kn o w or he couldn’t practice Feedback-loop Simple design Small releases Pair-programming Refactoring Test D r iven Development (TDD)
Started to grew 25 Listening more Reading more books Practicing P ersonal projects Katas Writing less “ smart ” code more “easy to read” code, easy to test code
Tried to applied at work… 26 Katas VS real projects Deadlines & commitments Initial time investment Learning curve Maintenance challenges Legacy projects Code does not do what you expect Lack of documentation Non-testable designed solution Different ways of developing Complexity
Tried to applied at work… 27 Couldn’t make it … ended up causing frustration
Until one day… 28
29
30 1 2 3 Specify what you would like to implement Develop what the tests describes. No more no less TDD Anything we can leave better? Red Green Refactor
31 But, generalizing… INPUT PROCESS OUTPUT
32 But, generalizing…
33 But, generalizing… INPUT PROCESS OUTPUT
34 John started to use TDD it, and he found …
Immediate / fast feedback loop 35 We’d like to react super fast 🏃 to changes! If we have a problem, it is better to identify it as soon as we can We can trigger/activate ▶️ things (as our clients will do) !
36 No unnecessary code Our tests serves as a guide/reference As we specify what we want to build… Less things are implemented because “ what if” We will build only what we specify Ensure that every step we take is in the right direction ✅ (no step is done without knowing it is mandatory)
Find defects earlier 37 We can run tests ↩️ We can recognize faster that something is not working as expected Tests help as a “tool” to not make mistakes ( safety net ) We will identify corner cases while designing our tests and building code
Easier to change the code 38 We will be building/adapting/growing our safety net constantly Our code will be easier to refactor Will give us more confidence !
Easy process 39 Allows you not having to remember many things in the head No big design up-front We want to build <this_use_case> D esign a test for <this_use_case> Solve the test Implement <this_use_case> { Refactor }
40
41
Who am I? Nacho Cougil Principal Software Engineer at Dynatrace TDD & clean code fan Started to write in Java before Y2K Founder of the Barcelona Java Users Group ( BarcelonaJUG ) & co-founder of the Barcelona Developers Conference ( DevBcn ) former Java and JVM Barcelona Conference Java Champion Father, former mountain marathon runner 😅
Questions? 43 [email protected] https://nacho.cougil.com icougil.bsky.social @ icougil https://jvm.social/@icougil This presentation Feedback form