Lets look at the two main types of bonds and the underlying principle of chemical bonding, which is the tendency for electrons to distribute themselves in space around atoms so as to lower the total energy in the group.
The Octet Rule
When atoms join up with other atoms to form compounds they like to find a configuration with the lowest possible energy. If the total energy level of a group of atoms is lower than the sum of the energies of the individual atoms, they bond together and become lower in energy.
An atom's energy configuration is mainly controlled by the distribution of its electrons. Most importantly for chemical bonding, the outermost shell of electrons orbiting an atom is known as the valence shell, and its completeness determines bond formation and the reactivity of that atom.
Valence shells follow the octet rule, which states that the most stable lowest-energy configuration is for the shell to have eight electrons. The elements that already have eight electrons in their outermost shells are noble gases, including helium, neon, and argon. Also known as the inert gases, these are very unreactive, as they have stable, full valence shells. As a general rule in chemical bonding, electrons will try to transfer themselves to achieve the valence shell configuration of the nearest noble gas. The ability of electrons to transfer is key to bond formation.
Give and Take
Chemists discovered the two types of chemical bond, ionic and covalent, when testing solutions for their electrolysis properties. Some compounds dissolve in water to produce conductive solutions, known as electrolytes, while others don't - these solutions are known as non-electrolytes.
In an ionic bond one atom transfers one or more electrons to another atom. The donating atom sheds its "incomplete" outermost electron shell, so that the "complete" shell beneath becomes the new valence shell. The receiving atom fills up its outer shell so that it becomes complete.
For instance, when sodium and chlorine atoms bond to form sodium chloride (NaCl), or table salt, the sodium atom loses one electron to achieve a neon-like arrangement of its electrons; the chlorine atom gains an electron to achieve an argon-like arrangement. As a result, the atoms become ions - a sodium ion that is positively charged (a cation), and a chlorine ion that is negatively charges (an anion). So the more accurate chemical formula for table salt is Na+Cl-. There's an electrostatic attraction between positive and negative ions, and this binds the particles together in an ionic compound.
In a covalent bond two atoms share a pair of electrons - the electrons basically take up a new orbit encompassing both atoms. For example bromine exists in nature as a diatom (Br2) because it's seeking to gain a full krypton-like valence shell. A single bromine atom has seven electrons in its outermost or valence shell; to become like krypton, it needs eight, so two bromine atoms share an electron pair, allowing each to fill its octet and achieve a stable low-energy configuration.
This is an excerpt from:
Do chemical compounds confuse you? Are you allergic to atoms and muddled by molecules? Then it's time to pick up Incredible Elements a Totally Non-scary to chemistry and why it matters