You can observe this when looking over a steep cliff facing the open ocean. When a wave strikes a sea wall, much of the energy is also reflected back to sea. Diffraction occurs when wave energy spreads out through an opening such the mouth of a harbor. As the wave moves through the opening it is confined. But when it passes through the opening and is no longer confined it begins to spread out or diffract.
Refraction is a change in direction of a wave because of a change in propagation speed.
This occurs because the wave slows down as it moves into shallow water. Since one portion of the wave is moving at one speed, and another is moving at a different speed, the wave crest appears to bend. One consequence of refraction is the straightening out of beaches. A resistant portion of the coast will erode more slowly than the surrounding rocks and will project into the sea as a point. When a beach is flanked by rocky points, wave energy is concentrated on the points, causing erosion there, but allowing sand to build up in the area between them.