I am not too sure if there is a best practice, but here are two approaches.
The first method uses the url command to automatically hyphenate at certain points such as for example dots. The second one uses a discretionary (with or without a hyphen). Whatever you choose, I am sure that you will need to give TeX a helping hand, that is you cannot avoid doing some manual editing in the end.
In the example I colored the word and used a libertine family font.
\documentclass{report}
\usepackage{geometry,xcolor,url}
\usepackage{libertine}
\geometry{paperwidth=130mm, paperheight=60mm,
textwidth=95mm, textheight=50mm}
\def\+{\discretionary{}{-}{}}
\def\textinline#1{{\usefont{T1}{fxb}{m}{n}\selectfont\textcolor{purple}{\url{#1}}}}
\def\ttextinline#1{{\usefont{T1}{fxb}{m}{n}\selectfont\textcolor{purple}{#1}}}
\begin{document}
Java programmers tend like to use very long variable names as compared to other
languages. A string such as \textinline{this.class.VariableName}
will get split rather than produce an overfull box?
Java programmers tend like to use very long variable names as compared to other
languages. A string such as \ttextinline{this.classVari\+ableName}
will get split rather than produce an overfull box?
\end{document}
