I suck, and I must mention this every time I post, but here's what I do.
I write a melody first... then I write a bass line with chords in mind. I might even write in figured bass for them. Then once I do all that, I'll go back and I write the harmonies in. I want to make sure that my melody is not formed by the chords, but that the chords are formed by the melodies.
But I'm not a real composer, so don't listen to me.
(Hey, look, it's a post in ternary form. suck-advice-suck :P )