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

PDF
Mockist vs. Classicists TDD
PDF
Unit Test and TDD
PPTX
Iterative architecture
PDF
Why and How to Use Virtual DOM
PDF
How Testability Inspires AngularJS Design / Ran Mizrahi
PDF
Clean Test Code (Clean Code Days)
PDF
Wann soll ich mocken?
PDF
Transformation Priority Premise @Softwerkskammer MUC
Mockist vs. Classicists TDD
Unit Test and TDD
Iterative architecture
Why and How to Use Virtual DOM
How Testability Inspires AngularJS Design / Ran Mizrahi
Clean Test Code (Clean Code Days)
Wann soll ich mocken?
Transformation Priority Premise @Softwerkskammer MUC

Viewers also liked (7)

PDF
Clean Test Code
PDF
Wie wird mein Code testbar?
PDF
Baby Steps TDD Approaches
PDF
Unit vs. Integration Tests
PDF
Mockist vs Classicists TDD
PDF
Integration Test Hell
PDF
Bad test, good test
Clean Test Code
Wie wird mein Code testbar?
Baby Steps TDD Approaches
Unit vs. Integration Tests
Mockist vs Classicists TDD
Integration Test Hell
Bad test, good test
Ad

Similar to Mockist vs. Classicists TDD (20)

ODP
Desenvolvendo um Framework com TDD - Um Diário de Bordo - Agile Trends 2014
PDF
Journey's diary developing a framework using tdd
PPTX
Tdd is not about testing (OOP)
KEY
Testing w-mocks
PPTX
Test Driven Development:Unit Testing, Dependency Injection, Mocking
PDF
An Introduction To Unit Testing and TDD
PPTX
Type mock isolator
PPTX
Mocking with Moq
PDF
Design for Testability
PPT
Solit 2012, TDD и отдельные аспекты тестирования в Java, Антонина Шафранская
PPTX
VT.NET 20160411: An Intro to Test Driven Development (TDD)
PPTX
Test Doubles
PPT
TDD In Practice
PPTX
Test driven development(tdd)
PPTX
Mock driven development using .NET
PPTX
Junit, mockito, etc
PDF
Test and Behaviour Driven Development (TDD/BDD)
PPTX
Tdd & unit test
PPTX
Type mock isolator
PPT
Xp Day 080506 Unit Tests And Mocks
Desenvolvendo um Framework com TDD - Um Diário de Bordo - Agile Trends 2014
Journey's diary developing a framework using tdd
Tdd is not about testing (OOP)
Testing w-mocks
Test Driven Development:Unit Testing, Dependency Injection, Mocking
An Introduction To Unit Testing and TDD
Type mock isolator
Mocking with Moq
Design for Testability
Solit 2012, TDD и отдельные аспекты тестирования в Java, Антонина Шафранская
VT.NET 20160411: An Intro to Test Driven Development (TDD)
Test Doubles
TDD In Practice
Test driven development(tdd)
Mock driven development using .NET
Junit, mockito, etc
Test and Behaviour Driven Development (TDD/BDD)
Tdd & unit test
Type mock isolator
Xp Day 080506 Unit Tests And Mocks
Ad

More from David Völkel (12)

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

Recently uploaded (20)

PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Topaz Photo AI Crack New Download (Latest 2025)
PPTX
Introduction to Windows Operating System
PDF
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
PDF
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PDF
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PDF
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
PDF
Cost to Outsource Software Development in 2025
PDF
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
PDF
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
PPTX
Advanced SystemCare Ultimate Crack + Portable (2025)
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
Time Tracking Features That Teams and Organizations Actually Need
PDF
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
GSA Content Generator Crack (2025 Latest)
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
PPTX
CNN LeNet5 Architecture: Neural Networks
Computer Software and OS of computer science of grade 11.pptx
Topaz Photo AI Crack New Download (Latest 2025)
Introduction to Windows Operating System
Ableton Live Suite for MacOS Crack Full Download (Latest 2025)
EaseUS PDF Editor Pro 6.2.0.2 Crack with License Key 2025
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
The Dynamic Duo Transforming Financial Accounting Systems Through Modern Expe...
How Tridens DevSecOps Ensures Compliance, Security, and Agility
How AI/LLM recommend to you ? GDG meetup 16 Aug by Fariman Guliev
Cost to Outsource Software Development in 2025
How to Make Money in the Metaverse_ Top Strategies for Beginners.pdf
AI/ML Infra Meetup | LLM Agents and Implementation Challenges
Advanced SystemCare Ultimate Crack + Portable (2025)
Weekly report ppt - harsh dattuprasad patel.pptx
Time Tracking Features That Teams and Organizations Actually Need
DuckDuckGo Private Browser Premium APK for Android Crack Latest 2025
Monitoring Stack: Grafana, Loki & Promtail
GSA Content Generator Crack (2025 Latest)
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
CNN LeNet5 Architecture: Neural Networks

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