TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

What happens when you search 'ugly hack' in GitHub

73 pointsby BaltoRouberolalmost 11 years ago

27 comments

DCKingalmost 11 years ago
I love the term &#x27;ugly hack&#x27;. It&#x27;s a very short way of saying &#x27;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&#x27;. It also implies &#x27;this is intended to be temporary because I don&#x27;t feel like doing the proper solution at this moment&#x27; which is accompanied with the intent &#x27;we should fix this later&#x27; 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 :)
评论 #8047118 未加载
评论 #8046910 未加载
评论 #8046901 未加载
评论 #8048328 未加载
评论 #8047746 未加载
gjm11almost 11 years ago
Some results normalized by overall language popularity. Specifically, the entry in row R and column C is 1000 * (hits for C in language R) &#x2F; (hits for &quot;the&quot; in language R) or &quot;---&quot; 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&#x27;s OK.<p>(The weirdest result of the lot, to me, is XML coming top for &quot;lol&quot;. If you do the search and click on &quot;XML&quot; on the left you&#x27;ll see why it is. Lots of instances of what I think are the same file, full of &quot;&amp;lol;&quot; entities. LOL, that&#x27;s pretty ugly. WTF? An ugly hack, I guess.)
评论 #8046956 未加载
评论 #8047035 未加载
评论 #8047191 未加载
评论 #8047080 未加载
评论 #8047138 未加载
namuolalmost 11 years ago
Pretty interesting&#x2F;amusing to see the language breakdown of various words (with big grains of salt):<p><a href="https://github.com/search?q=beautiful&amp;type=Code" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?q=beautiful&amp;type=Code</a><p><a href="https://github.com/search?q=ugly&amp;type=Code" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?q=ugly&amp;type=Code</a><p><a href="https://github.com/search?q=lol&amp;type=Code" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?q=lol&amp;type=Code</a><p><a href="https://github.com/search?q=wtf&amp;type=Code" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?q=wtf&amp;type=Code</a>
评论 #8046789 未加载
评论 #8046778 未加载
评论 #8046959 未加载
评论 #8046743 未加载
watwutalmost 11 years ago
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:&#x2F;&#x2F;github.com&#x2F;benpage26&#x2F;libxron&#x2F;blob&#x2F;016dd953a54eacada2...</a>
评论 #8047378 未加载
jamesk14022almost 11 years ago
&quot;Fix ugly hack to at least be consistent with itself&quot;, haha, this is brilliant.
amirmcalmost 11 years ago
I&#x27;d be curious to see if there&#x27;s a relationship between &#x27;ugly hack&#x27; in code commits and the languages being used (though it&#x27;d probably say more about the programmer than the language). The bar chart on the left of the page hints that it&#x27;s possible, but would have to be normalised.<p>My hypothesis is there&#x27;d be no real difference, but it would be fun to explore nonetheless.
评论 #8046687 未加载
评论 #8046668 未加载
mysterywhiteboyalmost 11 years ago
Another fun search on GitHub - looking for the code paradox i.e. this should &quot;never happen&quot;.<p><a href="https://github.com/search?l=c&amp;p=7&amp;q=never+happen&amp;ref=searchresults&amp;type=Code" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?l=c&amp;p=7&amp;q=never+happen&amp;ref=searchr...</a>
paddyoloughlinalmost 11 years ago
Amusingly, a lot of Python&#x27;s hits appear to be hacking the import logic.<p>[0]: <a href="https://github.com/search?l=python&amp;q=ugly+hack&amp;ref=cmdform&amp;type=Code" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?l=python&amp;q=ugly+hack&amp;ref=cmdform&amp;t...</a>
KhalPandaalmost 11 years ago
It looks like ugly hacks are far more popular than clever ones.<p><a href="https://github.com/search?q=clever+hack&amp;type=Code&amp;ref=searchresults" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?q=clever+hack&amp;type=Code&amp;ref=search...</a>
评论 #8046675 未加载
评论 #8046652 未加载
hugofirthalmost 11 years ago
Haha:<p><a href="https://www.dropbox.com/s/j7rwshax2e9zwln/Screenshot%202014-07-17%2011.13.10.png" rel="nofollow">https:&#x2F;&#x2F;www.dropbox.com&#x2F;s&#x2F;j7rwshax2e9zwln&#x2F;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:&#x2F;&#x2F;goo.gl&#x2F;ZezFiP</a>
评论 #8046726 未加载
评论 #8046820 未加载
wildmXranatalmost 11 years ago
Search for &quot;temporary fix&quot; <a href="https://github.com/search?q=temporary+fix&amp;type=Code&amp;ref=searchresults" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?q=temporary+fix&amp;type=Code&amp;ref=sear...</a>. 3 million plus and counting :)
评论 #8047355 未加载
zmk_almost 11 years ago
Some hacks are just beautiful! <a href="https://github.com/search?q=%22beautiful+hack%22&amp;ref=searchresults&amp;type=Code" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?q=%22beautiful+hack%22&amp;ref=searchr...</a>
miohtamaalmost 11 years ago
Maybe some ducklings too?<p><a href="https://github.com/search?q=ugly+duck&amp;type=Code&amp;ref=searchresults" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?q=ugly+duck&amp;type=Code&amp;ref=searchre...</a>
staredalmost 11 years ago
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.)
buddhaalmost 11 years ago
&quot;dirty fix&quot; <a href="https://github.com/search?q=dirty+fix&amp;type=Code" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?q=dirty+fix&amp;type=Code</a>
diminotenalmost 11 years ago
A modern-day batman might do this search and then submit pull requests which fix the &quot;ugly hacks&quot;.
xvirkalmost 11 years ago
it&#x27;s even better when you search for &quot;temporary hack&quot;<p><a href="https://github.com/search?q=temporary+hack&amp;type=Code&amp;ref=searchresults" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;search?q=temporary+hack&amp;type=Code&amp;ref=sea...</a>
pnngndclsngalmost 11 years ago
Simple question: does &quot;ugly hack&quot; mean &quot;a quick fix before relase&quot; ?
评论 #8046763 未加载
karlcoelho1almost 11 years ago
I love how Ruby isn&#x27;t even included in the list. <i></i>RUBY THE BEST<i></i>
aadlanialmost 11 years ago
No ugly hacks in ruby! that&#x27;s a great news.
jonhelleralmost 11 years ago
Surprised CSS isn&#x27;t on the top of this list
JetSpiegelalmost 11 years ago
400k results for C, the next one is 40k for PHP
miohtamaalmost 11 years ago
Looks like Ruby doesn&#x27;t have ugly hacks.
nXqdalmost 11 years ago
How about &#x27;for now&#x27; :D
JimmaDaRustlaalmost 11 years ago
Wait...you mean...I find the words &quot;ugly hack&quot; in source files across thousands of projects on GitHub?
n0bodyalmost 11 years ago
I have no idea why this is on the front page.
评论 #8046805 未加载
kviranialmost 11 years ago
Mostly C!