First off all quality of computer software is conformance to requirements and absence of bugs. Anti-patterns are common problems that happen frequently in computer programming and that should be avoided to achieve quality.
Factors of software quality
To a computer, there is no real concept of "well-written" source code. However, to a human, the way a program is written can have some important consequences for the human maintainers. Many source code programming style guides, which stress readability and some language-specific conventions are aimed at the maintenance of the software source code, which involves debugging and updating. Other issues also come into considering whether code is well written, such as the logical structuring of the code into manageable sections.
Methods to improve the quality: refactoring.
See also