A melody involves someone playing different notes that have different pitches while a harmony is when someone plays different notes simultaneously. People creating music may combine melody and harmony in both the instrumental and the vocal component.
Melody and harmony are not the only things musicians consider because they also consider rhythm and pulse. Rhythm involves the combination of the notes and this may or may not go along with the beat. The notes of rhythm are often of varying durations. Pulse refers to a periodic beat that is constant and implicit. When people can clap along to a part of the song, they are doing this to the pulse of the song.