SlideShare a Scribd company logo
1 of 27
@kfirondev
TDD For Mortals
@kfirondev
@kfirondev
The essence of TDD
Use case: The throttler
It is not enough
Use case of server + testing strategy
Hexagonal Architecture
Agenda
@kfirondev
The essence of TDD
01
@kfirondev@kfirondev
THE ESSENCE
OF TDD
REFACTOR
MAKE THE
TEST PASS
WRITE A
FAILING TEST
@kfirondev
Use case – the throttler
02
@kfirondev@kfirondev
Get - prize Get - prize
OK OK
Get - prize Get - prize
Already wonAlready played
Get - prize
Get - prize
Get - prize
Get - prize
Get - prize
Get - prize
Get - prize
Get - prize
Get - prize
Get - prize
Already won
Already won
Already won
Already won
Already won
Already won
Already won
Already won
Already won
Already won
USER QUIZ PRIZE
SERVER
DATABASE
@kfirondev@kfirondev
Get - prize Get - prize
OK OK
Get - prize
Already played
Get - prize
Get - prize
Get - prize
Get - prize
Get - prize
Already won
Already won
Already won
Already won
Already won
USER QUIZ PRIZE
SERVER
DATABASE
FAIL FAST PATTERN
T
H
R
O
T
T
L
E
R
ROLLING WINDOW KEY (user-id) THROTTLER
@kfirondev
Live coding – the throttler
03
@kfirondev
LET’S
CODE
• https://github.com/kfiron/tdd-workshop-
template
• https://github.com/kfiron/java-one-demo-
app
@kfirondev
It is not enough
04
@kfirondev
TDD is a journey, it is not just
red-green-refactor
@kfirondev
Some of your tests are likely to
be flaky – I/O hell
@kfirondev
Bad design of tests will get you
breaking the whole project in
every refactor
@kfirondev
Refactoring – extracting another
class from current class must
not come with another test! it is
refactor
@kfirondev
Yes, the tests description are
part of the code, but they are
not compile – It might be stale
@kfirondev
To random or not to random?
@kfirondev
Each test must test only one
thing
@kfirondev
Matchers hell! Do we need
complex matchers?
@kfirondev
Mocks, Stubs, Fakes
@kfirondev
TDD is test driven development
or design?
It is the developer to make
proper abstractions!
@kfirondev
Port and adapters
(Hexagonal architecture)
05
@kfirondev
Ports and adapters
architecture
http://blog.mattwynne.net/2012/05/31/hexagonal-rails-objects-values-and-hexagons/comment-
page-1/
@kfirondev
Functional programming Is a
good way to get there
@kfirondev
Hexagonal Architecture with FP
gives result which is:
Deterministic Separation of concerns Fast testing lifecycle Concurrent agnostic
domain model
@kfirondev
Use case server design with
tests
06
@kfirondev
Let’s do some white boarding
@kfirondev
This is where you are going to present your final words.
This slide is not meant to have a lot of text.Thank You!
Any Questions?
Kfir Bloch

More Related Content

What's hot

HOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearB
HOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearBHOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearB
HOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearB
DevOpsDays Tel Aviv
 

What's hot (20)

A Second Look at Unit Testing by Roy Osherove
A Second Look at Unit Testing by Roy OsheroveA Second Look at Unit Testing by Roy Osherove
A Second Look at Unit Testing by Roy Osherove
 
Into the domain
Into the domainInto the domain
Into the domain
 
Taking Control of your Data with GraphQL
Taking Control of your Data with GraphQLTaking Control of your Data with GraphQL
Taking Control of your Data with GraphQL
 
What We Learned Building an R-Python Hybrid Predictive Analytics Pipeline
What We Learned Building an R-Python Hybrid Predictive Analytics PipelineWhat We Learned Building an R-Python Hybrid Predictive Analytics Pipeline
What We Learned Building an R-Python Hybrid Predictive Analytics Pipeline
 
ATAGTR2017 Machine Learning telepathy for Shift Right approach of testing
ATAGTR2017 Machine Learning telepathy for Shift Right approach of testingATAGTR2017 Machine Learning telepathy for Shift Right approach of testing
ATAGTR2017 Machine Learning telepathy for Shift Right approach of testing
 
Building A Distributed Build System at Google Scale (StrangeLoop 2016)
Building A Distributed Build System at Google Scale (StrangeLoop 2016)Building A Distributed Build System at Google Scale (StrangeLoop 2016)
Building A Distributed Build System at Google Scale (StrangeLoop 2016)
 
The dev ops code has no servers
The dev ops code has no serversThe dev ops code has no servers
The dev ops code has no servers
 
