SlideShare a Scribd company logo
Mockist vs. Classicist TDD 
Softwerkskammer Regionalgruppentreffen München 
30.10.2014 
David Völkel
Agenda 
●Theory 
●Pizza 
●Kata
Classicists vs. Mockists 
●Who knows?
Classicists vs. Mockists 
●Who knows? 
●Who leverages what?
Mockists?
Classicists?
How i stumbled upon… 
●#GOOS 
●#IsTDDDead 
●Outside-In  
●Mocking  
●=> How work Classicist?
Classicists 
●„old school“: Kent Beck, Uncle Bob, … 
●state verification 
●bottom-up/inside-out 
●Avoid mocks when possible
Mockists 
●„London School“: Steve Freeman, Nat Pryce 
●XP 2000 „Endo-Testing: Unit Testing with Mock Objects “ 
●OOPSLA 2004 „Mock Roles, not Objects“ 
●Book „Growing Object Oriented Software“ #GOOS 2009
Mockists 
●ATDD 
●Outside-In Design 
●Hexagonal / Ports&Adapters Architecture 
●also for classicists 
●Mocking to isolate layers 
●Interaction based testing 
●„Back-door“
Architecture 
●Mockist OO-style 
●Message Passing/Event-Architecture 
●Topology / Message flow 
●„Tell don‘t ask“ 
●Classicist FP-style 
●mutable objects encapsulating state 
●pure functions & immutable value objects 
●details: algorithms, logic, conditionals
Layer 
UI 
Domain 
Data Access 
DB
Domain 
Hexagonal / Ports & Adapters 
UI 
Domain Service 
Repository DB Adapter 
DB 
Repository Interface
Hexagonal / Ports & Adapters 
Domain Service 
Repository DB Mock 
DB 
Repository Interface 
Unit Test
ATDD 
From Growing Object-Oriented Software by Nat Pryce and Steve Freeman
Outside-In Design 
UI 
Domain Service 
Repository DB Adapter 
DB 
End2End Test
Outside-In Design 
UI 
Domain Service 
Repository DB Adapter 
DB 
Domain Service Interface 
Unit Test 
End2End Test
Outside-In Design 
UI 
Domain Service 
Repository DB Adapter 
DB 
Repository Interface 
Domain Service Interface 
Unit Test 
Unit Test 
End2End Test
Outside-In Design 
UI 
Domain Service 
Repository DB Adapter 
DB 
Repository Interface 
Domain Service Interface 
Unit Test 
Unit Test 
Integration 
Test 
End2End Test
Classicists Design 
●Bottom-up 
●emergent 
●„TDD as if you meant it“ (YAGNI?) 
●Middle ground? 
●Acceptance tests => Domain
Classicist IO 
out = pureFunction(in); 
object.changeStateBasedOn(in); 
out = object.getState(); 
●Functional 
●State-based
Mockist IO: CQS 
public Object myQuery() { 
return neighbour.query(); 
} 
when(neighbour.query()).thenReturn(in); 
●Queries: Stubbing indirect input
Mockist IO: CQS 
public Object myQuery() { 
return neighbour.query(); 
} 
when(neighbour.query()).thenReturn(in); 
private void myCommand() { 
neighbour.command(out); 
} 
verify(neighbour).command(out); 
●Queries: Stubbing indirect input 
●Commands: Spies check indirect output
Let‘s code! 
●Content: Kata „Game of Life“ 
●Phase 1: Outside-In Mockist style 
●Mockless Classicist design 
●Phase 2: refactor to mockless Classicist design 
●Mode: Mob Programming 
●1 Driver 
●N Navigators 
●Variant: David = PO & facilitator
Outside-In Mockist style
Classicist Isolation 
●No isolation = „front door“ 
●Leaf 
●Integrated test 
●By design 
●Context independence: parameterize methods/constructors, values/value objects, intermediary results 
●„Functional Core, Imperative Shell“
String renderMail(String mail) { 
String name = userRepo.nameFor(mail); 
return renderMailAndName(mail, name); 
} 
@Test public void renderMail() { 
when(userRepo.nameFor("customer@gmail.com")) 
.thenReturn("Joe Customer"); 
assertEquals("customer@gmail.com <Joe Customer>", 
mailService.renderMail("customer@gmail.com")); 
} 
Isolation via mocks
String renderMail(String mail) { 
String name = userRepo.nameFor(mail); 
return renderMailAndName(mail, name); 
} 
@Test public void renderMail() { 
when(userRepo.nameFor("customer@gmail.com")) 
.thenReturn("Joe Customer"); 
assertEquals("customer@gmail.com <Joe Customer>", 
mailService.renderMail("customer@gmail.com")); 
} 
@Test public void renderMail() { 
assertEquals("customer@gmail.com <Joe Customer>", 
mailService.renderMailAndName("customer@gmail.com", "Joe Customer")); 
} 
Mockless isolation
Refactor mocks away
Retrospective
Bilder 
von RaminusFalcon 
http://commons.wikimedia.org/wiki/File:Split- scissors.svg?uselang=de
Lizenz 
Creative Commons Attribution-ShareAlike 3.0 
https://creativecommons.org/licenses/by-sa/3.0/de/
TDD as if you meant it 
1.Write exactly one failing test 
2.Make the test pass by writing implementation code in the test method 
3.When duplication is spotted extract the implementation from tests to: 
1. a new method in the test class 
2.an existing method in the test class 
4.When more methods belong together extract them into a new class 
5.Refactor as required 
by Adi Bolboaca

