[Tex/LaTex] If document class is equal to something then do not use package

conditionalsdocument-classespackages

I am trying to create a file which includes common packages and macros I use. It is something like this.

commonDefinitions.tex

 \interdisplaylinepenalty=2500
 \usepackage{algorithmic}

 \usepackage{cite} 
 \usepackage{appendix}
 ... other packages and macros

But some packages clash with each other in combinations. For example when I try to use

 \documentclass[journal]{IEEEtran}
 \usepackage{appendix}

It gives error since IEEEtran already created command appendix.

I would like to get some solution to this problem something like below.

if document class is not IEEEtran 
   \usepackage{appendix}
end if

Best Answer

A way is

\makeatletter
\@ifclassloaded{IEEEtran}{}{\usepackage{appendix}}
\makeatother

But I believe that documents written for submission should not have any reference to conflicting packages (and so tricks like this one). How would you use the commands provided by appendix if the document class is IEEEtran?