Have you ever read the man-page for telnet? On my Debian system the last two lines read:<p><pre><code> BUGS
The source code is not comprehensible.
</code></pre>
That's probably one of the dividing lines. There are many programs that have "bad" source code, but which are still essential.<p>Another measure of "badness" could be how extensible, or not a program might be. Or even how many security-holes. With regard to security holes some projects such as Wordpress or Wireshark crop up too often.<p>But honestly? Most of the badly written programs aren't so bad, if you ignore a couple of outliers. If the benefits outweigh the drawbacks then the software leaves the world a better place.
WordPress, phpNuke, phpBB, most of the old PHP CMSes and E-Commerce systems. The code is dirty and hacky, but the software is useful for millions of people.
Browsing the source of games like Nethack and Battle for Wesnoth (around a decade ago) opened my eyes - sometimes code quality can seem poor but the product can be great.<p>Blender is another one that seems very ramshackle and complex. I won't go as far as saying it's poorly written, but it's a product of many contributors, including students, and yet it's an amazing piece of software.<p>This thread is not meant to be a criticism of projects, but a celebration that code quality is not the be all and end all.
Though I live and breathe it, emacs C source base is amazingly nasty. The fact that it still uses redisplay and memory dumps after integrating so many improvements over the years...
If you consider:<p>1) Most of Linux source code is composed of drivers;<p>2) Most drivers for Linux have really bad quality code, with very few exceptions;<p>Then Linux is a perfect example.