Do you need a diode for a dc motor?

I'm just learning how to program arduinos and I went out and got a hobby dc motor to to hook up to the arduino. However, in all the tutorials I can find they use diodes and transistors. I have transistors, and understand what their use is, but I dont have any diodes. Do you need them to use dc motors on arduino? And what is their purpose

When current flows in a coil of wire (ex. motor, inductor, relay control), a magnetic field is created.
When current stops flowing in a coil the magnetic field collapses and creates some additional brief current flow at potentially very high voltage. The diode lets this extra current flow be dissipated back in the coil instead of in the controlling electronics.

Transistor are used for switching the motors while diodes are use for safety purpose.
The back emf produced the motor may be enough to blow up arduino electronic components.
Thus,to prevent this a protection diode is put to design.
Generally used diodes are IN4184,IN4007 (1 watt).

If your motor is going to be running in both directions you can't use just a single diode to bypass back-EMF; when going in one direction that diode would be a dead short, the motor won't go, and you might burn up the diode and whatever is controlling the motor (transistor, relay H-bridge etc.). For bi-directional protection you need a pair of diodes "head-to-head" (or "tail-to-tail", makes no difference). Then, one diode blocks current from bypassing the motor in one direction, and the other diode when it's reversed. Or, for a few cents more, you can buy a TVS (transient voltage suppressor) that will not only protect from back EMF like a pair of diodes, but will protect from supply voltage surges. [Before picking a TVS, it's worthwhile to read a few data sheets or application notes as the manufacturers do try to tell us how to size them properly.]
Ciao,
Lenny