Use a flowchart to represent the logic of your program before coding.This will reduce lot of redundancy and helps improve your logic. In fact, even if you don't use a flow chart, but sure to spend some time thinking about your program design before diving in and writing code.