Live data from Hacker News

What happens when you search 'ugly hack' in GitHub

github.com

31–40 of 69 posts

Re: What happens when you search 'ugly hack' in GitHub

#31

Haha: https://www.dropbox.com/s/j7rwshax2e9zwln/Screenshot%202014-... Not even PHP can come within a factor of 5 of C when it comes to ugly hacks. EDIT: And its not exactly like there is a bias at work: http://goo.gl/ZezFiP

There is a bias because there is more C code. The number of repositories doesn't equal to the quantity of code and if you search for general things that are used in both languages frequently then there is always more C results, for example:

https://github.com/search?p=1&q=if+&ref=searchresults&type=C...

https://github.com/search?p=1&q=return+&ref=searchresults&ty...

Re: What happens when you search 'ugly hack' in GitHub

#32
post #31

Haha: https://www.dropbox.com/s/j7rwshax2e9zwln/Screenshot%202014-... Not even PHP can come within a factor of 5 of C when it comes to ugly hacks. EDIT: And its not exactly like there is a bias at work: http://goo.gl/ZezFiP

There is a bias because there is more C code. The number of repositories doesn't equal to the quantity of code and if you search for general things that are used in both languages frequently then there is always more C results, for example: https://github.com/search?p=1&q=if+&ref=searchresults&type=C... https://github.com/search?p=1&q=return+&ref=searchresults&ty...

Fair enough. If there is a bias towards C I would guess it was more due to the situations in which C gets used, than C itself. Talking to a friend who has to try and get the same C/C++ codebase to compile for 6 different platforms (consoles) has been an eye opening experience. That kind of environment is like a slightly warm petri dish for ugly hacks.

Re: What happens when you search 'ugly hack' in GitHub

#35
post #17

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 peo…

It's a worthy practice indeed. Bowing to the virtue of taking on some technical debt instead of deluding oneself that all code must be Pristine.

Re: What happens when you search 'ugly hack' in GitHub

#36
post #17

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 peo…

In my experience “ugly hack” means any technical debt that spans lines of code, as opposed to components of a system.

(Edited for clarity.)

Re: What happens when you search 'ugly hack' in GitHub

#37
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.

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.

[EDIT: oops, initially I failed to paste in the actual data.]

       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
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.

Tentative meta-conclusion: these numbers have no value beyond idle amusement. But they idly amused me, so that's OK.

(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.)

Re: What happens when you search 'ugly hack' in GitHub

#40
post #17

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 peo…

In my experience “ugly hack” means any technical debt that spans lines of code, as opposed to components of a system. (Edited for clarity.)

It's actually too general. What I mean with component here can be anything from a line of code to a class hierarchy.

In a sense, using the word 'component' here was an ugly hack. I should have gone for the proper solution and properly define it. You see now that it breaks down when the interpretation changes.

Post reply on HN