Do you wear your cap peak to the front or peak to the back? If you are wearing it for decoration, it doesn't really matter, but if you are wearing it to shade your eyes from the sun, peak to the back doesn't work. Now, the nice lens manufacturers thoughtfully provided the equivalent of a peaked cap for your lens – they call it a lens hood. And just like the peaked cap, it can be fitted sticking out to the front or tucked neatly over the lens body facing backwards. And just like the peaked cap, unless you are using it just for decoration, fitting it backwards doesn't work.
So, why does your lens need shading? It needs shading because without it, as well as the light from the subject area, which goes straight through the lens elements to the sensor, light from outside the subject area will also hit the lens, at an angle, and some of it will be refracted though the lens elements and cause flare in the image. The flare may show up as faded, over-exposed patches, or it may show up as bright multi-sided spots, which are actually an image of the diagphram that controls the aperture. While sometimes – not often – the aperture spots can enhance an image, most times flare is undesirable, so you need your lens hood forwards to minimize it. Even when taking night shots or working indoors it is better to have it mounted the right way. About the only time you should remove it is when using camera-mounted flash, as then it can block some of the flash light and cause shadows.
The lens hood in the forward position has a couple of added advantages. If it starts to rain, and we know it does in Ireland from timme to time, it will reduce the chances of raindrops on the front lens element. The raindrops might not harm the glass, but they can ruin a shot. And if you are inclined to bump your camera into things, better to break a relatively cheap bit of plastic than an expensive piece of glass.
Beware when taking pictures with the camera's built-in flash while wearing a peaked cap. When you bring the camera to the eye the peak can depress the flash unit enough to deactivate it, the flash won't fire, and you'll be stuck wondering why it didn't. For that circumstance, it's cap peak backwards.