To get the perfect picture, the first rule of thumb is to get the perfect composition. Composition just means how the many different elements you see from your camera are placed in the frame. Most photographers use the Rule of Thirds. Based on this theory, you should divide your picture into nine squares, with your main subject spread out over the grid, and not just in the center.
Most digital cameras and smartphones these days allow you to overlay such a grid before you take the picture so you know what to focus on. This rule allows you to create better and more interesting pictures than ones with just the subject in the middle and nothing else.