I am teaching #TDD these days and noticed that there is one step that is not too
obvious but helps to keep focus on what what to implement: using higher level
functions to express logic instead of diving directly into the nitty gritty
implementation detail. >
2 replies
I think this is typically done in the refactoring step of TDD but I've seen that
it helps to "sketch" the new business logic first using calls to helper
functions:
function addMemberToGroup(member, group) { if(!isMember(member, group)) {
addMember(member, group) } }
Once you have the structure of your implementation, you can implement isMember
and addMember.
This way you are not distracted by figuring out how to do it before having a
good understanding of what to do.