Here's what I think:
- Your (best) programmer will leave when he will get the chance
- He is currently doing more harm than good to the company
Let me explain. Every programmer in the world has an immense quantity of ego. All programmers think that they are smarter than anyone else, some programmers (including yours) believe that they are also infallible.
Why do I think he's going to leave? Obviously he's not motivated at all, and he doesn't really care about the product, which means that he doesn't care about the company's best interests on the long run, which means that he will leave you, sooner or later.
Now why do I think that he's doing more harm than good? I'm sure if you're a technical person then you can see that his productivity is very low, his code is mediocre, and he doesn't care about securing and enhancing the product. Not only that, he might be writing code that is really hard to understand or that has some subtle bugs that may impact your whole business.
Now the question, what should you do?
There is no correct answer to this, but here's what I would do. I would bring competition, I would hire another, better programmer. Not all programmers have insecurities, and some programmers are easier to communicate with than others. Hire another, better programmer, let him work with him on his code, and one of the following will happen:
- The old programmer will change his attitude completely to the better.
- The old programmer will have constant (passive-aggressive) fights with the new programmer, and may eventually quit.
I think the second alternative is much more likely than the first one.
Talking to the programmer to rectify his behavior and attitude is futile, just hire another programmer, let him learn the ins and outs of your software, and say goodbye to the old programmer (I think he will probably say goodbye before).
I suggest also to keep a distance between yourself and your old programmer, and slowly stop praising him.
I like to compare your situation to a relationship with any woman, she might be a really bad girlfriend, until you bring in competition, then either she leaves, or either she'll become the best girlfriend ever.