Testing Alfresco extensions
Testing Alfresco extensionsTesting Alfresco extensions
Testing Alfresco extensions
 
Data Science Challenges in Personal Program Analysis
Data Science Challenges in Personal Program AnalysisData Science Challenges in Personal Program Analysis
Data Science Challenges in Personal Program Analysis
 
GraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend DevsGraphQL: The Missing Link Between Frontend and Backend Devs
GraphQL: The Missing Link Between Frontend and Backend Devs
 
Amsterdam JUG - Continuous performance
Amsterdam JUG - Continuous performanceAmsterdam JUG - Continuous performance
Amsterdam JUG - Continuous performance
 
Codemotion tech pills - Continuous performance
Codemotion tech pills  - Continuous performanceCodemotion tech pills  - Continuous performance
Codemotion tech pills - Continuous performance
 
Into to GraphQL
Into to GraphQLInto to GraphQL
Into to GraphQL
 
HOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearB
HOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearBHOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearB
HOW TO OPTIMIZE NON-CODING TIME, ORI KEREN, LinearB
 
Scaling Analysis Responsibly
Scaling Analysis ResponsiblyScaling Analysis Responsibly
Scaling Analysis Responsibly
 
Using cyclomatic complexity to measure code complexity
Using cyclomatic complexity to measure code complexityUsing cyclomatic complexity to measure code complexity
Using cyclomatic complexity to measure code complexity
 
20170807 - How to Fail Your TDD Rollout - A Train Wreck Story
20170807 - How to Fail Your TDD Rollout - A Train Wreck Story20170807 - How to Fail Your TDD Rollout - A Train Wreck Story
20170807 - How to Fail Your TDD Rollout - A Train Wreck Story
 
Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)Graphql Intro (Tutorial and Example)
Graphql Intro (Tutorial and Example)
 
Introduction to lambda behave
Introduction to lambda behaveIntroduction to lambda behave
Introduction to lambda behave
 
5 levels of api test automation
5 levels of api test automation5 levels of api test automation
5 levels of api test automation
 

Viewers also liked

Viewers also liked (14)

10 Things You Didn’t Know About Mobile Email from Litmus & HubSpot
 10 Things You Didn’t Know About Mobile Email from Litmus & HubSpot 10 Things You Didn’t Know About Mobile Email from Litmus & HubSpot
10 Things You Didn’t Know About Mobile Email from Litmus & HubSpot
 
