Repetition and duplication are not the same thing. Find some pattern or set of higher-order abstractions that you can use over and over again in your solution. mehr...
An info graphic that hopefully speaks for itself... mehr...
Some thoughts on quite an old topic: Seven tips that might help you to write better software. mehr...