Skip to main content
15 answers
14
Asked 399 views Translate

How to remember lines of code?

I want to get into computer science and remember python. #computer-programming #computer-science #technology

+25 Karma if successful
From: You
To: Friend
Subject: Career question for you

14

15 answers


4
Updated Translate

Lucie’s Answer

Hello Debbie,

A few tricks can help to remember lines of code:
#1 Cheat sheet
I always work with a cheat sheet, you have them for every language. A couple I use:
https://static.realpython.com/python_cheat_sheet_v1.pdf
https://programmingwithmosh.com/wp-content/uploads/2019/02/Python-Cheat-Sheet.pdf

#2 Search
Google or any search engines are your best friends. You can also look at YouTube or other videos for tips and tricks to learn more code, memo-technics, tips and tricks.

#3 Practice
Practice, practice, practice, there is a lot to take in when coding and the more you will code the more you will remember the different lines, format, etc. At some points you will not even lookup anything.

I am sure there are plenty of other technics and other ways to remember them. Good luck, it is a fantastic journey!

Hope this helps,
Cheers
Thank you comment icon Thank you! Debbie J.
4
2
Updated Translate

Samer’s Answer

Hi Debbie

You should not try to remember lines of code, you should understand the details behind why you coded the solution in such a way, ie the algorithm used, and which algorithm you should use to solve what type problem in an efficient manner. This is where you would shine in software engineering and software development. The better you are in finding the most efficient solution, the better you become a software developer.
The other aspect you should look at is design and design patterns, this is also an important subject to understand, and if you want to move towards more services and web development in future try to look into existing architectures and designs for applications such as netflix/whatsapp/instagram/etc..

The more you understand how people solved the challenges and get the bigger picture on how things link together, the better you are in having the fundamentals of engineering principal and sense that would aid you into programing the solution. The language you program in is the last part of the equation, today it might be a certain language, but with time new languages become popular and are created but the fundamental algorithms/design patterns remain the same.

So I would recommend you to focus on algorithms and design principals and not on memorization, there are a lot of tutorials on YouTube on design patterns and below you can find website that will help you with algorithm focus problem solving they are

HackerRank
LeetCode
topcoder

All the Best and good luck!
2
2
Updated Translate

Neha’s Answer

You should never be memorizing lines of code. You sure can do that, but that will not help you be successful. Plus, if you ever face a variation of the problem that you have memorized, you will not be able to solve it. Ultimately, you will not survive as a developer.

What you should focus on instead, is learning and understanding. Try to understand the solution, and the concept. Use words to simplify your solution, for eg. check if the number is larger than x. Now, substitute these words with syntax. Hence, focus on algorithms, data structures, and OOPs concepts.

When it comes to companies, you don't need to memorize anything. You have internet, and you can search for almost anything. All the resources online are there to help you write your code better. You can always double check the syntaxes online, rather than memorizing them.

As far as interviews are concerned, memorizing will not help you when the questions are different than the ones you learnt! That's where you need to practice. There are several websites that provide resources to help prepare for job interviews, like LeetCode, HackerRank, etc. The more you practice, the better you will get at them.
2
1
Updated Translate

George’s Answer

Hey Debbie,

Combination of things; I feel that you should focus on mastering your algorithms, data structures and design patterns. The knowledge of code will come from actual experience in implementing real world requirements using the data structures and design patterns I mentioned. Memorization almost never works as form of learning and application.
1
1
Updated Translate

Emmett’s Answer

It's not the best use of your time to memorize anything that's not conceptual when it comes to coding! Considering how many different programming languages and frameworks are popping up all the time, the wealth of StackOverflow answers out there, and all the different tech stacks used by different tech companies, it's a much better use of your time to learn about the concepts behind different programming paradigms and be able to apply them. If you just want to learn Python, though, there are plenty of online courses out there that can get you started AND teach you some concepts (to memorize) along the way: https://www.codecademy.com/catalog/language/python
1
1
Updated Translate

Kris’s Answer

Instead of committing specific lines of code or language-specific syntax to memory, I suggest you focus on mastering coding techniques, programming concepts, and data structures. And more than anything, strive to understand what is possible with code and how applying the techniques and concepts toward solving a problem can be magical.
1
1
Updated Translate

Mickael’s Answer

Hi Debbie

You do not remember line of code, you remember how to tell the program how to do things using a language. And the best way to remember how to basically code is to practice, practice and practice. It's like spoken language: you can learn in books but as long as you do not listen and speak, you will not remember vocabulary and grammar as fast as if you were practicing every day.
This is EXACTLY the same with programming language. You read some example, you practice.

I've been writing program in C for 16 years but there are parts of the programming language I barely used and I need to go back to C documentation to remind me the syntax. Simply because I lack practice in this area.

So the easy and magic answer is practice!!!
1
1
Updated Translate

