This is not strictly speaking true. You should think about your problem for a little while before beginning to write code, but then you should just jump in an thrash around a little. Usually painting yourself into a corner is a good way to discover what the thing you were trying to do in the first place really was all about. Some people like to think things out completely before they even begin. This doesn't work for me as I start to focus on some insoluble little piece which turns out in retrospect to have not even been important.
Some people like to just start coding without thinking about it at all.
So I recommend moderation. Think about it a little, scribble some crude diagrams. Think about the pieces involved. Pick a piece you think would be fun to work on, and start work on that piece, accepting that as things go along you will probably discard that work in favor of a better idea that occurs to you while working on it. Over the years you will get better at picking the right pieces in the first place and just knowing what the right way is to approach the problem.