More Related Content

Viewers also liked

Clean Test Code
Clean Test CodeClean Test Code
Clean Test Code
David Völkel
 
Wie wird mein Code testbar?
Wie wird mein Code testbar?Wie wird mein Code testbar?
Wie wird mein Code testbar?
David Völkel
 
Baby Steps TDD Approaches
Baby Steps TDD ApproachesBaby Steps TDD Approaches
Baby Steps TDD Approaches
David Völkel
 
Unit vs. Integration Tests
Unit vs. Integration TestsUnit vs. Integration Tests
Unit vs. Integration Tests
David Völkel
 
Mockist vs Classicists TDD
Mockist vs Classicists TDDMockist vs Classicists TDD
Mockist vs Classicists TDD
David Völkel
 
Integration Test Hell
Integration Test HellIntegration Test Hell
Integration Test HellDavid Völkel
 
Bad test, good test
Bad test, good testBad test, good test
Bad test, good test
Seb Rose
 

Viewers also liked (7)

Clean Test Code
Clean Test CodeClean Test Code
Clean Test Code
 
Wie wird mein Code testbar?
Wie wird mein Code testbar?Wie wird mein Code testbar?
Wie wird mein Code testbar?
 
Baby Steps TDD Approaches
Baby Steps TDD ApproachesBaby Steps TDD Approaches
Baby Steps TDD Approaches
 
Unit vs. Integration Tests
Unit vs. Integration TestsUnit vs. Integration Tests
Unit vs. Integration Tests
 
Mockist vs Classicists TDD
Mockist vs Classicists TDDMockist vs Classicists TDD
Mockist vs Classicists TDD
 
Integration Test Hell
Integration Test HellIntegration Test Hell
Integration Test Hell
 
Bad test, good test
Bad test, good testBad test, good test
Bad test, good test
 

Similar to Mockist vs. Classicists TDD

GDG Madrid - Dart Event - By Iván Zaera
GDG Madrid - Dart Event - By Iván ZaeraGDG Madrid - Dart Event - By Iván Zaera
GDG Madrid - Dart Event - By Iván Zaera
Jc Miñarro
 
少し幸せになる技術
少し幸せになる技術少し幸せになる技術
少し幸せになる技術
kamedon39
 
PyConUK2013 - Validated documents on MongoDB with Ming
PyConUK2013 - Validated documents on MongoDB with MingPyConUK2013 - Validated documents on MongoDB with Ming
PyConUK2013 - Validated documents on MongoDB with Ming
Alessandro Molina
 
Android testing
Android testingAndroid testing
Android testing
Sean Tsai
 
Test strategies for data processing pipelines, v2.0
Test strategies for data processing pipelines, v2.0Test strategies for data processing pipelines, v2.0
Test strategies for data processing pipelines, v2.0
Lars Albertsson
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
Ortus Solutions, Corp
 
JSLT: JSON querying and transformation
JSLT: JSON querying and transformationJSLT: JSON querying and transformation
JSLT: JSON querying and transformation
Lars Marius Garshol
 
DIとトレイとによるAndroid開発の効率化
DIとトレイとによるAndroid開発の効率化DIとトレイとによるAndroid開発の効率化
DIとトレイとによるAndroid開発の効率化Tomoharu ASAMI
 