Modern Prospecting Techniques for Connecting with Prospects (from Sales Hacke...
Modern Prospecting Techniques for Connecting with Prospects (from Sales Hacke...Modern Prospecting Techniques for Connecting with Prospects (from Sales Hacke...
Modern Prospecting Techniques for Connecting with Prospects (from Sales Hacke...
 
Why People Block Ads (And What It Means for Marketers and Advertisers) [New R...
Why People Block Ads (And What It Means for Marketers and Advertisers) [New R...Why People Block Ads (And What It Means for Marketers and Advertisers) [New R...
Why People Block Ads (And What It Means for Marketers and Advertisers) [New R...
 
All About Factors & Smart Beta
All About Factors & Smart BetaAll About Factors & Smart Beta
All About Factors & Smart Beta
 
25 Discovery Call Questions
25 Discovery Call Questions25 Discovery Call Questions
25 Discovery Call Questions
 
Behind the Scenes: Launching HubSpot Tokyo
Behind the Scenes: Launching HubSpot TokyoBehind the Scenes: Launching HubSpot Tokyo
Behind the Scenes: Launching HubSpot Tokyo
 
What is Inbound Recruiting?
What is Inbound Recruiting?What is Inbound Recruiting?
What is Inbound Recruiting?
 
3 Proven Sales Email Templates Used by Successful Companies
3 Proven Sales Email Templates Used by Successful Companies3 Proven Sales Email Templates Used by Successful Companies
3 Proven Sales Email Templates Used by Successful Companies
 
Add the Women Back: Wikipedia Edit-a-Thon
Add the Women Back: Wikipedia Edit-a-ThonAdd the Women Back: Wikipedia Edit-a-Thon
Add the Women Back: Wikipedia Edit-a-Thon
 
Agri Production Declines
Agri Production DeclinesAgri Production Declines
Agri Production Declines
 
Flying jewels
Flying jewelsFlying jewels
Flying jewels
 
Economic and housing indicators 2017
Economic and housing indicators 2017Economic and housing indicators 2017
Economic and housing indicators 2017
 
San diego
San diegoSan diego
San diego
 
The symptoms of succesful agile enterprise
The symptoms of succesful agile enterpriseThe symptoms of succesful agile enterprise
The symptoms of succesful agile enterprise
 

Similar to TDD For Mortals

Similar to TDD For Mortals (20)

TDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDDTDD CrashCourse Part2: TDD
TDD CrashCourse Part2: TDD
 
From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017From Mess To Masterpiece - JFokus 2017
From Mess To Masterpiece - JFokus 2017
 
Lead Developer: A Day in the Life
Lead Developer: A Day in the LifeLead Developer: A Day in the Life
Lead Developer: A Day in the Life
 
TDD and Getting Paid
TDD and Getting PaidTDD and Getting Paid
TDD and Getting Paid
 
TDD - Unit testing done right and programmer happiness
TDD - Unit testing done right and programmer happinessTDD - Unit testing done right and programmer happiness
TDD - Unit testing done right and programmer happiness
 
Стероиды для Дотнетчика
Стероиды для ДотнетчикаСтероиды для Дотнетчика
Стероиды для Дотнетчика
 
Continuous Deployment of Architectural Change
Continuous Deployment of Architectural ChangeContinuous Deployment of Architectural Change
Continuous Deployment of Architectural Change
 
Continuous integration testing 2019 08
Continuous integration testing 2019 08Continuous integration testing 2019 08
Continuous integration testing 2019 08
 
Testing without assertions - #HUSTEF2019
Testing without assertions - #HUSTEF2019Testing without assertions - #HUSTEF2019
Testing without assertions - #HUSTEF2019
 
rnd teams.pptx
rnd teams.pptxrnd teams.pptx
rnd teams.pptx
 
Agile vs Iterative vs Waterfall models
Agile vs Iterative vs Waterfall models Agile vs Iterative vs Waterfall models
Agile vs Iterative vs Waterfall models
 
Agile vs iterative vs waterfall
Agile vs iterative vs waterfallAgile vs iterative vs waterfall
Agile vs iterative vs waterfall
 
David Hedleys Tuesday Tech Talk Bad Design
David Hedleys Tuesday Tech Talk Bad DesignDavid Hedleys Tuesday Tech Talk Bad Design
David Hedleys Tuesday Tech Talk Bad Design
 
REST API vs gRPC, which one should you use in breaking a monolith [Dev conf 2...
REST API vs gRPC, which one should you use in breaking a monolith [Dev conf 2...REST API vs gRPC, which one should you use in breaking a monolith [Dev conf 2...
REST API vs gRPC, which one should you use in breaking a monolith [Dev conf 2...
 
AOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java PlatformAOTB2014: Agile Testing on the Java Platform
AOTB2014: Agile Testing on the Java Platform
 
Skip Staging! Test Docker, Helm, and Kubernetes Apps like a Pro
Skip Staging! Test Docker, Helm, and Kubernetes Apps like a ProSkip Staging! Test Docker, Helm, and Kubernetes Apps like a Pro
Skip Staging! Test Docker, Helm, and Kubernetes Apps like a Pro
 
From naive to agile - software engineering approach
From naive to agile - software engineering approachFrom naive to agile - software engineering approach
From naive to agile - software engineering approach
 
Testing smells
Testing smellsTesting smells
Testing smells
 
Сергей Калинец "Стероиды для Дотнетчика"
Сергей Калинец "Стероиды для Дотнетчика"Сергей Калинец "Стероиды для Дотнетчика"
Сергей Калинец "Стероиды для Дотнетчика"
 
Gradle Show and Tell
Gradle Show and TellGradle Show and Tell
Gradle Show and Tell
 

More from Kfir Bloch

More from Kfir Bloch (6)

Increasing velocity via serless semantics
Increasing velocity via serless semanticsIncreasing velocity via serless semantics
Increasing velocity via serless semantics
 
The secrets of building a team that can do everything
The secrets of building a team that can do everythingThe secrets of building a team that can do everything
The secrets of building a team that can do everything
 
A sweet taste of clean code and software design
A sweet taste of clean code and software designA sweet taste of clean code and software design
A sweet taste of clean code and software design
 
Rest is bad
Rest is badRest is bad
Rest is bad
 
Design pattern-refactor-functional
Design pattern-refactor-functionalDesign pattern-refactor-functional
Design pattern-refactor-functional
 
The art of decomposing monoliths
The art of decomposing monolithsThe art of decomposing monoliths
The art of decomposing monoliths
 

Recently uploaded

Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
masabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 

Recently uploaded (20)

Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 

TDD For Mortals

Editor's Notes

  1. Already won
  2. It not about correctness , it is about resources