Here's my personal view on it:
Many times the bass is a product of the melody. You can start out with a good melody, but it won't go anywhere without a bass line. Think of the melody as planning a trip or vacation. Then, think of the bass as the vehicle that can get u there.
The bass on the other hand can stand alone if necessary.