I work on software when I'm a little stoned pretty frequently. It helps me to look at the problem from new perspectives and it really helps me to come up with simple and elegant top-level designs. My architecture really does benefit from lighting up every once in a while and then sitting back and thinking really hard about whether I'm taking the design in the right direction or not.
in reply to Coding while drunk
I also like to get a little stoned and then test my code for usability. If I can use it when I'm stoned then that's a pretty good indication that the interface is clear and simple and usable. Smoking pot kind of brings me down to the level of an end-user and it makes me more likely to go off clicking on things that I subconsciously don't do when I'm sober. I open up a "notes.txt" file in Emacs on one monitor and then I go off and try to break my code on another, and I normally have pages and pages of notes on things that need to be fixed after an hour or two. Throw a little acid jazz into the process and it's actually a lot of fun.
I don't really recommend trying to actually write code when you're stoned. It's a great state for sitting back and thinking about top-level stuff or examining your application for beauty, but it impairs concentration in the worst way and your code suffers. Espresso will always be my favorite substance for coding assistance.