Before we go ahead and jump into writing code, we need to define what we need to do. Setting goals before we write code is beneficial in three ways.
Firstly we will know all of the features that our code should have, and can limit ourselves to just that, which will eliminates scope creep (also known as feature creep).
Secondly, when given a set of goals, we can visualize how we will write the code in our heads. If you know what to expect at the end, you can build it much faster, because you will already know what it should look like.
Finally, once we finish writing our code we can go back and check if we have met all of our goals. This helps us to decide whether or not we were successful. If for some reason we did not meet a goal, we could consider it a failed project unless there is a good reason for this. For example, we could start writing a portion of code and realize that there is a better way of doing it. In this case, not meeting the goal would be a good thing. But...