I've been taking modafinil for a while now (over a year). I initially started taking it to help with a massive workload at my job. I was a long-time software engineer at Google at the time. I was utterly burned out and couldn't retain my focus for more than 10-15 minutes- definitely not enough when you're writing c++ code and need to retain a huge amount of state in your head (header file definitions, pointer ownership, etc. etc.). But i wasn't in a situation where i could immediately take time off or change jobs/groups. So i started taking Modafinil to see if it would help me concentrate and get things done.

The immediate benefit and the thing that i still love it for today is how focused it makes me. As a programmer, most of my day is just getting things typed out. Pure creative thinking is maybe 1 hour a day at best. Without modafinil, if people came and interrupted me, i would get distracted, surf the web and it could easily take me upto an hour to get my head back in the code (especially since i hated what i was doing). With Modafinil, i would just retain stuff and be able to get back to work immediately. I'm in my mid-30s. Even on a good day, without Modafinil, i could stay in flow for maybe an hour or so before i would get distracted and lose focus. On Modafinil, 3 hours is average, 4 hours happens sometimes.

You know when you're fixing bugs in a big codebase and for each bug you kind of have to load up state in your head and think -oh yeah i need to change x,y,z here and a,b,c there and these tests 1,2,3 have to change and i should probably make sure foo and bar are still working. Well with modafinil i was able to think of that and keep all of it in my head for the 2-3 hours it would take me to type out a fix. Or you're reading a few bug reports and you are working on fixing one - you look at the file you're in and realize that while you're working in that file you could fix 2 or 3 other things or you could do a refactor - and you just do it without losing state in your head of where you are in the original bug. Modafinil let me do that- it was totally like a ram upgrade. (Or really like i wasn't burned out or was 25 again or something).

So yeah my short-term recall also went up. Another example - at google we had lots of command line tools each with tons of options. It used to be a real mental effort for me to recall the 8-10 options i would have to pass on the command-line along with gigantic path and filenames to get something simple done. This isn't uncommon- some of the most popular internal webpages are commandline option references for the really common tools. And it was a huge distraction - to have to drop what you're doing to have to go to some webpage, scroll around or click find until you found some poorly documented option that maybe did what you wanted etc. With Modafinil, that was all just in my head for the whole day - enough so that at the end of the day i could make up shell scripts for the useful stuff, but during the day i could work really fast because i wasn't looking stuff up all the time.

So yeah it did great things for me. But the bad news- i tried taking it every day - after a week, paranoia set in and mood swings. I would get extremely defensive about simple comments in code reviews. Typically i would take 200mg only in the morning so i could sleep at night- but if my schedule was bad and i went more than 3-4 days without sleep i would start having persistent hallucinations that lasted 10-15 seconds - not just corner of the eye stuff but talking to people who weren't there.

Nowadays, i take it at most 100 mg at a time a maximum of twice a week. I really enjoy programming and i want to think i'm good at it so taking Modafinil felt a little like cheating with steroids or something. My current job is much easier than Google and I've been able to replace most of the positive effects of Moda by doing a ton more planning - e.g. i help my short term memory by writing copious comments, keeping a detailed log of exactly what i'm doing in org-mode, exercising good email discipline, writing code much more defensively so i don't actually keep a lot of state in my head etc. etc. I meditate every day even for 5 minutes just in case that will help with focus. A lot of this works really well. But if the shit hits the fan at work and I'm debugging blind in a bunch of crappy code i've never seen before, or my fragile ego requires I be the guy who is just faster than others and gets stuff done, that's when i still reach for Modafinil.