There is sometimes confusion between mulch and compost.
Mulch refers to material that goes on top of the ground. Mulch can be natural such as bark, gravel, or compost, or manmade such as landscape fabric or recycled tire rubber mulch. Never use regular plastic except on a temporary basis since water will pool, stink and breed mosquitoes. Mulches such as bark and compost can feed the soil but need to be renewed regularly. Gravel and landscape fabric can last longer although landscape fabric is usually covered with something such as bark or gravel. Gravel can collect trash and weeds and reflect heat back to the house or yard which may or may not be desirable.
The purposes of mulch can include water retention, soil cooling, soil warming, weed suppression, soil enrichment, and/or frost protection for plant roots or soil.
When using rock or rubber mulches I would recommend using heavy duty landscape fabric underneath. The cheaper plastic fabrics do not hold up as well and the rubber mulches will be difficult to remove if they get mixed in with your soil.
Landscape fabric does not prevent weeds – it just reduces them. Soil and weed seeds can accumulate on top allowing weeds to begin growing. As soon as you see a weed take care of it so you do not end up with a weed patch on top of your landscape fabric.
Compost is decomposed organic matter or manures. The best types of compost are those made with a variety of materials including manures of herbivores (chickens, sheep, rabbits, etc), leaves, straw, vegetable peelings, and other plant material. For more information on home composting see my blog entry.
Compost can be used as mulch but is often also mixed with soil or applied to the surface just for the purpose of improving soil. Since compost is organic matter it can improve your soil whether it is sandy, clay, or just lacking in nutrients. Peat moss is sometimes used but has no nutritional value, is usually more expensive, and non renewable so compost is a better choice. I like to add compost to my gardens, flower beds, lawn, and potted plants. Our soils in Utah are lacking in organic matter so compost is a wonderful thing to add for soil improvement. Compost is the main component of a Square Foot Garden mix.