Start by understanding a program's goal, then work backwards. Write the output code first. Then you know what variables you'll need from processing. Once you've designed processing, you know what you need from input.
See the sales report lesson for an example.