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.
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.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.
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.