How to Remember the Code You’re Learning

One of the most common questions I get from students is: “What’s the best way to retain what I’m learning?”

Students may think they understand the lessons and concepts being taught, but later struggle putting it all into practice. Writing good code takes a lot of time and effort, so the best way to retain the information is through practice and repetition –– easier said than done, right?

Let’s go over some helpful tools and methods you can use to better retain what you’re learning.


It’s said elephants have great memories. Why can’t we, too, when it comes to remembering code? (Photo by Flickr user Martin Fisch)

It’s Easy to Forget What You Don’t Understand

Often, even when you think you have a good grasp of HTML, CSS, or JavaScript concepts and techniques, they’re difficult to put it into practice. And sometimes, no matter how clear the explanations in the videos or tutorials, you can’t get anything to work when you try it later on.

That’s because your interpretation of what’s being taught varies –– you can’t just take the lesson at face value. You need to make sure that your interpretation is right by implementing what you learned.

Free trial on Treehouse: Do you want to improve your development skills? Click here to try a free 14-day trial on Treehouse.

Don’t Just Watch or Read

Be an active learner, not a passive learner. It’s difficult to retain information through passive learning. You may think that watching a video or reading a tutorial over and over again is enough to lodge the information in your head forever. While some of it will eventually stick, it’s not the most effective way to learn.

Even though you’re focused on what’s being taught in the lesson, you’re just seeing or reading abstract concepts. To really get it, you need to run into difficulty, make mistakes, then identify and correct them. So converting that knowledge from abstract to practical is important because it’s no longer something someone else has told you.

Start building something right away: A single-page website, a small website component, get involved in a project –– anything. It doesn’t matter what it looks like or how it works as long as you keep doing it while raising the bar, you’ll gradually get better. I promise!

Online Coding Tools

These days, online code editors like CodePen, JSFiddle, or Treehouse’s Workspaces provide designers and developers a quick way to communally experiment with code. This is a helpful way of implementing a concept you just learned. To ensure you’re getting it into your long-term memory, try coding at different times during the day, without looking anything up beforehand.

Developer Tools

When visiting websites I like, I always use Chrome DevTools (or Mozilla’s Firebug) to inspect the code and see how certain parts of it were built. I’ve learned some neat things doing that. Also, viewing –– or “borrowing” –– another website’s HTML and CSS, then changing it around to build something different can really help when learning to code.

Share Your Knowledge

“But I’m not an expert!”

It doesn’t matter. You will always know something that someone else doesn’t know. Plus, you’ll retain more when you synthesize then teach the information and, down the road, it might even establish you as the “expert” in a given topic.

I’m always impressed by those students who have blogs where they write about what they’re learning. It’s no coincidence they are the ones who find successful work in the industry.

Be Patient, Confident and Don’t Worry About Memorizing

It’s important to be patient because it takes a while to wrap your head around code, but the more you do it, the more it starts clicking.

Don’t worry about memorizing every tag, selector, property or value available. A solid understanding of the concepts –– and a reliable reference –– is more important. I probably don’t know every CSS selector off the top of my head, but I sure know how they work and where to reference them.

For example, If you asked me to code a five-color-stop radial gradient using the old and new syntax, I’d probably go straight to MDN or use ColorZilla’s Gradient Generator. By knowing exactly how gradients work, the types of syntax and browser support, I’m able to move through the process much faster.

Finally, to retain new concepts, you need to be confident and refrain from being pessimistic when you struggle. Pessimism leads to giving up.

Free Workshops

Watch one of our expert, full-length teaching videos. Choose from either HTML, CSS or Wordpress.

Start learning

Guil Hernandez

Guil is the front-end design teacher at Treehouse. You can follow Guil on Twitter at @guilh.


21 comments on “How to Remember the Code You’re Learning

  1. This is exactly what I have discovered recently. Which is why I love what you guys are doing with the challenges lately. I’d love if it got expanded into its own section of the site.

    • I should probably clarify. By challenges, I’m talking about the weekly forum contests.

  2. Thanks Guil! That’s what’s been in the back of my mind as I’m going along too.

  3. Great advice Guil! The lessons on the site are great to learn the fundamentals of each language, etc but the only way to really help it stick is to put it into practice. I regularly build my own projects either alongside or at the end of courses.

    It’s impossible to remember everything, that’s why it’s important to bookmark reference sites such as Mozilla developer, etc. You can’t learn everything but as long as you understand it and you know where to find it you’ll get by.

  4. Let’s implement the methods mentioned above and keep practicing and building websites. It’s just like a trick writers use, to increase their creativity. For instance write 750 words and never look back for mistakes, grammars and other constructs just keep writing.

    So in case of css, don’t focus too much on memorizing properties but focus on your web app.

  5. Thanks Guil for this insightful plan to action article. I needed it as bad as California needs rain. Off I go to the text editor to practice.

    • You’re welcome, Cedric! Maybe I’ll send some of this Florida rain your way, too! :)

  6. Thank you Guil, I found this article very helpfull.

    I’m currently studying you CSS Foundations Deep Dive, I found your stages very exhaustive and I do appreciate that every one or two lessons there’s a Quiz or a Code Challenge, it helps better to understand and memorize what you just explained.

  7. Going into the closing spherical of matches, North Korea and
    Saudi Arabia were each on 11 factors and set to experience off in Riyadh, with Iran (on 10) experiencing a tie
    with South Korea in Seoul. Many thanks to
    a late Park Ji-Sung equalizer vs. Iran, second (and 3rd and a playoff place) would come down
    to North Korea and Saudi Arabia. North Korea held for a goalless stalemate, and many thanks to getting an edge in
    equally aim variation ( two to ) and head-to-head results (a residence earn the absent attract), North Korea instantly certified for their
    initial World Cup given that 1966.

  8. To help me remember what I’ve learned I save code snippets in Gistbox.
    A second thing I do is take very detailed notes when watching a Treehouse training, including pasting in code. I have a folder in Evernote called Treehouse Training. Within that I have separate docs for each Treehouse topic I’ve done.
    I can then easily do a word search to find the teaching on a past topic.

    • I do something similar to you with Evernote and my Android learnings. I have a note stack in evernote with 3 notebooks inside. One for basics, one for advanced, and one more for expert concepts.

  9. I don’t know you guys but it helps a lot to me to write each pice of code I learn by hand on paper. And since I can’t get a computer at any time during the day I can get some paper an a pen at any time. It sounds old fashion but it’s just a way to learn something.