Corals are small animals that form a symbiotic relationship with algae. The algae produce sugars for the corals and are in turn provided with needed nutrients and protection from predators.
That's all great, but it doesn't explain where the amazing diversity of fish, mollusks, crustaceans, everything else comes from. As far as I can tell, the whole point of the coral's success is that their hard skeleton protects them from all but the most specialized predators.
So if the corals don't directly add (much) energy input to the coral reef ecosystem, what is it that makes the reefs so productive and diverse? Or, put another way, what makes a coral reef environment more productive than simple phytoplankton floating in the open ocean?