Leo’s Answer

You don't, and when you do, it's because you practiced a lot.

When coding, always have the reference handy, or a cheat-sheet, like Lucie said. You'll notice that you'll end up using the same constructs and APIs over and over again. Over time, you'll start memorizing these things and you won't need to check the cheat-sheet anymore; but the important thing is: the goal is not to memorize things. Instead, you end up memorizing stuff because you use it a lot.

Also, you'll always need to check the APIs every now and then anyway. I don't think anyone can memorize a whole API (and there's no need to either).

Of course, if you really want to memorize stuff, then that's fine. But my point is that you don't need to. What you need is practice.

1
0
Updated Translate

kannan’s Answer

Hi Debbie ,

I would say memorizing the code may not help for future success. The programming language will evolve over time (i.e : C, C++ , Java , python , go etc).

I would recommend a focus on algorithms and logic to resolve the problem. this will be common for all programming languages.

Practising the code will help you to master that language. there is a lot of online programming tools available to practise to familiar with syntax and logic and efficiency.
0
0
Updated Translate

PURNASHREE’s Answer

Hi Debbie

You should not memorize the code lines.
When a problem statement is given to you or you want to write a code scripts, it is all about the logic you think of in solving the problem statement given to you. Logic can be applied using many appropriate programming languages.
You should have a clear understanding of the basics of the programming language, Algorithms and Data Structures.

To learn and get a hold of any programming language practicing more is essential, there are many free online programming tutorials and portals through which you can learn and practice.

Happy Learning and All the best !!

-Purnashree N
0
0
Updated Translate

Jennifer’s Answer

When coding, regardless of the language, I like to relate the syntax of the code more "every day" words. Taking away the technical speak has helped me also translate between languages as well as communicate my approach with others. Remember no matter how technical you get, it is also important to be able to communicate your ideas to all audiences.

As previously suggested, cheatsheets are great. You can continue to add to this as you find items that are challenging for you as well. You won't be able to memorize everything as the hope would be that there would be new features available to introduce to your code. I usually try to remember the basic feature such as "What if" or "case"; then search for this and including "python syntax" will help provide the details. Sometimes people also post some examples that help as well.

Keep working and over time you will continue to add to what you know, but it will be difficult to always know it all.
0
0
Updated Translate

kannan’s Answer

Hi Debbie ,

I would say memorizing the code may not help for future success. The programming language will evolve over time (i.e : C, C++ , Java , python , go etc).

I would recommend a focus on algorithms and logic to resolve the problem. this will be common for all programming languages.

Practising the code will help you to master that language. there is a lot of online programming tools available to practise to familiar with syntax and logic and efficiency.
0
0
Updated Translate

Rahul Kumar’s Answer

Hello Debbie,

I would say, you did right asking this question in the first place, as many of us think this way that we need to remember/memorise line of code to be able to perform our tasks but let me tell you a simple example-

In childhood we memorised A,B, C, D... till Z
We memorised 1, 2, 3 ... to 10 or 100 or so on.

But, we never need to memorise the sentences what we speak/write or a number which comes as a result of some manipulation of 2 or more numbers.

Same goes here,
1. you might need to remember syntax for the language or framework going to be working with but not the line of code.
2. Code will be generated by you brain when you know what you are going to write using those syntax

Also, Technology has grown to such an extent we have Google as our friend and many tech forums like stackoverflow even technology and framework documentations, tech courses on udemy, youtube and many more. We do not even need to remember the syntax as its all there available for us.

You just need to think of what you want to write or implement- break it down- break it further till you get a smallest piece of the problem you are trying to solve and then start writing those pieces and it grows to become the solution you are trying to build.

So I would say you do not go for memorising rather go for utilising your skills in thinking what you wanna build and how part will follow.

Thanks,
Rahul
0
0
Updated Translate

Seetharam’s Answer

Hello Debbie,

This is a common feeling when we start coding/programming. As others suggested, to get comfort with coding/programming, I highly recommend that you must learn problem solving in general. Then think of the algorithm, steps that are involved to solve the problem. It can be any type of problem. Once you get the pieces and understand them closely, I think you will get the some idea as well as more interest in problem solving.

Once you clear basics of problem solving, then think of writing software code. This can be done in many languages, like python. As you know that, you need to know some fundamentals of computer programming language to start coding. Learning first programming language will be a little challenge, but make you more comfortable going forward.

I would suggest you try not to remember code, you try to understand algorithm. All the best!!!
0
0
Updated Translate

Moshe’s Answer

Hi Debbie,
All of the above answers are really great and point to the gist of the issue. Understanding it key, but then also I believe sometimes to remember unique code ideas that I have written I keep a log of those code snippets (in many different languages), I document the code and store it in my own workarea. Then when I need similar ideas or concepts I just look at the log to quick start some solutions.
All the best and good luck,
Moshe
0