An atom's tendency to become stable is associated with its tendency to attract electrons, resulting to the formation of compounds. This is due to the rule of valency which states that a stable atom consists of 8 electrons. So atoms with less than 8 electrons tend to attract electrons and form compounds.