what i do is throw down a simple beat using random drum samples I do this to establish time, this enables me to create a melody much more easily. I have the dums playin and I just fiddle with my keyboard until I got something that sounds right, then I change the drum samples and start tweaking them.
however when I am using a sample, I tend to do drums after because the sample has a certain vibe to it.
ITs all up to the you, the producer, establish a process that fits you and stay with it, be consistent.