If you get an analog Joystick like the U360, you generally don't have to electronically switch it.
MAME will take care of that automatically for most of the games.
For games like Qbert, a custom joystick mapping works best, but this can easily be accomplished through the specific game config file.