One often-overlooked aspect is that for business purposes, the first priority is to have something that gets the job done. Release early and often, then iterate towards perfection - but only for what your customer wants.
This generally means that its not great, but it works. If time permits, it is great to tidy / refactor bad code, but this is not always possible. Reminds me of an item posted a couple of weeks ago - "confessions of a terrible programmer"