Keep It Simple, Stupid!
Do not write complex code.
Simplify your code by following principles as DRY, separation of concerns and single responsibility principle. Everyone who takes a look at your code should be able to understand what it does as fast as possible. If one of your methods is very long (30 lines and up), or needs comments to be easy human readable you are probably writing overcomplicated code. Try to further split up your logic, divide it into smaller, easier bits of code.
Some signs your method may be overcomplicated:
- you cannot name it in a way so you do not need additional comments to explain its functionality
- it is longer than 30 lines
- it is split up into various parts which all deal with a different part of the problem (read out file, process its contents, append lines, save it again)
- you need comments to explain its functionality
Of course, if you need to implement an encryption or a compression algorithm, the code for this specific task may be rather complex. Still, for any other part of your application KISS is applicable.