I've tried Adderall, Ritalin, etc, and sometimes I'm able to concentrate on the things I need to get done, but unless I'm really careful about saying focused I end up going off on tangents and writing the most amazing but useless code for several hours.
Experimenting with crazy metaprogramming techniques, writing over-engineered utility libraries, experimenting with new technologies, writing epic blog posts, etc. That said, I've learned a lot about programming by going off on those tangents.