tdd distilled... in java

28
TDD distilled... in Java

Upload: manuela-munaretto

Post on 16-Apr-2017

12.338 views

Category:

Software


0 download

TRANSCRIPT

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

● 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?

● Sharing is growing● Give back to the community

Why we are here?

Agenda

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

Distilled

The What and The Why

● The What: the mechanics

● The Why: the ideas behind them

The What

What I mean by TDDRED

GREEN REFACTOR

The TDD mantra● RED● GREEN● REFACTOR

Add a little failing test

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

Run all tests and fail

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

Make a little change

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

Run the tests and succeed

If it succeeds, you’re done.

Refactor to name concepts

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

Refactor to remove duplication

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

Write a test list

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

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

The Why

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.

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.

REFACTOR

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

The Code

String Calculator

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

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

The Feedback

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

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/

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

Resources

● Workflows Of Refactoring

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

● The Feedback Door

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