Say you write a big chunk of code, maybe 50 lines. If there's a bug, it could be anywhere in the 50 lines. When you find the bug, you might have to rewrite a lot of code, especially if the bug is early in the code.
It's easier to find bugs in a small chunk of code, say five lines. So, write code in small chunks. Test each chunk as you go.
Where referenced