Cavity is demineralization of the tooth structure, involving enamel first, then the dentin layer. It is an infectious disease because scientific research has found the bacteria that are involved in this mechanism: Streptococus mutans (or Actinomyces Viscosus if we talk about cavity on root surface, this problem happens more in the older population group). In brief, in order to have cavity to happen, you need three things: the bacteria, the nutrients for the bacteria (let’s say sugar in the candy), the host (yourself, or the tooth that get infected). How does it happen? To say it simple, the bacteria metabolize the nutrient into some acidic substance, which in turn will dissolve the mineral in the enamel or in the dentin, making your tooth become soft, hence cavity.
How do dentists treat cavity? They treat the cavity by drilling it with a bur, with microabrasion, or with laser technology as far as the soft decayed part of the tooth can be removed. Then they have to fill the empty space now left behind. They can choose a material called Amalgam (or commonly known as silver filling), or some synthetic materials such as composite resins (or commonly known as white filling), or even ceramic/porcelain (as in the case of inlays). One of the more recent approaches to treat cavities is by assessing the risk of patients. Patients with a high risk of contracting cavities are prescribed with some fluoride rinses, regular chewing of gum which has the ingredient called xylitol. I believe that this is more of a preventive and progressive approach dentists should be heading for in the future.