Ah, I can answer this one from my work with HTML and Unicode.
Originally "em" and "en" corresponded to the width of "M" and "n" in a typeface - thus "em-dash" is a long dash, and "en-dash" is a short dash. "Em" has since been redefined as the unit of width equal to the current point size. (Hence the common use of 1em etc. in HTML and CSS as a way to gain a consistent measurement according to the current font.) "En" is now generally half an "Em".
There's a good chance you already know all that, but to preempt what rhadin might say, the use of different sized dashes, and whether there should be spaces between the dash and the text, varies. The
Wikipedia article seems to cover it pretty well, including the intro that gives common usage.
I like the spaced en-dash for set off (as in - this was set off - from that), rather than unspaced em-dash (as in--this was set off--from that), because it looks better to my eye. To me, unspaced em-dashes always look like they are joining text rather than setting it off.
For those unaware of it, word processors like OpenOffice/LibreOffice have autocorrect option to help manage this. See
OpenOffice Wiki for example.