B
Ben Bacarisse
arnuld said:Okay guys, I have finally reduced the get_single_word() to less than 40
lines. Does anyone has his views on my refactoring method:
I am not keen on it. The division of labour between the get_ and
save_ functions seems to be quite arbitrary and not helpful in
understanding the code.
I would not even write the separate allocate_new_mem function. A
small function being passed that many pointers to variables in the caller
is not a good idea. It created too much "linkage". Rather than being
able to read and understand each function on its own, the reader now
has to see what allocate_new_mem does to all of its parameters in
order to understand get_single_word.
At the very least, the modification of word_begin does not belong
there. Also, please change the name of this variable. It points, to
the end of the word being saved, not the beginning (OK, initially
these are the same, but that is not the point).