language agnostic - Is writing as many tests as possible at once a good practice for TDD? -


i'm beginner tdd; i've read tdd example , can't seem stop writing code in tdd fashion. i've noticed lot of time i'm writing test, see fail, correct it, , refactor. , after tests see there better way write interface all-along leads me want change of previous tests.

it makes lot of code write waste of time, i'm wondering if practice write of tests @ once (or @ least try to) in-order save time? i'm asking because know it's not standard way, wrong?

the real question "do more finished code done in given length of time?" doesn't matter how many times write , throw away if more in end.

as use tests more, better figuring out whether test or not. ask question, "does test code somehow?" document how use code? check code didn't modified incorrectly when refactoring? test code works right on "happy path" , kinds of failures common?

i write 1 test , 1 bit of code. have decide how "one unit" of code you'll feel it.

then either update test make better , improve code meet changes or write test , update code meet tests requirments.

and keep on going. 1 bit of test. 1 bit of code. keeps focused way.

don't forget yagni. (you ain't gonna need it.) principle says write code need right now. don't write code "just in case" or "it's needed later."

later come own requirements. still know how code it, maybe better because have more experience. think need may (or may not) need when there.

writing code waste of time , effort.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -