The noise of a shaking can startles the puppy, interrupting what the puppy is focused on. Now there is the teachable moment.
The shaker can teaches nothing by itself. In fact, if you throw a shaker can at some puppies, they pick it up and run off with it, shaking as hard as they can.
You’ve now made a void that needs to be filled: the puppy is no longer doing the thing you didn’t want him to do. You now need to fill that void, or the puppy will!
I can only speak for myself, but I learned a long, long time ago in the context of training dogs the importance of interrupting a behavior to re-direct. I think Scott Mueller wrote about using the No delivered in a normal tone of voice rather than being bellowed across the training room. No means, “Stop what you are doing.” For example, I may interrupt a dog doing scent articles and is sniffing the floor instead of working for the pile — NO and when she looks up at me like ‘what, then?’ re-directing with a ‘find it’ and the dog goes back to work.
Think of a mother who is raising children. She will repetitively interrupt the child who is reaching for the pretty glass figurine on the department store shelf with a verbal no. When that child looks toward Mom, she is re-directed (usually with a ‘come over here and stand/sit by me’).
No is generally sufficient to interrupt the bad or dangerous behavior because the mother always re-directed and praised or encouraged the child for doing the right thing. The same is true with dogs.
Interrupting a behavior to redirect is a critical element of good training. Learning to get the timing right and knowing in advance what you want the dog to do instead of what you just interrupted is crucial.