When to use a \mbox or a tilde for words that have to stay together

I am new to La Tex and wondering when to use a tilde, or a \mbox? A tilde prohibits a line break and so does \mbox, so when to use one or the other? For example, should I use:

\mbox{words to kept together}


or,

 words~to~be~kept~together

-
– Peter Grill Jul 1 '12 at 18:31

There are probably other reasons, but I believe the space given by a ~ can stretch or shrink as other spaces in the line, while an \mbox gives you a fixed box, with fixed spaces.

And words joined with ~ can still be hyphenated, while an \mbox won't.

\documentclass[a5paper]{article}
\sloppy
\begin{document}
A text with~some~unbreakable~spaces might stretch to jusssssssssssstify the line.
A text \mbox{with some unbreakable spaces} might stretch to jusssssssssssstify the line.
A~text~with~unbreakable~spaces~might~be~hyphenated~if~necessary.
\mbox{A text with unbreakable spaces might be hyphenated if necessary.}
\end{document}


-
I'd add that \mbox{...} is very useful for avoiding line breaks in a particular word. – egreg Jul 2 '12 at 10:45