TDD Mini Workshop @ Bucharest JUG 2014 04 24

Embed Size (px)

Citation preview

What Is TDD?

What Is TDD?

A Way to Design Software Incrementally (while you code)

Two Ways To Design

Design before dev.Assumes requirements are stable

Implies design is the job of a designer

Can take a long time

Makes designer think ahead

Design during dev.Assumes requirements will change a lot

Design is the job of the programmers

Is real time

Focuses on current needs

Upfront vs. Incremental Design

Upfront designers:

Define abstractions

Incremental designers: Start from examples and extract abstractions based on patterns

Test Driven Development

Write one test that describes a new behavior

Add the minimum of code to make it pass

Improve design by refactoring code and tests

Keep it Simple

Minimum code to make the current test pass

Keep it Clean

Refactor after each small change

Be in Flow

What's the next behavior?

What's the minimum change to implement it?

What's the right design?

Two Main Difficulties

Think at the problem, not the solutionProblem: I want to play TicTacToe

Solution: We need four classes and a main method

Proof-based designProof-based: I see duplication, remove it by creating a class

Assumption based: I will need a Game class

Start With TDD

How to Start?

What is the first test?

What is the next test?

Am I going in the right direction?

Remember

Incremental Design starts from examples, extracts abstractions based on proof

Behavior Slicing

Identify Input and Output

Specify behaviors: input action output

Simplify: Identify first increment of the problem

Order behaviors so that only one thing changes

Contact me

http://www.mozaicworks.com [email protected]@adibolb

Extend your mentoring & training capacityAccelerate learning through communities of practiceGrow your functional leaders and top talents

www.mozaicworks.com

Photo Attribution

http://home.dei.polimi.it/pinto/tdd/images/tdd.gifhttp://www.flickr.com/photos/hey__paul/7511823952/sizes/m/in/photostream/http://www.flickr.com/photos/ru_boff/8307297704/sizes/m/in/photostream/

Photo Attributions

http://www.flickr.com/photos/porsche-linn/5738170905/sizes/l/in/photostream/http://www.flickr.com/photos/argenberg/450909401/sizes/z/in/photostream/

Click to edit the title text format