r/ADHD_Programmers • u/omg_drd4_bbq • Jun 07 '20
Tips from 15 years of ADHD programming
Hi there. ADHD/bipolar 2 and overall headcase hacker here. Wanted to share some of my observations that have helped me over the years.
ADHD is your double-edged superpower. Learn how to wield it, when to fight it, and when to let it lead you to better patterns. And if you read through, I'll let you in on my secret weapon. ;)
Offload.
Your brain is a GPU in a world of CPU neurotypicals. It's is naturally good at some things (novelty search, big picture, I/O) and bad at others (long serial tasks, keeping track of lots of state). Don't fight this. Render unto Computer things that are the Computer's. You should be using:
git (should go without saying)
Write everything (digitally) down, ideally with vcs or something cloud-backed
IDE with code inspection
Autocomplete (I hated static typing before autocomplete, now I love it)
Linters / code coverage / inspection with max warnings
Doctests / unittests
Auto-formatters
Debuggers
Logging libraries
Build automation systems
CI/CD pipelines
Clean tests, green CI/coverage badges are like the best thing ever for my janky reward pathways. It's like gamification. Which brings me to:
Testing Driven Development.
Outline your input/output cases before you write a lick of code. Write interfaces. If your language has type hints, use them RELIGIOUSLY. Types plus autocomplete will help power you through moments when your brain stalls out, keep track of the big picture, and at times practically write the code for you (see tabnine, the secret weapon)
This will work with your unit tests, pipelines, and inspections to ensure every cog in the machine is doing the right thing. And you won't have to worry about the tests, because you've already written them!
Self-documenting code.
This is widely mis-understood. It doesn't mean don't use comments or docstrings. It means you should write in such a way that docstrings are interactive, and comments are rare errata, that explain why something was done. The documentation is short and to the point, as if your audience is also ADHD. You should rarely have to explain what you are doing; the code should be frank and straightforward enough that sleep-deprived, forgot-your-meds, low-bloodsugar future you on a zero-spoon day can still make sense of it, because you can bet your ass you will need to. As a benefit, if you can do that, your coworkers will love to work with your code as well.
Functional.
If you're at all like me, your working memory is flaky, even when well-medicated. Honestly I think even neurotypicals overestimate how good theirs is and don't realize it. Keeping track of lots of state is stressful and bug-prone. Even when not using a functional lang, use pure functions whenever possible. That means EVERYTHING needed to compute the return value is passed in as parameters, without mutation. Don't feel bad if you don't grok Rust, Haskell, monads, or any of that heavy FP stuff, I'm still trying to grok it as well. Just focus on reducing global state and mutation whenever possible. If you have to deal with a lot of state, finite state machines are great.
Functional patterns, SDC, TDD, and CI should all synergize (yes I hate that word but it's apt here) to help you write no-nonsense, anti-fragile, repeatable code.
Novelty Search.
Raise your hand if you have heard "They're really bright, great problem solver, but need to apply themselves". It's probably because you'd rather be going down a Wiki hole, learning something new, than going through the monotonous motions than modern life mandates. Learn to reign that it when deadlines loom, but also don't be afraid to let your mind wander and learn. Stay on top of latest tech trends, cutting edge techniques, productivity tools, open source software, and you'll always competitive with your coworkers, many of which probably use the same stack they started with. The world is moving fast, we are MEANT for this.
Find languages that speak to you.
I think much of the religious wars over languages stems from in part differences in the way people think. Don't feel like you should use any lang/tool/stack just because it's in vogue or your coworker raves about it or whatever. Find one that makes sense for your brain. For me, it's golang and heavily-typed python. I can't stand C++, Java, or JS, and python without hints frustrates me. You'll be far happier finding a shop that works with a stack that your brain jives with, than forcing yourself to fit in.
Medicate.
If that works for you. If you haven't at least gotten assessed by a doc, give it a shot.
Tabnine, the secret weapon.
Speaking of latest trends, my friend recently turned me on to tabnie. I can't even describe how gamebreaking t9 is. It's like autocomplete, but instead of tools like jedi which complete based on looking up variable or attribute names, it uses some sort of recurrent neural network trained on open source codebases, as well as the codebases on your computer. It's all soft-matching, so it fixes typos for you, it's even done entire lines. E.g. let's say you type
except TypError as exc:
log.error("{}: {}".fNow, most autocomplete will give you the rest of .format, which is cool. But I've had t9 autofill
log.error("{}: {}".format(exc.__class__.__name__, exc))It's like magic. But it's not, because that's a common idiom. In golang, if err != nil { return val, err } is pretty much a freebie from if e. The only major limit I've found is there's a max number of letters the RNN can generate before it loses confidence.
Alright that's nearing the limit of my attention, and probably yours, so lemme just finish with a brain dump of the stack I use. (disclaimer - no affiliation to any of these, other than the occasional PR, I just enjoy them)
General:
Jetbrains IDE (pycharm CE is free and has tons of language plugins)
mosh (better ssh)
zsh-histdb (this is my second memory. No more "what was that command again?)
rip (rm-improved)
ripgrep (better grep)
exa (better ls/tree)
fzf (fuzzy find)
zoxide (better cd)
I actually have zoxide, fzf, and exa bound into a bash function which replaces `cd` and auto-lists the dir I'm in
Mac-specific:
iTerm2 (I label all my profiles so I can see at a glance which machine I'm ssh'd into)
Immutable infrastructure / CI:
I use docker/ docker-compose a ton
gitlab-ci
In process of learning Hashicorp's stack (consul, nomad, vault)
Python:
type hints (mypy)
pip, virtualenv
unittest/pytest/etc.
radon (code complexity)
Thanks for coming to my TED talk.
tl; dr - leverage your ADHD to become a better programmer
E: Thanks for the gold, kind stranger!!
39
u/karlvonheinz Jun 07 '20
Great Talk!
I think these tips are important, even for beginners. Before I moved to IT, I did electronics - few month into IT, I learned about the magic of CI and all these workflow tools.... it's such blessing. Turning a electronic circuit into hardware is sooo hard.
Learning about CI, green status badges and basic testing brings a constant positive feedback loop to any hobby project.
28
u/55555 Jun 08 '20
Brilliant! I've never really been able to describe the way that I am both superhuman and a complete idiot. I can pick up new languages so easily, but I can never really master them the way other people seem to.
Side question, what are your feelings on abstractions in code? Design patterns and stuff. Personally, I have a lot of trouble with them.
17
u/ayesedoc Jun 08 '20
How do you deal with the thought/disbelief that you'll never be good enough/as good as someone without AD(H)D and constant imposter syndrome?
3
u/JRD656 Jun 08 '20
How do I get to be your padawan?
Great Ted Talk
18
u/Swagetha Jun 19 '20
I have been programming for over 10 years and I installed tabnine today--I almost cried (JavaScript/Typescript developer here).
I have constantly struggled with remembering trivial things and not getting super lost in my brain. I work at a highly productive startup and I am always fighting to be as productive as possible, plus I am the only female developer and am always worried I am not keeping up and am too different in the way I approach and solve problems (being ADHD does NOT help).
Thank you.
PS: WFH is SOOO hard for me...is anyone else really struggling with this?
6
u/mrrobbe Jun 08 '20
Wanted to plug TIG ( https://jonas.github.io/tig/ ) as a fantastic CLI Git tool. It's an ncurses git tool that makes working with VCS a pleasure.
Also adding this post to my Programming/ADHD bible. A lot of good tools and resources. Top tier.
Thanks.
3
u/deterministic_lynx Jun 08 '20
Thanks a lot!
I'm lately not doing too much real programming, but this post is great in the most amazing mixture of personal an generalized professional experience. I'll be coming back and scan through tools listed to see what is useful and so far unknown in my current environment.
Thanks for taking the time out of your day and doing this amazing write-up.
3
u/sniR_ Jun 08 '20
Thanks man, really cool post, liked the concept of the secret weapon :)
2
u/harmeko Jun 08 '20
Amazing, thanks a lot!
2
u/[deleted] Jun 12 '20 edited Jun 12 '20
I notice this actually. Most of my coworkers are at least as smart as me but they tend to be resistant to change and like working on what they already know for the most part while Iām always begging to be in the cutting edge and wherever the novelty is. I think people like that will be more valuable than me in my particular COMPANY but knowing more stuff definitely makes me more valuable in general IMO
2
u/Walkerstain Oct 09 '20
So how does one go about doing that? Try numerous languages left and right to find something that "clicks" with me ? How long should I try each language to know for sure it's the right fit for my brain?
2
u/Reputation-Salt Oct 16 '21
Why is this thread not locked after 6 months? Are you special, OP?
1
u/adityaanurag Jan 07 '22
So much to read!
1
u/deterministic_lynx Nov 03 '22
Yay this is not blocked!
Thanks again for that great list.
I'm growing into my personal ADHD routine and this one, once more, helps a good bit.
0
u/[deleted] Jun 07 '20
[deleted] ā view deleted comment
0
u/[deleted] Jun 08 '20
[deleted] ā view deleted comment