One way or another, this summer I ended up writing a bunch of code. Along the way, I learned a lot about learning to code (Meta-learning? Douglas Hofstadter would be proud). Should you also choose to wander down the dao of if statements and breakpoints, here are some tips for the journey. (Warning: May be especially suitable for liberal-arts types like me.)
1. Don’t be afraid to get sprayed in the face by the proverbial firehose
I think the one thing that has helped me the most is sheer exposure. This can come in the form of coworkers, friends, books, blogs, websites, or what-have-you. Unlike most other things in life, here quantity matters as much as quality. I had to teach myself how to just absorb without worrying about arranging all that info in my head or extracting immediate use out of it.
And no, you will not understand even 50% of it (at least I don’t, and this person doesn’t either), but you will get used to Computerese and encounter some nifty words. You will become aware, for instance, that there is a certain “regex” thing that is useful for matching strings of characters. And that’s great because next time you’re hankering for some string-matching, you’ll know what to look at more deeply.
2. Make something that sort of works
Emphasis on the “sort of.” You will never actually get anywhere if you aim for perfection, or even near-perfection, when writing a program.
Here’s the thing I learned about coding: there are always different ways to do something, none of which are necessarily “better” than the others. So if you try to code something in the best possible way the first time around, you will either kill yourself or go into hiding for years.
Don’t try to write beautiful, poetic, bulletproof code from day one. Just whip out the text editor and write something down. The first web app I write is probably going to be sweet sweet hacker bait. But, I haven’t killed myself out of frustration yet. And living is definitely a prerequisite of continuing to get better at anything.
3. Code from scratch
If there were a way to turn off copy-pasting, I wish I would have done it long ago. All those years spent grabbing snippets of conveniently prewritten functions off stackoverflow.com have done me little to no good. You don’t actually learn to code if you’re just fiddling around with code other people wrote. Sure, you get the requisite exposure to different ways of writing code, so it may feel like you are still firehosing yourself, but eventually you hit a plateau of learning. (And in truth, back in my copy-pasta days, I never really took the time to read other people’s code.)
The ultimate goal of learning how to program is being able to make a dumb machine (or group of machines) accomplish a task that you’ve just thought up. This means coding from scratch, like composing a sentence out of your head. Turns out, the only way to learn how to do that is to practice coding from scratch as much as possible. This doesn’t mean that you should eschew all libraries and tools (I would be positively bereft without jQuery), but go easy on them, and find opportunities to “roll your own” solution.
4. Give your brain time to heal
Don’t try to blow through all the Python docs in one marathon session. Your brain will never get a chance at a “healing period” for solidifying new knowledge. It’s like training at the gym and working the same muscle groups every single day—it will eventually lead to your muscles dissolving into goop and you will have goop-muscles and all the kids at school will make fun of you.
Instead, take time to linger on a concept, or not think about programming at all. Me, I like to spend an evening sorting 1000 sheets of origami paper by color.
Having healing time allows the next tip to come to light, which is to…
5. Expect (and accept) uneven progress
I have actually walked into people on the street because, out of no where, programming puzzles I’ve worked fruitlessly on for hours on suddenly made sense to me. I can’t explain why this happens, but our brains like having epiphanies on their own schedules.
Tom from my internship said that it takes about 45 minutes to learn anything new, but those minutes are separated by untold amounts of time spent picking away at a problem. Knowing this is particularly comforting because we are so accustomed to the “steady progress meter” model of achievement. Memorizing vocab words, doing sit-ups, whatever, they all seem to improve steadily with time and effort. So it’s easy to feel like something is horribly wrong and you’re never going to improve, after hours of seemingly fruitless labor. Just know that after the long hours of growling and smacking the table and shaking the keyboard, suddenly, like magic, it will work. It might take days or weeks, but it will eventually work. And that’s how you level up in programming.
One last piece of advice: If you do decide to learn how to code, whatever you do, don’t get discouraged. Don’t EVER tell yourself “Eh, I’m just not cut out for coding.” I, right-brained liberal-arts major that I am, have used that as an excuse several times in my life and the only thing it has ever done is ensure that I still suck at coding. And now, even I can write some server-side Python code that can exchange pleasantries with a database.
Good luck, and may you build awesome things.