Whichever element is best is always based on the situation. Shock is the most useful in a way since not many people are resistant to shock. And it'll bring down shields a lot. Works decently well against armored opponents as well.
General purpose and shields Shock Flesh targets Fire Armored targets Corrosive Always Slag if you have trouble.
A shock Mechromancer build can make shock work on everything amd be almost as good as fire damage on flesh or corrode damage on robots. It's great if your lazy like me and don't wanna switch between elements all the time (switching to and from slag is annoying enough).