This is my list of coding & design principles I remind myself of whenever I feel coding my app is getting too complicated. Essentially, this list helps me apply the principle of orthogonality.
1. Stop repeating yourself – reorganise your object(s) so that you don’t find yourself copying/pasting chunks of code.
2. What does your method do? If it does 2 things, it should be 2 methods.
3. Private is good – you wouldn’t show your underwear to anybody in the street, don’t show your variables and methods unless you have to.
4. Isolate your constraints – keep them all in a method called “initialise()”, which you can call from your constructor (or from onCreate() if you’re programming from Android).
5. Isolate your input & output methods – do not add any logical app code to them, only input/output processing code specific to the input/output media you have chosen. This way, you can easily add that “save to file” functionality later on.