You are on page 1of 23

Understanding TDD

The effective way


Samuel Bamgboye

MCP | MCTS | OCA | BEng Computer Eng.

Software development concerns

Limited project deadlines

Fear of adding new features

Fear of refactoring

Cost of employing testers

Time it takes new developers to get used to the code base

Dependency on open source

Im a software developer
Front End
Back End
Micro-Services
Contributor to Akka.NET
TDD

You are going to leave here


understanding TDD in the simplest,
yet most effective way possible

Understanding TDD
(Test Driven Developement)

The effective way

Things we will touch


What

is TDD?
How does it work?
How TDD can help you?
TDD and SOLID code

What is TDD??

Let's quickly talk about bugs

Syntax error

Default syntax checker

Semantic error

Default semantic checker

What is TDD??

TDD is the process of creating this semantic checker

In this process, at least one test is written before production


code

Tests then act as the checker

Things we will touch


What

is TDD?
How does it work?
How TDD can help you?
TDD and SOLID code

What do you do usually to solve problems?

Look for a solution

Apply the solution

Check if it worked

What is the TDD way?


Separate essence from abstraction
Ask if you have a problem in the first place
Do the simplest thing to solve the problem
Check if your problem is solved based on the answer to
the problem you had

The multiple checking strategy

TDD works because of the effect of double checking

It shows that an update doesnt contradict existing features

A contradiction rather than a regression expresses feature change

How does it look like?

Things to note about any test

A test fails when it throws an exception

A test passes when it does NOT throw any exception

The test runner executes the test methods

Test dont pass and fail unpredictably

TDD in summary
Do

not write a single line


of code until you have a
reason (provided by a
failing test) to do so

Things we will touch


What

is TDD?
How does it work?
How TDD can help you?
TDD and SOLID code

TDD will help give peace of mind that your application will keep working
through the following

Adding more features safely


Modifying existing features safely
Refactoring safely

TDD is all about balance


I get paid for code that works, not for tests, so
my philosophy is to test as little as possible to reach a
given level of confidence (I suspect this level of
confidence is high compared to industry standards, but
that could just be hubris). If I dont typically make a kind
of mistake (like setting the wrong variables in a
constructor), I dont test for it.

-Kent Beck

Things we will touch


What

is TDD?
How does it work?
How TDD can help you?
TDD and SOLID code

TDD and SOLID code


TDD

improves your design but balanced


Test induced design damage by David Heinemeier (
http://david.heinemeierhansson.com)
TDD
S

makes it easier to write SOLID code

- Single Responsibility
O - Open Close
L - Liskove Substitution
I Interface Segregation
D Dependency Injection

Learn more about TDD

TDD / Unit Testing big list of learning resources from basics


to advanced topics

http://www.mfranc.com/unit-testing/tdd-unit-testing-big-list-of-learning-resources-from-basics-to-a

Thank You
Samuel Bamgboye

https://github.com/contactsamie
https://www.nuget.org/profiles/contactsamie
http://stackoverflow.com/users/2124293/samuel
https://www.npmjs.com/~contactsammie
https://hub.docker.com/u/contactsamie/

You might also like