DEV Community

Miguel Oliveira
Miguel Oliveira

Posted on

If you want to be good developer do tests

Why are important?

I wondered at the beginning why I should adopt the culture of creating tests, and I could understand the following arguments:

  • Not having 100% testability in all your software development, it will be necessary to pray that there are no bugs and, eventually, having a gigantic inefficiency;
  • Tests can portray a harmonious and classical opera rehearsal, after all, an opera performance contains important components and needs rehearsals to achieve “perfection” and not have an inconvenient event like errors or side effects;
  • Ensure that our results are as expected. A good developer get centralize the idea and to know each a bit of code. If you don't want bad and expensive code, make it tests.

Robert C. Martin said: "Why do most developers fear to make continuous changes to their code? They are afraid they’ll break it! Why are they afraid they’ll break it? Because they don’t have tests."

The lovely: TDD

The Test Driven Development is a philosophy on the result of test construction. In their essence, TDD is a technique for building software that guides software development by writing tests.

Your could follow three simple steps repeatedly:

  1. Write a test for the next bit of functionality you want to add.
  2. Write the functional code until the test passes.
  3. Refactor both new and old code to make it well structured.

Constructive Criticism of Using TDD

In general, TDD is something that cannot always be rigorously applied on a day-to-day. After all, this implies its productivity and delivery within a certain period, as this cycle is very slow in an environment where there are dense updates.

I will say that I'm not saying that its use is impossible, however, deadlines may not get along with these cycles.

Final considerations

There you have it, the whole culture of creating tests and embedding TDD is pretty cool and it works. Just see what works best when it comes to applying TDD and you have a product that is fully testable and free of intrusive events.

Good bye! See you next time!

Content about TDD by Martin Fowler

Oldest comments (0)