Great question. Ask it to n programmers and get n^2 responses. This could easily be the subject for another post or even a book. Just off the top of my head in no particular order:
- understands the problem at hand before writing any code
- uses the right tool for the right job
- follows accepted standards and protocols without sacrificing creativity
- names variables & functions what they actually are for the next programmer
- anticipates what could go wrong before relying on a debugger or testing
- understands the underlying architecture and how to best utilize it
- never writes the same code twice
- never writes in 150 lines that which could be written in 100 lines
- Poor code: uncommented. Mediocre: commented. Good: doesn't need comments.
- understands the entire code life cycle & writes it to last
- has pity on the poor soul who has to maintain it & leaves a clue or 2
- writes flexibly enough to be easily changed before the project is done
I could go on and on, but you get the idea. In general:
A good programmer writes it right, once, in a week.
A mediocre programmer writes it OK, in 2 months, and then futzes with it forever.
A bad programmer never gets it done.