I love the term 'ugly hack'. It's a very short way of saying 'a solution for a problem that assumes too much of the current context in which this component is called, and is guaranteed to break when the context changes'. It also implies 'this is intended to be temporary because I don't feel like doing the proper solution at this moment' which is accompanied with the intent 'we should fix this later' although most people who write it also have the wisdom that that almost never happens.<p>All of this is expressed in just two words :)
Some results normalized by overall language popularity. Specifically, the entry in row R and column C is 1000 * (hits for C in language R) / (hits for "the" in language R) or "---" if either the numerator or denominator was small enough not to make the top-10 list on github.<p>All the scraping was done by hand and the numbers rounded to a limited number of places in the process, so there may very well be mistakes.<p>[EDIT: oops, initially I failed to paste in the actual data.]<p><pre><code> ugly hack ugly beautiful lol wtf buggy
xml --- --- 14.330 72.775 2.489 ---
c 6.348 35.421 0.670 0.768 3.650 32.009
html 1.359 9.001 34.791 4.233 3.095 5.870
rb --- --- --- 4.483 3.151 ---
py 9.051 35.614 28.506 --- 11.135 15.066
php 3.731 8.333 1.781 39.037 1.792 3.754
c++ 2.851 12.507 --- 0.501 102.657 7.579
js 6.850 16.826 2.643 2.635 7.406 29.761
</code></pre>
Tentative conclusions: Python is ugly-hack-iest and (almost exactly tied with C) ugliest; HTML is most beautiful with Python a close second, XML is lolliest, C++ is WTFiest, and C is buggiest.<p>Tentative meta-conclusion: these numbers have no value beyond idle amusement. But they idly amused me, so that's OK.<p>(The weirdest result of the lot, to me, is XML coming top for "lol". If you do the search and click on "XML" on the left you'll see why it is. Lots of instances of what I think are the same file, full of "&lol;" entities. LOL, that's pretty ugly. WTF? An ugly hack, I guess.)
Pretty interesting/amusing to see the language breakdown of various words (with big grains of salt):<p><a href="https://github.com/search?q=beautiful&type=Code" rel="nofollow">https://github.com/search?q=beautiful&type=Code</a><p><a href="https://github.com/search?q=ugly&type=Code" rel="nofollow">https://github.com/search?q=ugly&type=Code</a><p><a href="https://github.com/search?q=lol&type=Code" rel="nofollow">https://github.com/search?q=lol&type=Code</a><p><a href="https://github.com/search?q=wtf&type=Code" rel="nofollow">https://github.com/search?q=wtf&type=Code</a>
I love this one - someone made Java annotation for ugly hacks: <a href="https://github.com/benpage26/libxron/blob/016dd953a54eacada2c8a00ed1592dee3d63a8be/src/main/java/org/xron/annotations/UglyHack.java" rel="nofollow">https://github.com/benpage26/libxron/blob/016dd953a54eacada2...</a>
I'd be curious to see if there's a relationship between 'ugly hack' in code commits and the languages being used (though it'd probably say more about the programmer than the language). The bar chart on the left of the page hints that it's possible, but would have to be normalised.<p>My hypothesis is there'd be no real difference, but it would be fun to explore nonetheless.
Another fun search on GitHub - looking for the code paradox i.e. this should "never happen".<p><a href="https://github.com/search?l=c&p=7&q=never+happen&ref=searchresults&type=Code" rel="nofollow">https://github.com/search?l=c&p=7&q=never+happen&ref=searchr...</a>
Amusingly, a lot of Python's hits appear to be hacking the import logic.<p>[0]: <a href="https://github.com/search?l=python&q=ugly+hack&ref=cmdform&type=Code" rel="nofollow">https://github.com/search?l=python&q=ugly+hack&ref=cmdform&t...</a>
It looks like ugly hacks are far more popular than clever ones.<p><a href="https://github.com/search?q=clever+hack&type=Code&ref=searchresults" rel="nofollow">https://github.com/search?q=clever+hack&type=Code&ref=search...</a>
Haha:<p><a href="https://www.dropbox.com/s/j7rwshax2e9zwln/Screenshot%202014-07-17%2011.13.10.png" rel="nofollow">https://www.dropbox.com/s/j7rwshax2e9zwln/Screenshot%202014-...</a><p>Not even PHP can come within a factor of 5 of C when it comes to ugly hacks.<p>EDIT: And its not exactly like there is a bias at work: <a href="http://goo.gl/ZezFiP" rel="nofollow">http://goo.gl/ZezFiP</a>
Search for "temporary fix" <a href="https://github.com/search?q=temporary+fix&type=Code&ref=searchresults" rel="nofollow">https://github.com/search?q=temporary+fix&type=Code&ref=sear...</a>. 3 million plus and counting :)
Some hacks are just beautiful!
<a href="https://github.com/search?q=%22beautiful+hack%22&ref=searchresults&type=Code" rel="nofollow">https://github.com/search?q=%22beautiful+hack%22&ref=searchr...</a>
I was not surprised to see tex (even though it is not a popular language on GitHub). It seems that one have to resort to (ugly) hacks when dealing with it.<p>(That said, I love its fruits.)
it's even better when you search for "temporary hack"<p><a href="https://github.com/search?q=temporary+hack&type=Code&ref=searchresults" rel="nofollow">https://github.com/search?q=temporary+hack&type=Code&ref=sea...</a>