Atoms bond to get a full outer shell. Metals and non-metals transfer electrons; non-metals share them.