As with just about anything in programming, you'll save work in the long run by having a well-thought-out plan from the beginning rather than making things up as you go along.
Before coming into water, you must be sure what you will meet so that you will have a well-thought-out plan in case something happens. In addition, you may know how to escape.