I've found the way TDD has been "sold" to me as quite odd, and probably what's turned me off from it the most (cure of all ills). At the same time, I find the religious pushes for and against to be both understandable and bizarre. I've been thinking about this for some time now, but don't think I've ever really written it down.
As a very general statement, I'd say any developer should try their hardest covers the basic tenets of TDD while working. Let me back that up, since I'm sure that's probably rubbed people up the wrong way.
1. I know what the system is currently doing
2. I know what the system should be doing
3. These things are different, and I know how to check
4. I change the system
5. I check that the system is now doing what it should be doing
That all seems pretty uncontroversial, I hope.
1. If you don't know what the system is doing now, you can't tell if there's anything to do at all.
2. If you don't know what it should be doing, there's no way of implementing it.
3. If you can't check that if it's doing the right thing (even manually) then you're fairly screwed (although we've all ended up in a case where the "check" is "ask the customer afterwards if it's fixed").
4. You obviously need to actually do something to change the system.
5. Finally you should check your work actually, well, works.
The idea that you have an automated check for 3 seems like a fairly good idea, as long as it's not too onerous. Then suggesting that it's implemented and run before 4 makes sense, it's unlikely to be much harder to do it before rather than afterwards and it gives me some confidence that the test checks what I think it does.
Personally, while I quite like the workflow presented, I'd do most of that on paper / whiteboard / in my head. Take the task and break it down into smaller things it needs to do. Don't rush into creating the right structure, just actually understand what it is this thing will need to do. Then I can consider general designs, where the edges will be, types of failures and errors that are likely to pop up and I can write something (as always, discovering more as it's written and having to change things). It's very useful to then start on the bits I'm less sure about, or the ones that will have the most impact if I have to change things. I think that gets easier the more you code though.
However there are types of programs which aren't well covered by a test (demo) or set there of.
Sometimes the program is being written to learn a value which is unknown, or for which a simplified example having success insufficiently tests the validity or scalability of the software.
Tests in those cases may work at a unit level, but still provide insufficient insight in to the soundness of the overall results.
As a very general statement, I'd say any developer should try their hardest covers the basic tenets of TDD while working. Let me back that up, since I'm sure that's probably rubbed people up the wrong way.
1. I know what the system is currently doing
2. I know what the system should be doing
3. These things are different, and I know how to check
4. I change the system
5. I check that the system is now doing what it should be doing
That all seems pretty uncontroversial, I hope.
1. If you don't know what the system is doing now, you can't tell if there's anything to do at all.
2. If you don't know what it should be doing, there's no way of implementing it.
3. If you can't check that if it's doing the right thing (even manually) then you're fairly screwed (although we've all ended up in a case where the "check" is "ask the customer afterwards if it's fixed").
4. You obviously need to actually do something to change the system.
5. Finally you should check your work actually, well, works.
The idea that you have an automated check for 3 seems like a fairly good idea, as long as it's not too onerous. Then suggesting that it's implemented and run before 4 makes sense, it's unlikely to be much harder to do it before rather than afterwards and it gives me some confidence that the test checks what I think it does.
Personally, while I quite like the workflow presented, I'd do most of that on paper / whiteboard / in my head. Take the task and break it down into smaller things it needs to do. Don't rush into creating the right structure, just actually understand what it is this thing will need to do. Then I can consider general designs, where the edges will be, types of failures and errors that are likely to pop up and I can write something (as always, discovering more as it's written and having to change things). It's very useful to then start on the bits I'm less sure about, or the ones that will have the most impact if I have to change things. I think that gets easier the more you code though.