7 ms·
I was frustrated with a memory leak in someone else’s code of a dozen or more if-if-if-if-else-else-else statements like the second example, it was probably 400
by jquast 3y ago
I was frustrated with a memory leak in someone else’s code of a dozen or more if-if-if-if-else-else-else statements like the second example, it was probably 400 or more columns wide. It was my first real job and I began to doubt my abilities, I couldn’t follow the logic.
I refactored it all as the author suggests, out of desperation to better understand it in a debugger if more code could fit on a page. To my astonishment the memory leak disappeared, so it has always since been a habit, sometimes I still rewrite code this way just to better understand it, I think it looks better.