Is this Cayley table correctly computed? If so, is it correct way of presentation of this dihedral group? Is the following table for $D_4$ correct? 
$$\begin{array}{c|c|c|c|c|c|c|c|c|} 
* & 1 & g & g^2& g^3& f& fg & fg^2 & fg^3    \\ \hline
1  & 1 & g & g^2 & g^3 & f & fg & fg^2 & fg^3 \\ \hline
g & g & g^2 & g^3 & 1 & fg^3 & f & fg & fg^2   \\ \hline
g^2 & g^2 & g^3 & 1 & g & fg^2 & fg^3 & f & fg  \\ \hline
g^3 & g^3 & 1 & g & g^2 & fg & fg^2 & fg^3 & f \\ \hline 
f & f& fg & fg^2 & fg^3 & 1 & g& g^2 & g^3 \\ \hline
fg& fg& fg^2 & fg^3 & f& g^3  & 1 & g & g^2 \\ \hline
fg^2 & fg^2 & fg^3 & f & fg & g^2 & g^3 & 1 & g \\ \hline 
fg^3 & fg^3 & f & fg& fg^2 & g & g^2 & g^3 & 1 \\ \hline 
\end{array}$$

A presentation of $D_4$ is $\langle g,f \mid g^4=1, f^2=1, gf=fg^{-1}\rangle$. So we have the $8$ elements $\lbrace 1,g,g^2,g^3,f,gf=fg^3,g^2f=fg^2,g^3f=fg\rbrace$, and the multiplication table follows from the relations - as far as I can see, your table is correct.
