DEV Community

Discussion on: You ain't gonna need it

Collapse
 
rahoulb profile image
Rahoul Baruah

It's one of the advantages of Test-Driven Development (actually Behaviour Driven Development is what I do, but the idea is similar).

Because you start with an executable specification, all you do is the bare minimum to make the tests pass. I have found that making the tests pass looks like an insurmountable mountain for ages - then suddenly everything works and you're really surprised as how simple the resulting code is. (Although, now you have tests you're also safe to refactor if it does need tidying up)

And because all you're concerned with is making the tests pass, all the YAGNI stuff gets put on the back-burner until it, too, is included in a specification.

Collapse
 
linajelincic profile image
Lina Jelinčić

This is a great approach. You're right, tests ensure that you've done a good enough job and they would also help you enormously when (or if) refactor is needed.