TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Is there evidence that drugs can help programmers produce “better” code?

103 点作者 pw7超过 12 年前

35 条评论

derefr超过 12 年前
You tend to use the very specific phrase "nootropic drugs" to talk about drugs which help with productivity or creativity or some other aspect of working life. Asking whether there is evidence on nootropics, is just asking whether there are any heavily-tested nootropics. Asking anything else--to lex it out, whether "drugs that have no productivity-enhancing aspect, enhance productivity" is just playing the fool to incite extremely subjective flamewars.<p>So, let's avoid that, and just focus on nootropics. Is there evidence that they work? Depends on the drug. We have drugs (caffeine, theanine) that are in foods we've been consuming since the beginning of civilization, so we've heavily researched those and are pretty confident in what they do.<p>On the other hand, new, synthetic compounds, like modafinil, are only really created and pushed through FDA approval if there can be found some sort of therapeutic, non-nootropic purpose in their use: in modafinil's case, treating narcolepsy. This means that their use <i>as nootropics</i> is much less well-researched, and consists mainly of anecdata (however much there is) shared over the internet.<p>The best you'll find, I think, in terms of data for efficacy of various drugs, is people who have set out to do double-blind studies on themselves: <a href="http://www.gwern.net/Nootropics" rel="nofollow">http://www.gwern.net/Nootropics</a><p>After reading data-points like these, you might be convinced to try some of them on your own. But be aware that people's body-chemistries can vary widely--especially where things affecting neurochemical balance are concerned--so everyone's reactions to these will still be different. Not in a sense of a "bad trip", usually; just that some things which other people swear by might not have much of an effect on your particular chemistry. So, the best thing to do, as in most situations: first research, then experiment.
评论 #4720639 未加载
评论 #4720738 未加载
pchivers超过 12 年前
From what I understand there is only one study on the relationship between creativity and LSD:<p><i>Psychedelic agents in creative problem-solving: a pilot study.</i> Harman WW, McKim RH, Mogar RE, Fadiman J, Stolaroff MJ. Psychol Rep. 1966 Aug;19(1):211-27.<p><a href="http://en.wikipedia.org/wiki/Psychedelics_in_problem-solving_experiment" rel="nofollow">http://en.wikipedia.org/wiki/Psychedelics_in_problem-solving...</a><p>The results suggested that LSD has a positive effect on creative problem solving. I think it is a shame that no follow-up experiments have been conducted.
评论 #4722538 未加载
评论 #4721196 未加载
redthrowaway超过 12 年前
Define drugs. I know Ritalin is an invaluable tool when it comes time for me to sit down and hack, but can also be counter-productive in limiting my creativity.<p>I think it would be self-evidently false to suggest that no mind-altering substance could lead to a state of consciousness more conducive than the baseline for a given activity, but I would stop short of recommending any particular drug for programming. If it works for you, do it. If not, don't.
评论 #4722098 未加载
6ren超过 12 年前
We have to mention the famous mathematician Paul Erdős <a href="http://en.wikipedia.org/wiki/Paul_Erd%C5%91s" rel="nofollow">http://en.wikipedia.org/wiki/Paul_Erd%C5%91s</a><p><pre><code> After 1971 he also took amphetamines, despite the concern of his friends, one of whom bet him $500 that he could not stop taking the drug for a month. Erdős won the bet, but complained that during his abstinence mathematics had been set back by a month: "Before, when I looked at a piece of blank paper my mind was filled with ideas. Now all I see is a blank piece of paper." After he won the bet, he promptly resumed his amphetamine use. </code></pre> He also liked coffee.<p>Note: effective programming in the real world is absolutely <i>not</i> the same as mathematics - but some would argue that the essence of it is.
rbanffy超过 12 年前
According to popular wisdom, "There are two major products that came from Berkeley: LSD and Unix. We don't believe this to be a coincidence." It's, of course, incorrect (<a href="http://www.lemoda.net/people/jeremy-s-anderson/index.html" rel="nofollow">http://www.lemoda.net/people/jeremy-s-anderson/index.html</a>), but, in any case, it's a funny one.<p>Now, on a more serious tone, a lot of programmers these days take some kind of drug, be it to control their ADHD, Asperger and other assorted medical conditions, be it to supplement something they think their brain is burning through faster than our hunter-gatherer heritage made us budget. I have noticed, however, some friends of mine who started taking ADHD medication (Methylphenidate, the only ADHD drug approved for use in Brazil) that became, indeed, much more focused and productive (amazingly so, sometimes), but that's not a double-blind study.<p>It would be fun (if horrendously complicated) to design a good study for that.
meds_means_hide超过 12 年前
LSD: I have found it possible to use it to gain insight. (Cisco systems had some key person(s?) using LSD to design products.) The problem is that you can trick yourself quite easily into "discovering" things which end up not meaning much. So you do need some care, and perhaps someone to help guide you. For beginners, I'd say LSD's bigger benefit is being able to reshape how you think and handle life rather than understanding some new data structures. It's definitely a "must do this at least once in a lifetime" type of thing.<p>Stimulants are fantastic. Amphetamines provide focus as well as a nice perky feeling to keep you happy while coding. Ritalin (methylphenidate) works too, but I find it harsher and not as pleasant as speed. As the name hints, it makes you fast at things. Talking, thinking, calculating, coding. I notice with Ritalin, doing mental math happens instantaneously - I surprise myself. The focus can be a drawback: if you don't plan, you can end up focusing on something "interesting" yet time wasting. So prepare your day, first.<p>Opiates (such as time release oxycodone) are fantastic for keeping optimism. By keeping your mind in the right state, you can end up being much more productive. Again, the benefit is the drawback: being overly optimistic means your risk calculations and general decision management might be way off. (Biggest downside here is addiction, but it _is_ manageable, at least if you have money.)<p>Pot I've not found useful for much as far as work. I did try coding on it, and ended up writing an infinite loop and thinking it was the coolest thing in the world. Alcohol can sometimes be slightly helpful, in a similar manner as Xanax; just by relaxing and getting one into a better mindset.
评论 #4721609 未加载
noonespecial超过 12 年前
I scale the Ballmer Peak on a regular basis. I've semi-scientifically mapped out the exact amount required to get the desired effect. I've started trying to plot the continuous consumption rate required to spend more time at the summit.<p>I have spreadsheets.
评论 #4720858 未加载
评论 #4721530 未加载
Zenst超过 12 年前
Define better code. Code at that point/moment in time in comparision, maybe. Code later on that is more robust and well documented so that others can understand and change if need be better, probably not.<p>People say drugs help you do this and that, but over time you gain tollerance, have downsides when drug wears off. So is this another tortoise and hare comparision nomatter how it is thought thru.<p>Now if drugs help you to do what you can't, be it atheritis or the like, or pain medication. Something that counters a condition you normaly have that limits your abilities, then sure they do make better code. But as a rule it has too many exceptions to make such a brash statement by using such a losely drifined term as drugs in a title without better focus onto specific groups/types/needs.<p>What goes up must come down, employers don't pay for your comedown, nor do they pay for your supply, so beyond the offcie coffee or prescription mecial needs. I'd say meditation and better mind focus and planning/whole mental approach can do more for anybody to produce better code than any off the shelf solution. On balance take the free coffee and run with it.
评论 #4720835 未加载
getsat超过 12 年前
Posted on HN 49 minutes ago, closed as "not a real question" 48 minutes ago. Wow.
评论 #4720355 未加载
评论 #4720723 未加载
评论 #4720757 未加载
xutopia超过 12 年前
That reminds me of the time I was taking pot while in college. During one class I was completely zoned into the cursor and moved it back and forth 5-6 pixels across the screen.<p>My experience though it is anecdotal seems to rule out at least cannabinoids.
评论 #4720499 未加载
tokenadult超过 12 年前
This question is basically a medical question, so it is best answered with the principles of science-based medicine in mind.<p><a href="http://www.sciencebasedmedicine.org/index.php/about-science-based-medicine/" rel="nofollow">http://www.sciencebasedmedicine.org/index.php/about-science-...</a><p>First of all, do we have a clear evaluation criterion for "better" outcomes? If the question is about writing better code, is there agreement at the start of an experiment about what "better" means? I'm not experienced in evaluating software code (I'm much more experienced in evaluating psychological and medical research), but it seems to me, from reading HN, that better code could be code<p>a) that is able to pass all the unit tests with an earlier deadline,<p>b) that has a smaller total bug count when subjected to code review,<p>c) that solves a problem that other programmers in the same workplace didn't solve until later,<p>d) that works around an intellectual property claim by a competing company more convincingly,<p>e) that meets company stylesheet requirements more exactly,<p>f) that can be maintained by less skilled subsequent programmers,<p>and perhaps other criteria.<p>Any sound experimental study has to meet a lot of other criteria<p><a href="http://norvig.com/experiment-design.html" rel="nofollow">http://norvig.com/experiment-design.html</a><p>to be worthy of believing, and in human drug studies the criteria include<p>1) sufficiently large sample size (n = 1 just doesn't do the job)<p>2) treatment-control design (so that some subjects of the experiment get the drug, and some subjects do not)<p>3) double-blind administration (the subjects of the experiment should not know if they are getting the drug, nor should the experimenters know which subjects are getting the drug)<p>and many more, especially<p>4) rigorous statistical analysis afterward.<p>As Richard Feynman said, "The first principle is that you must not fool yourself--and you are the easiest person to fool. So you have to be very careful about that."<p><a href="http://www.lhup.edu/~DSIMANEK/cargocul.htm" rel="nofollow">http://www.lhup.edu/~DSIMANEK/cargocul.htm</a><p>So anecdotes along the lines of "I took this drug, and I wrote much better code" can be completely discounted, because we don't have access to the coder's before-and-after work product (nor to the coder's detailed dosage history) to know what really happened.
antihero超过 12 年前
Psh, anything that gives you a different perspective on life is important. LSD gives you a vastly different perspective on reality, so I guess if you relate that to life in a meaningful way, is fairly important.
fpp超过 12 年前
A group of scientists from the University of Illinois at Chicago have shown that moderate consumption of Alcohol may boost creativity.<p>... and there is of course the Ballmer Peak<p><a href="http://duvet-dayz.com/archives/2012/04/13/1199/" rel="nofollow">http://duvet-dayz.com/archives/2012/04/13/1199/</a>
dlazerka超过 12 年前
And better music. And better paintings.<p>Many great people did drugs. But don't mess correlation with causation please. Maybe great people are just more predisposed to drugs, while drugs actually harmed them.
cynwoody超过 12 年前
I don't know the answer, but I am reminded of John Markoff's 2006 book <i>What the Dormouse Said: How the Sixties Counterculture Shaped the Personal Computer Industry</i>[1].<p>If you've forgotten what the dormouse said, listen: <a href="http://www.youtube.com/watch?v=WANNqr-vcx0" rel="nofollow">http://www.youtube.com/watch?v=WANNqr-vcx0</a><p>[1]<a href="http://www.amazon.com/What-Dormouse-Said-Counterculture-Personal/dp/0143036769" rel="nofollow">http://www.amazon.com/What-Dormouse-Said-Counterculture-Pers...</a>
abecedarius超过 12 年前
Doug Engelbart took LSD. Probably other prominent hackers around there/then, but I don't remember. (From Markoff, <i>What the Dormouse Said</i>.)<p>I can't answer about helping with coding.
sh_vipin超过 12 年前
Question should rather be : "Should writing better code be a reason to take drugs?"<p>For that matter, it's not the best code that makes a good product. A good code is just part of it.
davidtanner超过 12 年前
Insofar as programming involves problem solving I believe the answer is an unqualified "yes".<p>In _The Psychedelic Explorer's Guide: Safe, Therapeutic, and Sacred Journeys_ by James Fadiman, Ph.D a chapter is devoted to discussing the results of a study on the use of the psychedelic substance mescaline to enhance creative problem solving.<p><a href="http://www.amazon.com/Psychedelic-Explorers-Guide-Therapeutic-Journeys/dp/1594774021" rel="nofollow">http://www.amazon.com/Psychedelic-Explorers-Guide-Therapeuti...</a><p>This study was conducted at the Institute for Psychedelic Research at San Francisco State University.<p>I'll quote at length from the book chapter: "The participants were 26 men engaged in a variety of professional occupations: 16 engineers, one engineer-physicist, two mathematicians, two architects, one psychologist, one furniture designer, one commercial artist, one sales manager, and one personnel manager."<p>"Nineteen of the subjects have no previous experience with psychedelics."<p>The subjects were selected based on their psychological stability and motivation to solve a specific problem they had at work.<p>They met in small groups for several days before the psychedelic session and were told what to expect and given instructions in the use of the drug-effect for problem solving.<p>The subjects were given 200 milligrams of mescaline.<p>After six weeks the subjects were given questionnaires on how the effects of the session had effected their ongoing creative ability as well as how valid and acceptable the solutions conceived during the session seemed to them at that time.<p>Some (but not all) examples of solutions obtained by the subjects under the drug-effect:<p>* A new approach to the design of a vibratory microtome<p>* A commercial building design, accepted by the client<p>* A mathematical theorem regarding NOR-gate circuits<p>* Design of a linear electron accelerator beam-steering device<p>There are several tables full of numerical data. Table names include "Application of Solutions Obtains in Experimental Sessions" and "Work Performance Since Session".<p>My conclusion: Psychedelic substances can be used to enhance creativity - but as always who is using them and how they go about it makes all the difference.
评论 #4745233 未加载
knarfus超过 12 年前
For me, "better" code seems to come from a combination of confidence, creativity, and concentration (maybe not all at the same time).<p>I need a certain amount of confidence to go after a difficult chunk of work that may not really lead anywhere or may turn out to be too big a task to accomplish in the available time.<p>I need a certain amount of creativity to come up with new avenues to try when I'm stuck on a problem or starting to brainstorm a new project.<p>And I need a certain amount of concentration to power through a hard coding task (both to tune out distractions and to keep a lot of information in short-term memory).<p>I have zero experience with hallucinogens, but my understanding is that they can help immensely with creativity but are really lousy for concentration (anyone care to chime in?).<p>Straight depressants don't really help me with any of the above, although I gather some people get more confident after drinking. I tend to go straight from "pleasantly unwound" to "I really need to get to sleep".<p>My experience with (legally prescribed) stimulants is that they're really pretty great for confidence and concentration. I also find that being slightly behind on sleep is less of an impediment to coding, and when I get into social settings I'm much more engaged and generally better at interacting with people.<p>The flip side is that I often can't sleep well, and I can rarely nap, so if I get too far behind I end up clicking around the web like a zombie all day. Paradoxically I'm a lot less <i>interested</i> in socializing, even while I'm better at it. All told I would say it's neutral to negative on creativity.<p>I'm also not totally comfortable with what effect five, ten, or twenty years of daily use will have, and part of me really wants to maximize the portion of my life spent without taking a pill every day. So it's a mixed bag.
lost-theory超过 12 年前
I think stimulants and amphetamines definitely have an effect on programming. Maybe it affects quantity more than quality, but Paul Erdos, one of the most prolific mathematician ever, comes to mind:<p><pre><code> His colleague Alfréd Rényi said, "a mathematician is a machine for turning coffee into theorems", and Erdos drank copious quantities. After 1971 he also took amphetamines, despite the concern of his friends, one of whom (Ron Graham) bet him $500 that he could not stop taking the drug for a month. Erdos won the bet, but complained that during his abstinence mathematics had been set back by a month: "Before, when I looked at a piece of blank paper my mind was filled with ideas. Now all I see is a blank piece of paper." After he won the bet, he promptly resumed his amphetamine use. </code></pre> <a href="http://en.wikipedia.org/wiki/Paul_Erdos#Personality" rel="nofollow">http://en.wikipedia.org/wiki/Paul_Erdos#Personality</a>
photorized超过 12 年前
Define "better code."<p>There are medications that can influence focus, energy levels, productivity.<p>Problem is - we still don't really understand how the human brain works. The implications of introducing outside chemical stimuli can be horrendous. You may have noticed that big pharma companies are now focusing less on psych meds.
tsotha超过 12 年前
Real evidence would require a double-blind test, but there is already such a large productivity difference between programmers you'd need a pretty large sample.<p>And what possible metric could you use to determine if the code is "better"? That's a really subjective thing.
Wintamute超过 12 年前
Recreational drugs can certainly be part of a happy, functional social life when used responsibly by people with non-addictive personality types. Hallucinogenic drugs can give profound and life changing insight on your mental processes, although YMMV. Coding while actually high will <i>not</i> help you produce quality software.
marcos123超过 12 年前
In regards to the original question, Yes. Contrary to some peoples' beliefs, experiencing new perspectives is good for learning, problem solving, living. Francis Crick supposedly discovered the DNA helix while in the alternate universe that is an LSD trip.
yaddayadda超过 12 年前
Spiders not programmers, but definitely a graphic indication of ability to create - or not - detailed patterns while on various drugs <a href="http://www.trinity.edu/jdunn/spiderdrugs.htm" rel="nofollow">http://www.trinity.edu/jdunn/spiderdrugs.htm</a>
nostradamnit超过 12 年前
Legend has it that Bill Joy created Vi while on LSD, or at least came up the the idea...
31073超过 12 年前
I'd suggest looking at the book Imagine by Jonah Lehrer. It doesn't refer to coding specifically but he talks about ways to foster focus and inspiration. The author looks in to all ways to get to these states of mind including drugs.
PaulHoule超过 12 年前
Drugs in programming, as well as other occupations, play an emotional role as much, or more so, than a cognitive role.<p>If Habit A helps a programmer who'd otherwise be sidelined by emotional problems stay in the chair, it may help that programmer be more productive than they would be otherwise. Of course, addictions don't help us face those problems in the long term, and often let them get worse.<p>All sorts of drug-related behaviors exist among programmers. Many shops full of brogrammers celebrate beer o' clock at 4pm. Other programmers sneak out alone or with friends at lunchtime to a bar or convience store to enjoy some alcoholic drink.<p>Many programmers abstain from intoxicants at work, except for the common stimulant caffeine. Others are hooked on opiates after being perscribed them for chronic or acute pain.<p>LSD, even the weak stuff common in North America from 1970 to 2001, is profoundly distracting. Years ago I ate a pinch of mushroom dust and found that 25 minutes later, I couldn't keep my eyes straight to even look at a computer screen. On the other hand, it's the only sacrament that's clinically proven to more create spirtual experiences than a placebo -- the ability of hallucinogens to create profound changes is practically unlimited.<p>Long before the statute of limitations, I once received a gift of several dexedrine pills from a friend diagnosed with ADHD. I took one on the the first day of a new project and felt euphoric. I wrote several hundred lines of beautiful code that would serve the nucleus of a system that was planned to replace critical functions of a production system that tens of thousands of people depend on every day.<p>A week later I had a more sobering experience. I was tasked with upgrading another production system, and with the dexedrine tab in me I felt cocky and by 9:08 am I'd deleted the master instance of the production system.<p>I got forbearance from my co-workers because we had a backup ready, and a tested restore procedure, so we had the system back in 13 minutes and soon proceeded with the upgrade.<p>That was a portent of things to come. The project I was working on had no project manager and a group of stakeholders that hated each other. I tried to code my way of a difficult interpersonal problem and ultimately it all came apart. A year later I deployed the new system with hardly any testing and of course it didn't work. After a week of month of daily patches, each bug fix breaking something else and spreading database corruption, we threw in the towel and reverted to the old system.<p>My contract didn't get renewed at that employer the next year, and that was the beginning of my being a "journeyman" as a mercenary maintenance programmer.<p>Perhaps I shouldn't blame two amphetamine pills for something that was so much bigger; but I like the story that the pills started the project out in a state of spiritual misalignment. Had I listened to people instead of coding, things might have worked out differently. I might even have quit and had an easier time getting my next job.<p>Some programmers adocate nootropic drugs like Piracetam but I think those are just as bad as speed. They mess up your reward pathways and make you feel like you're Tony Stark but they don't really make you a genius.<p>I for one am addicted to caffeine and find it quite difficult to stop, even though it screws up my digestion almost to the point where I throw up. It's terrible, but at least I'm better off than the alcoholic and dope addicts I've met.
评论 #4720687 未加载
评论 #4720856 未加载
评论 #4720734 未加载
scotty79超过 12 年前
This comes to my mind: <a href="http://www.flickr.com/photos/22926987@N00/2198300/" rel="nofollow">http://www.flickr.com/photos/22926987@N00/2198300/</a>
anonymous_mouse超过 12 年前
Hearsay: During WWII the code breakers of Bletchley Park were provided with benzedrine tablets.
photorized超过 12 年前
The Jobs example was about vision, not "code".
simplexion超过 12 年前
Yes.
drivebyacct2超过 12 年前
Which drugs? I've been writing an application for 4-5 years. It's my "learn a new language" project and it's pretty complex and I recently rewrote it and exclusively worked on it under an influence of one or another of things, but nothing like Adderall or Ritalin. I just finished the final version of this project in Go and it is far and away the most readable, performant version I've written. It's also the first version to properly protect against all types of races.
ecliptic超过 12 年前
Paul Erdos famously swore by their productiveness.<p>From Wikipedia:<p>His colleague Alfréd Rényi said, "a mathematician is a machine for turning coffee into theorems",[31] and Erdős drank copious quantities. (This quotation is often attributed incorrectly to Erdős,[32] but Erdős himself ascribed it to Rényi.[33]) After 1971 he also took amphetamines, despite the concern of his friends, one of whom (Ron Graham) bet him $500 that he could not stop taking the drug for a month.[34] Erdős won the bet, but complained that during his abstinence mathematics had been set back by a month: "Before, when I looked at a piece of blank paper my mind was filled with ideas. Now all I see is a blank piece of paper." After he won the bet, he promptly resumed his amphetamine use.
Supreme超过 12 年前
Who wouldathunk that doing LSD could turn someone into a complete asshole with no regard for an open culture and a penchant for superficial things which don't matter in the least (like one button devices)?