Have you ever heard a banging noise coming from your water pipes when the water is turned off quickly? It usually sounds like the pipes are banging on something inside the walls… and that's exactly what's happening. When the flow of water is turned off very quickly, a small shockwave is created inside the pipe. This can cause the pipe to shake and often bang on the wall studs or floor joists.
Many years ago, I replaced the water tubing running to my kitchen sink as part of an experiment to get hot water faster at my kitchen sink. Before I secured the new tubing in place, I tested out the water line to make sure I was happy with the results. I found I had created perfect conditions for a banging pipe.
That pipe banging on the wood was happening just from me turning the hot water on and off at the kitchen sink. How many times do you suppose that pipe will bang on the floor joists before something gives way and the pipe starts leaking? I never waited around to find out. Just watching that video made my skin crawl.
This banging is referred to as 'water hammer', and as you might imagine, it can lead to damaged water lines.

How to deal with water hammer
The most obvious way of dealing with this is to keep the pipes secure. As soon as I secured the flexible water tubing at my own house, the tubing couldn't move anymore, and the sound went away. For new installations, clamps and protective devices are standard.

Water Hammer Arresters
The Minnesota State Plumbing Code actually addresses water hammer, and requires the installation of devices to help prevent it:
The places that you'll most commonly find "quick-acting valves" are at dishwashers, clothes washing machines, and whole-house humidifiers. Also, the standard referenced in Table 1401.1 is ASSE 1010-2004, Water Hammer Arresters.
In many older houses, you'll find primitive water hammer arresters. These were simple chambers of air that were supposed to prevent banging pipes, but they didn't work all that well. One type was a whole-house shock absorber, consisting of a huge pipe that went nowhere, and was typically installed next to the water meter.