Copy Code to Accelerate Learning

Way back in the before times, if you wanted a copy of a book or manuscript, you needed to make that copy yourself with pen and ink by copying the text line by line. A term used to describe this is Copywork.

Copywork was also used by great authors of the past to learn more deeply about the great authors that came before them. It allowed them to feel like a master writer for a short while, make observations and connections, and ask questions about why great writers used specific words and structures.

Copying the code, line for line, of other engineers can accelerate your learning. It has been one of my goto tactics any time I endeavored to learn a new programming language.

How Copywork Helps Coders

In my opinion, one of the most significant benefits of using copywork when learning a coding language is that it gives you a break from repetition and the rote memorization process, which frees your mind to zoom out and analyze more deeply as a whole.

Copying the code of several different and more experienced engineers will expose you to other approaches to a similar problem. Some engineers have an individual style, and you can see it in their code. The more copies you make of work by different coders, the greater the scaffolding that gets created in your mind; it helps create a mental lattice for new things to stick.

This process can also reveal the varying strategies and tactics used by others. Some patterns will be evident to you, and others won't—make a note of what you see for further investigation later. Some of what you are learning with copywork will make its way into your work someday; a combination of different styles will converge to become part of your style.

One significant side benefit of this kind of practice is that it helps relieve some of the overwhelm that accompanies learning to code in a new language. Immersing yourself in multiple compositions of code creates familiarity.

How I Do It

1. Find Some Authors

Start with some Google and GitHub searches for well-known and more experienced coders for your language of choice.

Examples of code authors for TypeScript:

2. Pick a Composition of Code

When picking a composition or page of code, don't worry too much about where it fits within the rest of an application.

The code you copy could be part of an abstraction and challenging to understand its role within the broader scheme. And that's ok; again, our goal is to copy and zoom out, to analyze a piece from a higher vantage point.

As an example, I might choose one of the following:

3. Copy and Observe

Now that you have a composition of code to copy, sit back, and start copying the piece at a steady pace and consider the following as you progress:

Conclusion

Copying others' work with the intent of observing a composition in its entirety is a tool I think all aspiring coders should be using. This practice has been a learning accelerator for me.

You might be thinking, "I'm already copying code all day long from books and tutorials!". While this may be true, you may likely be doing it focusing on one particular area, as part of learning variables, scope, functions, etc. Remember that for copywork, the goal is to zoom out of the granular learning and focus on the code in its entirety.

Give it a try!