Each eye defect is corrected by changing where the light is focused so that the image falls exactly on the retina.
A cataract is treated by surgery. The surgeon removes the cloudy lens and replaces it with a clear artificial lens, which restores clear vision.
Long-sightedness is corrected with glasses or contact lenses that have a convex lens. A convex lens bends light rays inwards, so they converge before they enter the eye. This adds to the refraction of the eye and moves the image forward onto the retina.
Short-sightedness is corrected with a concave lens. A concave lens spreads the light rays out, so they diverge slightly before entering the eye. The eye's own lens then focuses the image further back, onto the retina instead of in front of it.
Laser surgery can also treat both defects. The laser reshapes the cornea so that it refracts light by the right amount.