When playing golf, it's very important to be strategic when hitting a shot onto the green. You need to avoid just getting a measurement number from your GPS and hitting a shot to that distance. The reason being is that you need to assess the green and flag position before your make your final choice.
A quick rundown is that I would never go for a back flag position because on most courses, if you hit the ball over the back, you will generally encounter a difficult chip. This is because over most greens, there's typically a steep decline which can lead to long grass, bunkers, water or just a precarious position in general.
Therefore for back flag positions I will always aim for the centre of the green unless I really know that at the back of green I wont be penalized for overshooting. Also when you do hit the ball to the middle of the green, you will most likely have un uphill putt which which will give you more confidence to attack the putt instead of defensive when putting downhill.
When the flag is in the middle of the green I will generally always attack with any club. If it's a front flag position, I will only really attack this pin with Wedges, up to an 8 iron. This is particularly the case if there is a bunker in front of the green. The exception would be if there's no danger in front of the green, I may hit longer clubs to get the ball close.
In a nutshell, just surmise the surroundings of the green and as much as you can, leave yourself with an uphill putt and aim for the centre of the green the majority of the time.