How to learn code without forgetting it

Hi, the guru(s) in the house, I’m just curious wondering if there’s a way to learn a code and not forget it Thanks in advanced

You have to practice. I contend that unless you have a photographic memory you will need to practice whatever you are learning.

Outside of the course, finding somewhere to apply what you have learned can be very useful. You could contribute to open source code bases. Or just look for exercise websites like CodeWars or exercism.org. There are lots of places to put what you are learning into practice.

That being said there will always be some parts that you just have to look up when you need them. For example, I have never wasted my time memorizing the APIs in the Java collections library, but I use it frequently and refer to the Javadoc when I need to know particulars. Almost all languages have some central documentation for the language which is good to reference when you need it. You have to memorize basics, but anything else can basically be looked up when you need it. Even specific things about grammar can be looked up if they are uncommon. For example, you may not remember if the switch-case falls through by default in the language you are learning (and not all languages make the same choices on what the default will be).

If you know how to write functions, conditional logic, loops and some of the basic collection stuff, you are well on your way in any programming language. Keep practicing and you will find yourself looking basic things up less and less.

2 Likes

Makes complete sense yet often, we are more or less explicitly expected to do so.

P.S. I quoted @jmrunkle but the answer is mostly toward the OA.

I also feel a bit bad for having forgotten things here and there. But maybe it is just unrealistic expectations. One need to accept that when a skill is not flexed on regular basis, it is simply forgotten. The things is next time you learn it anew, it is often easier to learn.

Also knowledge is like a snowball. It is hard to remember new things at first but as you go, things become easier to remember. Reminds me also about SRS. Not System Requirement Specification but rather Spaced Repetition System in which you are asked about things you want to learn. Should you answer correctly you will be asked the same thing at a longer time each time.
So a new thing is asked tomorrow, in 3 days, a week, two weeks, you name it… Until eventually you are asked that in over a year.
When I used to learn Japanese I used a tool called Anki. You can also find alternatives.

To sum it up: don’t expect to much from yourself yet keep pushing.

On a lighter note:
On this Sunday I personally planned to take my Jenkins course and work on some basic HTML because CSS is simple overall yet surprising oftentimes.

Good luck
(I don’t think good courage is correct English but it is not exactly luck I wish for you. Rather courage to pursue and wisdom to accept you’ll need to work regularly to get good results.)

1 Like

Thank you so much for this.