Top Banner
TDD distilled... in Java
28

Tdd distilled... in java

Apr 16, 2017

Download

Software

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Tdd distilled... in java

TDD distilled... in Java

Page 2: Tdd distilled... in java

Notes

● Shared slides are without images because of intellectual rights reasons.● In conference slides you found images from “The Colour Monster” thanks to Anna

Llenas and Flamboyant Editions ○ http://www.annallenas.com

Page 3: Tdd distilled... in java

● Manuela Munaretto ● Agile Dev at Xpeppers● Mother● @m_munaretto● www.xpeppers.com● manuela.munaretto@xpeppers.

com

● Ivan Lombardi Borgia● Agile Dev at Xpeppers● @ivanlombardib● www.xpeppers.com● ivan.lombardiborgia@xpeppers.

com

Who are we?

Page 4: Tdd distilled... in java

● Sharing is growing● Give back to the community

Why we are here?

Page 5: Tdd distilled... in java

Agenda

25’: Welcome and introduction to codelab 5’: Q&A25’: Session #110’: Retrospective25’: Session #220’: Retrospective 5’: Feedback door

Page 6: Tdd distilled... in java

Distilled

Page 7: Tdd distilled... in java

The What and The Why

● The What: the mechanics

● The Why: the ideas behind them

Page 8: Tdd distilled... in java

The What

Page 9: Tdd distilled... in java

What I mean by TDDRED

GREEN REFACTOR

The TDD mantra● RED● GREEN● REFACTOR

Page 10: Tdd distilled... in java

Add a little failing test

You are not allowed to write any production code unless it is to make a failing unit test pass.

Page 11: Tdd distilled... in java

Run all tests and fail

You are not allowed to write any more of a unit test than is sufficient to fail.

Page 12: Tdd distilled... in java

Make a little change

You are not allowed to write any more production code than is sufficient to pass the one failing unit test.

Page 13: Tdd distilled... in java

Run the tests and succeed

If it succeeds, you’re done.

Page 14: Tdd distilled... in java

Refactor to name concepts

Explicitly name the concepts before you try to eliminate the duplication.

Page 15: Tdd distilled... in java

Refactor to remove duplication

Don’t Repeat Yourself: every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

Page 16: Tdd distilled... in java

Write a test list

● A title● Get things out of your head quickly● Any example that comes to mind● Simpler examples● All the variations

Page 17: Tdd distilled... in java

What TDD is not

● Traditional Unit Testing○ After the program has been

written○ Try to find problem

● A testing technique○ Unit Testing○ Stress Testing○ Smoke Testing○ Black box Testing

Page 18: Tdd distilled... in java

The Why

Page 19: Tdd distilled... in java

RED

● It forces you to really think about what you are going to do.● There is a big step between hearing the words of a customer

and understanding the meaning.● It drives the design.

Page 20: Tdd distilled... in java

GREEN

● Divide et impera.● Fake it until make it.● Don't try to implement two things at a time.● Writing the easy code first makes writing the hard code easy.

Page 21: Tdd distilled... in java

REFACTOR

● Make it Clean preserving functionalities.● Keep work focused.● Permit more aggressive refactorings.● Complexity on tests reflect complexity on production code.

Page 22: Tdd distilled... in java

The Code

Page 23: Tdd distilled... in java

String Calculator

● Simple exercise to focus on basis● Also experts need to practice basis

https://github.com/xpeppers/tdd-distilled-java

Page 24: Tdd distilled... in java

The Feedback

Page 25: Tdd distilled... in java

Retrospective

● What I learned○ +○ -

● Actions

● You should not go through the door without giving some feedback:○ A scale 1 to 5○ 1 = very negative○ 5 = very positive

Page 26: Tdd distilled... in java

Resources

● Extreme Programming: A gentle introduction○ http://www.extremeprogramming.org/

● Test-Driven Development: By Example - Kent Beck○ http://www.amazon.

it/dp/0321146530/ref=cm_sw_r_tw_dp_5rgrwb1F002NJ● Cunningham & Cunningham, Inc.

○ http://c2.com/

Page 27: Tdd distilled... in java

Resources

● The World's Best Intro to TDD

○ http://online-training.jbrains.ca/courses/wbitdd-01● String Calculator

○ http://osherove.com/tdd-kata-1/● Understanding the 4 rules of simple design

○ https://leanpub.com/4rulesofsimpledesign

Page 28: Tdd distilled... in java

Resources

● Workflows Of Refactoring

○ http://martinfowler.com/articles/workflowsOfRefactoring

● The Feedback Door

○ https://dzone.com/articles/feedback-door