12

I use the term all the time... but I was just sort of thinking that I don't really have a solid denotational sense behind the term (or at least the term in the sense I want to discuss here). I'm interested in the sense of the word related to code, not the anthropomorphic idea. I'm also not interested here in the sense of the word related to intentional malicious computing (i.e. a hack to unlock secret powers in a game). What I want to explore is what it means to 'hack' in terms of writing software to solve a problem

wikipedia's def of 'hack' to me is a bit vague, but a decent starting point. It considers a hack

  • can refer to a solution or method which functions correctly but which is "ugly" in its concepion
  • works outside the accepted structures and norms of the environment
  • is not easily extendable or maintainable
  • can be slang for "copy", "imitation" or "rip-off."

These traits of a hack conform to my usage of the word--when applied to code it is always a term of derision. To my mind, a hack

  • Is likely to be difficult to maintain & hard to understand in the context of the rest of the code.
  • Is likely to cause failure of the app.
  • tends to indicate a poor understanding by the coder either of the problem space, usage of the language or both
  • tends to be the byproduct of aggressive schedules
  • suggests potential changes in requirements that have not been fully incorporated into the architecture of the solution (requiring an 'inorganic' workaround).
  • smells

all bad, bad, bad. To me, a hack in this sense is always negative, indicating either lack of time, incompetence, or sloth on the part of the developer, though a decent percentage of hacks must be written to compensate for ill-conceived designs or systems that have gained requirements which their original design cannot handle 'organically'.

I don't think I've really captured it totally though--it's like pornography a bit: I can't really define it, but I know it when I see it. So I ask you: what does it mean to 'hack' when you are trying to solve a problem in software?

AstroCB
  • 12,337
  • 20
  • 57
  • 73
Kevin Won
  • 7,156
  • 5
  • 36
  • 54
  • 4
    You can't define pornography? – Michael Robinson Aug 19 '10 at 23:50
  • 7
    if it involves gerbils, high heels and a large quantity of strawberry blancmange, it's probably pornography! – Mitch Wheat Aug 19 '10 at 23:52
  • 3
    See [here](http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered/185106#185106) and [here](http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered/189859#189859) and [here](http://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered/185156#185156). – Robert Harvey Aug 19 '10 at 23:52
  • man. 13 words out of the whole post you fixate on ;-) – Kevin Won Aug 19 '10 at 23:53
  • What's pornography and what's art? – Nate Aug 19 '10 at 23:54
  • 1
    Community wiki? (Alternatively, can someone suggest an opinion **I** can ask about to gain a ton of reputation quickly?) – Stephen P Aug 20 '10 at 01:06

8 Answers8

17

I've always preferred Paul Graham's definition:

To add to the confusion, the noun "hack" also has two senses. It can be either a compliment or an insult. It's called a hack when you do something in an ugly way. But when you do something so clever that you somehow beat the system, that's also called a hack. The word is used more often in the former than the latter sense, probably because ugly solutions are more common than brilliant ones.

Brian Willis
  • 22,768
  • 9
  • 46
  • 50
6

From the Jargon File, the glossary of hacker slang:

The Meaning of ‘Hack’

“The word hack doesn't really have 69 different meanings”, according to MIT hacker Phil Agre. “In fact, hack has only one meaning, an extremely subtle and profound one which defies articulation. Which connotation is implied by a given use of the word depends in similarly profound ways on the context. Similar remarks apply to a couple of other hacker words, most notably random.”

Hacking might be characterized as ‘an appropriate application of ingenuity’. Whether the result is a quick-and-dirty patchwork job or a carefully crafted work of art, you have to admire the cleverness that went into it.

An important secondary meaning of hack is ‘a creative practical joke’. This kind of hack is easier to explain to non-hackers than the programming kind.

Community
  • 1
  • 1
polygenelubricants
  • 376,812
  • 128
  • 561
  • 623
  • I think you are talking about another meaning of the term--i.e. hacking a game to give you more gold. I'm ashamed of some of my hacks that are the exact opposite of 'an appropriate application of ingenuity'--I did it just to get'r'done – Kevin Won Aug 20 '10 at 00:26
  • 1
    @Kevin: I'm quoting as official a source as possible. If this is not what you want to hear, that's because the question is subjective/argumentative. – polygenelubricants Aug 20 '10 at 01:10
  • 1
    I'm suggesting that this is applies to the other sense of the word--not that it's inaccurate. – Kevin Won Aug 20 '10 at 01:51
3

When I think of "hack", I think of it as being a non-expected workaround to solve a problem, not necessarily a bad thing. Creative, innovative, and well-placed. "Hack" can apply to more than just computers, though I seldom hear it used that way.

Brian
  • 4,023
  • 8
  • 29
  • 36
  • thought about how Spolsky describes the 'duct tape programmer' (http://www.joelonsoftware.com/items/2009/09/23.html) which I think is the point you make. To me there is a difference between the two. One is expedient and clear (duct tape), the other is ill-conceived and unclear. – Kevin Won Aug 19 '10 at 23:56
2

Too often "hack" simply means: "Not the way I would do it."

Robusto
  • 31,447
  • 8
  • 56
  • 77
1

This topic will turn into something like a question about Love. Everyone's gonna have their own definition. The best way to know the proper (default) definition is in the dictionary

Martin Ongtangco
  • 22,657
  • 16
  • 58
  • 84
1

It's when you've stepped out of the idiomatic, natural, sensible and (sometimes) supported ways of doing something in a given language/framework/etc.

Sometimes that's a stroke of genius, usually it's an act of idiocy, occasionally it's one disguised as the other, and on rare occasions it's both.

(Incidentally, the judge who coined that statement about pornography you quote later retracted in making another ruling).

Jon Hanna
  • 110,372
  • 10
  • 146
  • 251
1

When I use the term 'hack' it usually refers to a solution to a problem that was done usually in response to a pressing issue, and so not a lot of thought went into it in regards to the overall design of the application. Sometimes it works out, sometimes not so much, and sometimes it turns out to be a work of genius. But mainly, it's an admitted temporary solution that (hopefully) gets refactored and refined when possible.

David Hoerster
  • 28,421
  • 8
  • 67
  • 102
0

Here's a great sentence I saw about the difference between hacking and scamming and it says, "Hacking attacks are successful when the criminal knows how a particular computer system works. Scams are successful when the perpetrator knows how the human brain works.", which brings the idea out that to hack into something, you need to have a deep understanding of how it works.

TypeURL
  • 1
  • 1