I’ve heard many definitions, but the one below, by Kirk Knoernschild, seems closest to my heart.
Quality code is code that:
- can adapt to change
- performs well
- is error free
- is as simple as possible
- does what my customer needs
On a related not, here’s what Robert Martin, a software craftsman, has to say how to write quality code:
The only way to go really fast is to write the best code you can possibly write, with the best design you can possibly give it. Any other technique will slow you down. … In my estimation the belief that quality is an expediter rather than an impediment is what separates professionals from amateurs.