In most cases, you can skip leaving "Why are you doing this?" messages when you see vandalism. Sometimes you get a kid playing around and doing something small just to see what will happen.
When it's obvious that vandalism is being committed, like when the person keeps going to the same page or picture, then it's deliberate and the other person knows they're doing it. So getting upset about it or even sincerely asking why they're doing it gives them attention they're looking for.
After a while, you kind of get a feel for which it is by looking at it, playing around versus deliberate.
Please sign your name on talk pages by using four tildes (~~~~). This will automatically produce your name and the date. Signing your comments is important, as it lets other editors know who has posted which comments.