DEV Community

Discussion on: Clean Code, bullshit or common sense?

Collapse
 
buntine profile image
Andrew Buntine

So, in my experience, it's pretty well understood in most teams that investing time up front to plan a system along with maintaining a relatively complrehensive test suite are important factors in good software development.

But you make the claim (perhaps unintentionally) that "having care for code" is synonymous with TDD. It would be beneficial for us to talk about why test-first specifically is a requirement for maintainable software opposed to automated testing in general. Right now, you are simply making a claim.

Collapse
 
fefas profile image
Felipe Martins

Hey Andrew! Thanks for your feedback!

Indeed, normally developers are concerned in sharing their understanding about the system and planning architecture.. that is, of course, an important step, but it doesn't mean the resulted software will be easy to understand, well tested, with domain uncoupled from structure stuff and so on... that is what my working experience has shown me.

About the claim.. yes, I did that intentionally.. as I understood we both agree tests are important for maintainability, so the point here is "why TDD?". So, in my opinion, TDD is the best way to write tests for a lot of reasons. It was simply a class as this theme could be easily converted into a new post.. I will enumerate some of the good points of using TDD according to my experience:

  • By defining scenarios, we are challenged to have a deep understand the problem being solved
  • Being focused in software behaviours instead of "what if this happens, what that happens".. just write the next scenario and code to get it green
  • Implementation MUST be decoupled, otherwise is imposible to TDD
  • It is a tool/methodolgy to discovery the applicaiton design.. let the test to guide us
  • Coding just what is needed.. nothing more, nothing less

It isn't easy to understand, even harder to put into pratice.. I will maybe write about it in a more consistent way with samples and will paste the link here :)