If it is my own code or no one else will be working on it in the near future; if it is bug free (aka: the requested functionality is in place and the user may navigate through the process unhindered); if it is for a prototype or pilot run and I am driving for the demo... All that said: I make the deadline, get paid and improve the code ASAP after first release. Else NEVER. That said... our definitions of terrible-messy-unthought-through-code might differ