Viruses are made for a variety of reasons. Some viruses have been created by disgruntled employees that want revenge on a company's product. Others are created to destructively celebrate certain holidays and raise the voice of certain religious and governmental fanatics. Sadly, those that create viruses for the challenge are misdirected individuals making poor use of their skills. These scripts often result in undesired instructions and effects.
Good programmers do a thorough check of their work prior to releasing it to the public.
You should already be practicing safe computering by not inserting program disks into your floppy drive if you do not know where they came from. And, do not execute any programs that you did not install yourself. There are numerous anti-virus programs on the market that you should be using to help protect your computer from most known computer virii.