I realized recently that I use the terms molecule and compound interchangeably. Someone asked me what the difference is and I said, "same thing." This answer is actually incorrect- there is a difference between molecules and compounds although many people (chemists included) use the terms interchangeably. The reason for this is that the two have many things in common.
Both molecules and compounds follow the law of definite proportions. Another way of saying this is to say that in every molecule of water you have one atom of oxygen and two atoms of hydrogen. An alternate way to state this is to say that for every 16 grams of oxygen (per molecule) you always have 2 grams o hydrogen. This is true whether you refer to molecules or compounds.
The terminology differs however when we talk about the type of bonding that occurs in molecular compounds vs other compounds. (Notice how I used the word "compound" in both terms. It implies that something molecular is a compound by nature meaning that it follows the law of definite proportions.) A molecular compound is one that only contains nonmetals (generally) and is held together by the sharing of electrons. Whole molecules might be held rigidly in place by intermolecular forces between molecules but there is never any official chemical bonding between molecules. The sharing of electrons might not be equal. This is the cause of polarity and electronegativity differences. The degree of polarity can actually be calculated on a scale of severity to rate the nature of the polar bond. A bond that has a high enough polarity or electronegativity difference between atoms is actually no longer considered a polar covalent bond but moves into the ranks of the ionic bonds.
Two atoms that have vastly differing electronegativities are bound together by forces of electricity, not the sharing of electrons. It can be thought of as a donation of electrons from one species to the other to create two charged species- positive and negative. The bond is then an electrostatic interaction. One of my students expressed it this way, "It's like the difference between lego legs and a magnet- the ionic bond is the magnet attraction." (and a compound as opposed to a molecular compound)
The "lego legs" illustration refers to the characteristic of molecular bonding in which the sharing of electrons (through overlap of orbitals) creates distinctly arranged atoms that form distinctive shapes with distinctive angles. In the "magnetic" bonding, the atoms arrange themselves to minimize repulsions and maximize attractions. In some ways the atoms all float together in magnetic attraction (as if they don't form individual compounds but one big centralized compound made up of many formula units) but if you broke the unit down into pieces it would always have the same ratio of atoms as the compound itself (due to law of definite proportions).
What a talented student! Lego legs vs magnets! I love it.