No examples to hand, but mainly it's when people have duplicated some code that should have really been refactored to have a common function that handles both scenarios. It just seems so obvious. I believe that code should as small and simple as possible, not for optimization, but the simpler it is, the nicer it is to maintain
>>5
I was in a situation like this a night or two ago. Assuming two arrays, both of size n, and consistent modification between the two, I had to decide whether I wanted to iterate for each array individually (same algorithm, put into a separate function) or combining access to both arrays in the the same loop. I wasn't sure if there was even a difference.
Name:
Anonymous2010-10-01 19:27
>>10
Well if teh resulting refactored common function is a only a few lines, then yeah it's not necessarily worth it...but I'm talking 30 line blocks of code just copy and pasted.
Also, >>14
No, no it isn't. If you need to use breakpoints, modify the code to allow it, and then REVERT IT TO GOOD CODE when you're done. Or get a real IDE that let's you put breakpoints wherever.