Follow Join

Don't copy and paste other people's code, type it out 13 years ago

(From my blog for my company)

If there’s one thing that hasn’t changed for me from the first day I started writing code until today, about my 500th day, it’s that not knowing where to start is incredibly intimidating. I acutely remember the panic of learning HTML and having no idea how to get my divs to go where I wanted them to go. The concept of setting up a grid system made sense to me, but the execution eluded me for days.

My relief finally came when I had the greatest realization of my young coding life: good lord, there is working code everywhere! It’s all over the internet! Just find it, copy it, and see how it works and you’re golden! I became a Google, “view source”, and “inspect element” maestro over night, learning structures and logics by reading other people’s successful executions. And for a while, this was all I needed. I needed to learn such basic things that just reading and seeing how other people’s code executed then editing it to fit my needs was the best thing for me. However, as my skills improved, I found myself lacking the skill to write code from scratch as elegantly as I wanted to. So I started a new system: instead of coping other people’s code, I type it out.

When Hunter S. Thompson was working as a copy boy at Time Magazine in 1959, he spent his spare time typing out the entire Great Gatsby by F. Scott Fitzgerald and A Farewell to Arms by Ernest Hemingway in order to better understand what it feels like to write a great book. To be able to feel the author’s turns in logic and storytelling weren’t possible from reading the books alone, you had to feel what it feels like to actually create the thing. And so I have found it to be with coding.

When I’m doing anything from executing a JQuery plugin someone else wrote to creating a static page in Python on a framework (like Cactus), whenever possibly I split the code onto one screen and my IDE on the other and type out the whole thing. It’s amazing how deeply I can understand the logic and any foreign syntax when I actually have to write it out. My mind has to actually narrate, like “here’s where they’re splitting the string, here’s where they’re parsing it, and WHOA! I didn’t know you could do that with Javascript!” when I undergo this process.

And it’s working. It’s awesome. I suggest you try it.

Nobody ever learned to become a great writer by reading a dictionary, you’ve got to feel it.

Follow me on Twitter Hacker News Discussion