"To the popular press, 'hacker' means someone who breaks into computers. Among programmers it means a good programmer. But the two meanings are connected. To programmers, 'hacker' connotes mastery in the most literal sense: someone who can make a computer do what he wants--whether the computer wants to or not.
"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.
"Believe it or not, the two senses of 'hack' are also connected. Ugly and imaginative solutions have something in common: they both break the rules. And there is a gradual continuum between rule breaking that's merely ugly (using duct tape to attach something to your bike) and rule breaking that is brilliantly imaginative (discarding Euclidean space)."
--Paul Graham, "The Word 'Hacker'," 2004 April