Write less code
If you find yourself writing a lot of code to do something simple, you’re probably doing it wrong. A good example is the lowly boolean:
if (numMines > 0) { enabled=true; } else { enabled=false; }
When you could just write:
enabled = numMines > 0;
The less code you write the better. Less to debug, less to refactor, less to go wrong. Use with moderation; readability is just as important, you don’t want to make your code less readable by doing this.
10 steps to becoming a better programmer