If your program code is ugly (too complex / too long / too much hacks), you are very likely doing it wrong.

Keep it modular, simple, and stupid.