As I explain in "Commas with Compound Sentences," independent clauses joined by coordinating conjunctions are usually separated by a comma. (Of course, if you use only a comma but no coordinating conjunction, you will be committing a comma splice, which is a type of run-on sentence.) There are some occasions when the comma can be omitted between the independent clauses in a compound sentence, but usually that comma will be needed.
But compound elements within a sentence are normally not separated by commas. Any sentence element can be compounded: subjects, predicates, direct or indirect objects, complements, objects of prepositions, modifiers, etc. (To read my article about recognizing those compounded elements and not placing commas inappropriately between them, click here.)
As a general rule, then, compound sentence elements joined by simple coordinating conjunctions should not be separated by commas. The simple coordinating conjunctions are
One important exception to this "no comma with compound sentence elements" rule is that a comma normally is used to separate contrasted coordinate elements.
~I got a C on that test,not the B I was hoping for.
~Your misspellings are due to carelessness,not ignorance.
~Marian wrote slowly,but elegantly.
~Your essays should be written in ink, not pencil.
~The contestants were nervous,yet hopeful.
~You should think of your education as an opportunity, not a burden.
~I was hoping you would visit your father because you wanted to,not because someone forced you to.
~A lot of what you are doing that keeps you from getting enough sleep is a matter of choice,not necessity.