Shaders are a bit like functions that run on the GPU instead of the CPU. Having one shader that does everything is like having one function that does everything; i.e. usually a huge, unmaintainable mess with branches everywhere. That said, having one shader for each object is usually overkill, as many objects can be rendered using the same shader, just with different models or textures.
For example, you can render in-world objects using one shader that does lighting, normal mapping, etc. However, HUD elements don't need any of those effects; they're usually drawn as unlit, diffuse textures, so you wouldn't use your shader that does lighting on them.
I'd say a good rule is that if you're writing a lot of branches (if
, switch
, etc) in your shader, especially if the conditions are based on uniform
s, then it's probably time to split it up.