I found that if I got the data structures correct, the code usually flowed.
If not, things got messy fast.
This piece of advice reminds me of the following famous quotes from Fred Brooks,
Eric S. Raymond,
The programmer at wit's end for lack of space can often do best
by disentangling himself from his code, rearing back, and
contemplating his data.
Representation is the essence of programming.
-- from The Mythical Man Month by Fred Brooks
If you've chosen the right data structures and organized things well,
the algorithms will almost always be self-evident.
Data structures, not algorithms, are central to programming.
-- Rob Pike
Show me your code and conceal your data structures, and I shall continue to be mystified.
Show me your data structures, and I won't usually need your code; it'll be obvious.
-- Eric S. Raymond
I will, in fact, claim that the difference between a bad programmer and a good
one is whether he considers his code or his data structures more important.
Bad programmers worry about the code.
Good programmers worry about data structures and their relationships.
-- Linus Torvalds
See also: Re: Swallowing an elephant in 10 easy steps