22
TDD – do increasing and save...

TDD - do increasing and save

Embed Size (px)

DESCRIPTION

My presentation to PHP & Symfony User Group (January 31, 2014)

Citation preview

Page 1: TDD - do increasing and save

TDD – do increasing and save...

Page 2: TDD - do increasing and save

Who I am?

Programmer at Wargaming.net~ 5 years php experience

Page 3: TDD - do increasing and save

Disclaimer

Page 4: TDD - do increasing and save

TDD - ?...

Page 5: TDD - do increasing and save

TDD this is...

Page 6: TDD - do increasing and save

...or this?! Do you know it?

Page 7: TDD - do increasing and save

Expectations...

Page 8: TDD - do increasing and save

Reality...

Page 9: TDD - do increasing and save

Why not?...

TDD? And who will

pay for it?

TDD does not work

everywhere

Good thing! But

we release

very soon

Page 10: TDD - do increasing and save

Stress-free!

0 1 2 3 4 5 6 70

2

4

6

8

10

12

Plain

TDD

Page 11: TDD - do increasing and save

Why is that?...

- Start immediately- Test First- SOLID/Patterns- Less coupled systems- Stress control. Results are obvious ...

Page 12: TDD - do increasing and save

Test First...

Page 13: TDD - do increasing and save

SOLID

Single Responsibility

Open/Closed

Liskov Substitution

Interface Segregation

Dependency Inversion

Page 14: TDD - do increasing and save

Single Responsibility: Test

Data - What does know? - Relations between objects?Behavior - What problems resolve? - Services?

Page 15: TDD - do increasing and save

Open/Closed: Test

- No need to change working code

Page 16: TDD - do increasing and save

Liskov Substitution: Test

- Tests can use to check the heirs instead ancestors- In case of violation of unit tests are complicated

Page 17: TDD - do increasing and save

Interface Segregation: Test

- Tests help to split the interfaces- Mocks dictates API

Page 18: TDD - do increasing and save

Dependency Inversion:TDD

- Service Locator or Dependency Injection?- Mocks in TDD create abstractions- Setting tests easier with Dependency Injection

Page 19: TDD - do increasing and save

TDD +/-- Confidence in the code to run- No code to Thrash- New solutions approves more quickly- New lever of your skills

- Slow refactoring- Tests are difficult - Doesn't work everywhere- Tests refactoring- TDD for bad smells code

Page 20: TDD - do increasing and save

FAQ...

- How many tests must be written?- TDD for existing projects- Must read

Page 21: TDD - do increasing and save

Books...

- Kent Beck "Test Driven Development By Example"

- Martin Fowler "Refactoring: Improving the Design of Existing Code"

- Joshua Kerievsky "Refactoring To Patterns"

- Michael Feathers "Working Effectively with Legacy Code"

Page 22: TDD - do increasing and save

Questions?