It's hard to answer this question because anyone who answers is implicitly claiming to be a great programmer instead of just a good one.<p>When I think of great programmers and think about what distinguishes them from me, I'd say it's probably their experience. The more you do it the greater you become at it. I've never looked at a project and thought to myself "wow I couldn't make that even after 10 years". I always think "I bet I can do it too if I spent the last 10 months working on it".
The same thing that distinguishes a good (fill in the blank) from a great (fill in the blank). Passion, drive, perseverance, experience, patience, brilliance, etc. If you want to be a great engineer, the problem is that you don't see yourself as a great engineer already. If you saw yourself as a great engineer, you would emulate all those wonderful words I mentioned before, because, well, that's what great engineers are. Fake it 'til you make it.
Most of the things mentioned in the comments are <i>co-factors</i>; that is, things often found alongside greatness, but not necessarily the cause of the greatness. They are also often found alongside mediocrity.<p>I prefer simple tests:<p>Bad programmer: It can't be done.<p>Mediocre programmer: It's never been done.<p>Good programmer: It can be done.<p>Great programmer: It's done.
I like the first answer from quora, but with one exception.. That being an understanding of business and priorities. Great engineers understand that ultimately, they're responsible for shipping product in a business setting.<p>In your personal open source project or side projects you can afford to be experimental and push the box, but when you're in a business setting, you need to balance the need to ship with the desire and drive to be experimental and solid. Get from point A to point B balancing risk, reward, and speed.