•Sun or shade?
A worm bin is best placed in the shade. The worms will not fare well in hot temperatures or during a deluge of water during a rainstorm. By placing them in the shade, they will be more protected from the elements and less likely to dry out.
As for a regular compost bin, direct sunlight does not cause the compost pile to heat up. The microbes working busily inside the compost are why the pile heats up. With this in mind, keeping your compost bin in the shade will decrease water evaporation. Also, people are more likely to turn their pile if they do not have to go out into the hot sun to do it.