Why do insects have compound eyes?

Compared with single-aperture eyes, compound eyes of insects have poor image resolution; however, they possess a very large view angle and the ability to detect fast movement and, in some cases, the polarization of light.Although insects' eyesight image is very poor,they can sense when there is reydators by using their five senses,just like humans,they are the sense of hearing,seeing,touching,tasting and smelling.