Before disconnecting the cable(s), first turn the ignition to the OFF position. This will prevent a draw on the battery which could cause arcing (electricity trying to ground itself to the body of a vehicle, just like a spark plug jumping the gap) and, of course, damaging some components such as the alternator diodes.
Always disconnect the negative (–) battery cable first. This will prevent accidentally grounding the positive (+) terminal to the body of the vehicle when disconnecting it, thereby preventing damage to the above mentioned components.
When the battery cable(s) are reconnected (negative cable last), be sure to check that the lights, windshield wipers and other electrically operated safety components are all working correctly. If the vehicle contains an Electronically Tuned Radio (ETR), don’t forget to also reset the radio stations and clock.