Sharable of qualities of clean code
Sharable of qualities of clean codeSharable of qualities of clean code
Sharable of qualities of clean code
Eman Mohamed
 
Advance unittest
Advance unittestAdvance unittest
Advance unittestReza Arbabi
 
CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!
Ortus Solutions, Corp
 
Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++
corehard_by
 
Home Improvement: Architecture & Kotlin
Home Improvement: Architecture & KotlinHome Improvement: Architecture & Kotlin
Home Improvement: Architecture & Kotlin
Jorge Ortiz
 
Mobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve MobileMobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve Mobile
Konstantin Loginov
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
Ben Hall
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tips
OWASP Kyiv
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
Lars Thorup
 

Similar to Mockist vs. Classicists TDD (20)

GDG Madrid - Dart Event - By Iván Zaera
GDG Madrid - Dart Event - By Iván ZaeraGDG Madrid - Dart Event - By Iván Zaera
GDG Madrid - Dart Event - By Iván Zaera
 
少し幸せになる技術
少し幸せになる技術少し幸せになる技術
少し幸せになる技術
 
PyConUK2013 - Validated documents on MongoDB with Ming
PyConUK2013 - Validated documents on MongoDB with MingPyConUK2013 - Validated documents on MongoDB with Ming
PyConUK2013 - Validated documents on MongoDB with Ming
 
Android testing
Android testingAndroid testing
Android testing
 
Test strategies for data processing pipelines, v2.0
Test strategies for data processing pipelines, v2.0Test strategies for data processing pipelines, v2.0
Test strategies for data processing pipelines, v2.0
 
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
3 Ways to test your ColdFusion API - 2017 Adobe CF Summit
 
JSLT: JSON querying and transformation
JSLT: JSON querying and transformationJSLT: JSON querying and transformation
JSLT: JSON querying and transformation
 
DIとトレイとによるAndroid開発の効率化
DIとトレイとによるAndroid開発の効率化DIとトレイとによるAndroid開発の効率化
DIとトレイとによるAndroid開発の効率化
 
Sharable of qualities of clean code
Sharable of qualities of clean codeSharable of qualities of clean code
Sharable of qualities of clean code
 
Advance unittest
Advance unittestAdvance unittest
Advance unittest
 
CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!CBDW2014 - MockBox, get ready to mock your socks off!
CBDW2014 - MockBox, get ready to mock your socks off!
 
Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++Работа с реляционными базами данных в C++
Работа с реляционными базами данных в C++
 
Spock pres
Spock presSpock pres
Spock pres
 
Home Improvement: Architecture & Kotlin
Home Improvement: Architecture & KotlinHome Improvement: Architecture & Kotlin
Home Improvement: Architecture & Kotlin
 
Mobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve MobileMobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve Mobile
 
Testing ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NETTesting ASP.NET - Progressive.NET
Testing ASP.NET - Progressive.NET
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tips
 
Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)Test and Behaviour Driven Development (TDD/BDD)
Test and Behaviour Driven Development (TDD/BDD)
 
Linq
LinqLinq
Linq
 
Latinoware
LatinowareLatinoware
Latinoware
 

More from David Völkel

Die Kunst der kleinen Schritte - Softwerkskammer Lübeck
Die Kunst der kleinen Schritte - Softwerkskammer LübeckDie Kunst der kleinen Schritte - Softwerkskammer Lübeck
Die Kunst der kleinen Schritte - Softwerkskammer Lübeck
David Völkel
 
KPI Driven-Development in der Praxis - XP Days Germany
KPI Driven-Development in der Praxis - XP Days GermanyKPI Driven-Development in der Praxis - XP Days Germany
KPI Driven-Development in der Praxis - XP Days Germany
David Völkel
 
KPI-Driven-Development
KPI-Driven-DevelopmentKPI-Driven-Development
KPI-Driven-Development
David Völkel
 
TDD Trade-Offs @Softwerkskammer Karlsruhe
TDD Trade-Offs @Softwerkskammer KarlsruheTDD Trade-Offs @Softwerkskammer Karlsruhe
TDD Trade-Offs @Softwerkskammer Karlsruhe
David Völkel
 
Global Day of Coderetreat Munich 2018
Global Day of Coderetreat Munich 2018Global Day of Coderetreat Munich 2018
Global Day of Coderetreat Munich 2018
David Völkel
 
Trade Off!
Trade Off!Trade Off!
Trade Off!
David Völkel
 
