Do good developers memorize their code or copy-paste?
All rock star coders seem to memorize their code; they type so fast and beautiful code comes out magically. They are like artists. The Coders who give talks, do webinars, Youtubers, live streaming coders, they seem to remember their code. Every time I saw any of those I felt like I’m not a good programmer because I don’t remember most of my code.
First, I will write the code by looking into some documentation, tutorial or a book. Then, I copy past that for most of my subsequent functions, classes, files, etc. 90% of my code is copy-paste. I don’t write my code, but I copy. How come someone who copies other's writing becomes an author? Thus, how can I call myself a programmer? Even though I work on complex and large scale projects, most of my code is copied from somewhere. I don’t feel satisfied with my craft because of its not even my art but some stolen pieces.
Finally, I thought I would ask other programmers about their coding habits.
I asked my colleagues, and I went on twitter asked some genius programmers this question from them.
How much code do you type from memory, and how much you copy-paste? Is it essential to memorize code?
This is what I found.
They maintain a library of code snippets that they can refer to when coding. It is impossible to read a book or do a course, and you magically have it. You have to keep referring to different sources, create your snippet library, have it in your local machine or as a GitHub gist folder. This can include standard scripts and specs of code that you regularly used.
Another way is to use IDE extensions for code snippets. Especially Visual Studio Code has many language-specific extensions that can create common code snippets that can save a lot of time and improve productivity. Also, they refer to the official documentation of the language they are using daily.
They often look up and research many hours to find how to implement some logic or build something. Most of their code is not memorized.
They said googling, looking up stack overflow is a big part of being a developer.
What is important is to remember the concept of the code and how it works rather than trying to remember syntax and code itself.
Remembering a piece of code will not get you out of a complicated codebase, but you have to learn how to understand the concepts. Anonymous on Reddit once said, “If you memorize one path in the forest, you will only get out if you always start and end in the same place.” And this is very relevant to coding because you will never start and end at the same place. You have to work on different requirements, different code bases written using different frameworks by other people. By remembering some pieces of code will not get you out, but you have to understand the entire forest.
Most proficient programmers are doing the same thing that I am doing, searching a fix for an error, seeking how to do stuff, and how to add stuff. What is essential is constant learning and finding things. Don’t get discouraged if you have to look something up. Don’t feel like this isn’t for you or your mind is not capable of what other people do. It’s OK to copy from others.
I recommend you to read this book ‘Steal Like an Artist’ by Austin Kleon, so you can learn how to steal other’s work and still feel great about it. Picasso said, “Good artists copy, great artist steal.”