Can't agree with this advice. Figuring out the design before writing code is not going to work because you simply don't understand the problem well enough before you try to implement the solution. It is that first prototype that helps you gain knowledge, discover practical use cases, prioretize features, etc. The design that you "figure out" without writing any code will most likely be inadequate.
The thing is - you want to minimize the amount of code you end up with, not the net amount of code you write along the way.
PS. Two exceptions: a. your problem is trivial; b. you've solved a similar problem before.