Die Kunst der kleinen Schritte - XP Days Germany 2018
Die Kunst der kleinen Schritte - XP Days Germany 2018Die Kunst der kleinen Schritte - XP Days Germany 2018
Die Kunst der kleinen Schritte - XP Days Germany 2018
David Völkel
 
Global Day of Coderetreat Munich 2017
Global Day of Coderetreat Munich 2017Global Day of Coderetreat Munich 2017
Global Day of Coderetreat Munich 2017
David Völkel
 
Fake It Outside-In TDD Workshop @ Clean Code Days
Fake It Outside-In TDD Workshop @ Clean Code Days Fake It Outside-In TDD Workshop @ Clean Code Days
Fake It Outside-In TDD Workshop @ Clean Code Days
David Völkel
 
Fake It Outside-In TDD @XP2017
Fake It Outside-In TDD @XP2017Fake It Outside-In TDD @XP2017
Fake It Outside-In TDD @XP2017
David Völkel
 
Fake It Outside-In TDD
Fake It Outside-In TDDFake It Outside-In TDD
Fake It Outside-In TDD
David Völkel
 
Infrastructure as Code for Beginners
Infrastructure as Code for BeginnersInfrastructure as Code for Beginners
Infrastructure as Code for Beginners
David Völkel
 

More from David Völkel (12)

Die Kunst der kleinen Schritte - Softwerkskammer Lübeck
Die Kunst der kleinen Schritte - Softwerkskammer LübeckDie Kunst der kleinen Schritte - Softwerkskammer Lübeck
Die Kunst der kleinen Schritte - Softwerkskammer Lübeck
 
KPI Driven-Development in der Praxis - XP Days Germany
KPI Driven-Development in der Praxis - XP Days GermanyKPI Driven-Development in der Praxis - XP Days Germany
KPI Driven-Development in der Praxis - XP Days Germany
 
KPI-Driven-Development
KPI-Driven-DevelopmentKPI-Driven-Development
KPI-Driven-Development
 
TDD Trade-Offs @Softwerkskammer Karlsruhe
TDD Trade-Offs @Softwerkskammer KarlsruheTDD Trade-Offs @Softwerkskammer Karlsruhe
TDD Trade-Offs @Softwerkskammer Karlsruhe
 
Global Day of Coderetreat Munich 2018
Global Day of Coderetreat Munich 2018Global Day of Coderetreat Munich 2018
Global Day of Coderetreat Munich 2018
 
Trade Off!
Trade Off!Trade Off!
Trade Off!
 
Die Kunst der kleinen Schritte - XP Days Germany 2018
Die Kunst der kleinen Schritte - XP Days Germany 2018Die Kunst der kleinen Schritte - XP Days Germany 2018
Die Kunst der kleinen Schritte - XP Days Germany 2018
 
Global Day of Coderetreat Munich 2017
Global Day of Coderetreat Munich 2017Global Day of Coderetreat Munich 2017
Global Day of Coderetreat Munich 2017
 
Fake It Outside-In TDD Workshop @ Clean Code Days
Fake It Outside-In TDD Workshop @ Clean Code Days Fake It Outside-In TDD Workshop @ Clean Code Days
Fake It Outside-In TDD Workshop @ Clean Code Days
 
Fake It Outside-In TDD @XP2017
Fake It Outside-In TDD @XP2017Fake It Outside-In TDD @XP2017
Fake It Outside-In TDD @XP2017
 
Fake It Outside-In TDD
Fake It Outside-In TDDFake It Outside-In TDD
Fake It Outside-In TDD
 
Infrastructure as Code for Beginners
Infrastructure as Code for BeginnersInfrastructure as Code for Beginners
Infrastructure as Code for Beginners
 

Recently uploaded

Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 

Recently uploaded (20)

Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 

