Kent Beck created the first unit testing framework called SUnit, to test Smalltalk software, in the 90’s. XP eXtreme Programming methodology and TDD Test-Driven Development approach were borning together with SUnit.
A reader of our eXtreme Programming book asked us a guide to move from 0% TDD programming to 100% (or almost) TDD programming. But, there’s no manual that will really teach TDD, because it’s a practice. We could use a metaphor to explain it, TDD is like swimming, an activity that we practice.
Yes, TDD can be very hard at first time. Like swimming, you might not have enough breathing discipline, getting tired faster and giving it up. And after say “I didn’t like swimming, swimming is not for me”.
As a swimmer needs to jump in the water, a programmer needs to start with a failing test, write code until the test works, and refactor. And repeat these steps a lot of times. It’s a cycle, it’s a mantra:
TDD mantra: write a failing Test, Code until pass the test, so Refactor.
After a lot of TDD cycles, you will be understanding how to practice TDD. So, please, jump in the water and enjoy TDD.
Refatoração: uma mudança feita na estrutura interna do software para deixá-lo mais fácil de entender e barato de modificar, sem mudar seu comportamento observável. Martin Fowler.
Além de refatorar código, pode-se também refatorar banco de dados. Hoje na Quarta do Conhecimento da PROCERGS o Fabrízio Mello palestrou sobre bad smells em databases, mostrando os diversos maus cheiros em banco de dados. Segue a apresentação:
Você precisa fazer login para comentar.