This applet illustrates the phenomenon of interference between coherent light sources. The code is actually very simple, it assumes that there are two point sources at the bottom that emit spherical waves, which are just plane waves whose amplitude falls proportional to distance. Then when the waves reach the top of the applet, the amplitudes from the two source are added and plotted as the distance the blue line extends from the top. The red line shows the time average, which is what our eyes would see. After the equivalent of about a tenth of a second, the red line turns green, indicating that the averaging has been performed for about the duration that the human eye averages.
If you click on the 'Incoherent' button, the frequency of one of the light sources is shifted from 300MHz to 300.001MHz. This slight change in frequency causes a loss in coherence that destroys the interference pattern. The time average plot quickly forms a classical distribution. This helps explain the phenomenon in quantum mechanics whereby a measurement interferes with the result of an experiment. Experimenters performing the dual slit experiment tried to determine which slit a photon passed through by placing a detector in each slit. However, in order for a detector to sense a photon, it must extract some of its energy, which lowers the frequency of the photon. This asymmetrical change destroys the coherence of the light and the interference pattern that they were observing disappears.