Mockist vs. Classicists TDD

  • 1. Mockist vs. Classicist TDD Softwerkskammer Regionalgruppentreffen München 30.10.2014 David Völkel
  • 3. Classicists vs. Mockists ●Who knows?
  • 4. Classicists vs. Mockists ●Who knows? ●Who leverages what?
  • 7. How i stumbled upon… ●#GOOS ●#IsTDDDead ●Outside-In  ●Mocking  ●=> How work Classicist?
  • 8. Classicists ●„old school“: Kent Beck, Uncle Bob, … ●state verification ●bottom-up/inside-out ●Avoid mocks when possible
  • 9. Mockists ●„London School“: Steve Freeman, Nat Pryce ●XP 2000 „Endo-Testing: Unit Testing with Mock Objects “ ●OOPSLA 2004 „Mock Roles, not Objects“ ●Book „Growing Object Oriented Software“ #GOOS 2009
  • 10. Mockists ●ATDD ●Outside-In Design ●Hexagonal / Ports&Adapters Architecture ●also for classicists ●Mocking to isolate layers ●Interaction based testing ●„Back-door“
  • 11. Architecture ●Mockist OO-style ●Message Passing/Event-Architecture ●Topology / Message flow ●„Tell don‘t ask“ ●Classicist FP-style ●mutable objects encapsulating state ●pure functions & immutable value objects ●details: algorithms, logic, conditionals
  • 12. Layer UI Domain Data Access DB
  • 13. Domain Hexagonal / Ports & Adapters UI Domain Service Repository DB Adapter DB Repository Interface
  • 14. Hexagonal / Ports & Adapters Domain Service Repository DB Mock DB Repository Interface Unit Test
  • 15. ATDD From Growing Object-Oriented Software by Nat Pryce and Steve Freeman
  • 16. Outside-In Design UI Domain Service Repository DB Adapter DB End2End Test
  • 17. Outside-In Design UI Domain Service Repository DB Adapter DB Domain Service Interface Unit Test End2End Test
  • 18. Outside-In Design UI Domain Service Repository DB Adapter DB Repository Interface Domain Service Interface Unit Test Unit Test End2End Test
  • 19. Outside-In Design UI Domain Service Repository DB Adapter DB Repository Interface Domain Service Interface Unit Test Unit Test Integration Test End2End Test
  • 20. Classicists Design ●Bottom-up ●emergent ●„TDD as if you meant it“ (YAGNI?) ●Middle ground? ●Acceptance tests => Domain
  • 21. Classicist IO out = pureFunction(in); object.changeStateBasedOn(in); out = object.getState(); ●Functional ●State-based
  • 22. Mockist IO: CQS public Object myQuery() { return neighbour.query(); } when(neighbour.query()).thenReturn(in); ●Queries: Stubbing indirect input
  • 23. Mockist IO: CQS public Object myQuery() { return neighbour.query(); } when(neighbour.query()).thenReturn(in); private void myCommand() { neighbour.command(out); } verify(neighbour).command(out); ●Queries: Stubbing indirect input ●Commands: Spies check indirect output
  • 24. Let‘s code! ●Content: Kata „Game of Life“ ●Phase 1: Outside-In Mockist style ●Mockless Classicist design ●Phase 2: refactor to mockless Classicist design ●Mode: Mob Programming ●1 Driver ●N Navigators ●Variant: David = PO & facilitator
  • 26. Classicist Isolation ●No isolation = „front door“ ●Leaf ●Integrated test ●By design ●Context independence: parameterize methods/constructors, values/value objects, intermediary results ●„Functional Core, Imperative Shell“
  • 27. String renderMail(String mail) { String name = userRepo.nameFor(mail); return renderMailAndName(mail, name); } @Test public void renderMail() { when(userRepo.nameFor("customer@gmail.com")) .thenReturn("Joe Customer"); assertEquals("customer@gmail.com <Joe Customer>", mailService.renderMail("customer@gmail.com")); } Isolation via mocks
  • 28. String renderMail(String mail) { String name = userRepo.nameFor(mail); return renderMailAndName(mail, name); } @Test public void renderMail() { when(userRepo.nameFor("customer@gmail.com")) .thenReturn("Joe Customer"); assertEquals("customer@gmail.com <Joe Customer>", mailService.renderMail("customer@gmail.com")); } @Test public void renderMail() { assertEquals("customer@gmail.com <Joe Customer>", mailService.renderMailAndName("customer@gmail.com", "Joe Customer")); } Mockless isolation
  • 31. Bilder von RaminusFalcon http://commons.wikimedia.org/wiki/File:Split- scissors.svg?uselang=de
  • 32. Lizenz Creative Commons Attribution-ShareAlike 3.0 https://creativecommons.org/licenses/by-sa/3.0/de/
  • 33. TDD as if you meant it 1.Write exactly one failing test 2.Make the test pass by writing implementation code in the test method 3.When duplication is spotted extract the implementation from tests to: 1. a new method in the test class 2.an existing method in the test class 4.When more methods belong together extract them into a new class 5.Refactor as required by Adi Bolboaca