It's a fun topic to debate but the question is pretty fuzzy. "Recreational drugs" vary so widely in their effects that you can't really say anything about all of them at once. "Help" is also a subjective term that would need to be further defined to have any meaningful discussion.
I'll also put out there that anyone who hasn't done much of them is unqualified to answer.
Personally, and speaking very generally, ie. the way this question would typically be taken, I would say that they do not help. More specifically:
- Depressants such as pot and alcohol can help you think more creatively but tend to erode motivation and coding accuracy/efficiency.
- Hallucinogens (LSD, DMT, MDA, 2CB, shrooms etc) in normal doses also help creativity but will usually make interacting with the computer difficult or impossible. At very low doses (see LSD microdosing) there can be potential for augmenting sharpness of mind and attention.
- Most energetic stimulants (cocaine, meth, crystal, crack) make you too wired to sit still and focus on a task like programming. Way too little attention span.
- Speed is an exception to the above. With lower doses it can help keep you focused and awake almost indefinitely without being foggy. This the one drug I would say has the ability to help, even if it doesn't allow you to do anything you couldn't already with willpower and enough Jolt.
- MDMA (ecstasy) I consider a class on its own. Coming up with and talking about programming ideas could work very well but sitting in front of a computer doing a task that needs a clear head would definitely be problematic due to the mashy fogginess. Besides, why code when you could be hugging someone or dancing?
- I couldn't tell you about heroin but from what I've seen in movies it doesn't look like something you can code on at all!
FWIW I've been coding for about 30 years. Hope this helps :)