Always use Uninterruptible Power Supply (UPS) for your Mac Desktop
Do not install Mac Operating System updates on a malfunctioning desktop/laptop
Avoid installing a third party software
Always eject the external storage devices after disconnecting them or turning them off
Backup your data at regular intervals on any other storage device
Keep your anti-virus up-to-date