For this TikZ figure, the shorten statements keep the tail of the top-most arrow from colliding with the input node and similarly the
head of the bottom-most node from colliding with the output node.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric}
\begin{document}
\begin{tikzpicture}[>=stealth]
\node [draw] (compiler) {Compiler};
\node [coordinate, above of=compiler] (input) {};
\node [coordinate, below of=compiler] (output) {};
\draw [->, shorten <=0.5em] (input) node {source program} -- (compiler);
\draw [->, shorten >=0.5em] (compiler) -- (output) node {target program};
\end{tikzpicture}
\end{document}
The output of the above code is,
Is there a more appropriate which does not involve setting spacing by hand but rather an approach that resolves this issue automatically?
I've been unsuccessful in finding any examples similar to this figure. Most diagrams I have found have arrows running in the horizontal direction and the text hovering above the arrows.

