This is called the octet rule and is useful when qualitatively discussing the molecular structures of main group compounds. Of course, this rule is not applied to a hydrogen molecule, H2, but is applicable to covalent molecules, such as simple two-atomic molecules O2 or CO and even to complicated organic compounds.