I'm learning Java, and I found a great teacher. He explains everything perfectly. I understand it all. My problem, is that after learning a short section, for example "Nested If Statements" or "Many Methods and Instances", I can type it all great, but in 5 mins, after going on to a new section (when I'm comfortable with the last section) I forget the code to type for the last section. Any tips or techniques you guys use to remember code????
-
13Don't just book learn. Programming requires projects and specific problems to solve to stick in your brain. – Merlyn Morgan-Graham Oct 12 '11 at 00:44
-
8Practice practice practice. – Oct 12 '11 at 00:46
-
I have to revisit stuff I've written all the time. It sinks in just when it doesn't seem that earth-shattering anymore – Oct 12 '11 at 01:21
-
3It means your knowledge is superficial. You haven't really "learned" it. – BlackJack Oct 12 '11 at 01:43
-
2Seek to understand, not to just memorize the answers. – Jeff Grigg Oct 12 '11 at 01:55
-
Do you have this problem with other subjects? It's possible that you're dealing with a learning disorder of some sort. Not saying that's the case, but it's always a possibility... and if it is the case, "more practice" probably isn't the solution. – Joe Internet Oct 12 '11 at 02:08
-
No matter how well he explains things, nothing will sink in unless you are trying to solve a problem. I used to teach programming, and the liberal arts majors were terrific studiers, and they wondered why just studying didn't seem to help in programming. Studying, versus thinking through a problem (and making mistakes along the way) are different skills. – Mike Dunlavey Oct 12 '11 at 02:08
-
You suffer from Anterograde amnesia which is the loss of short-term memory, the loss or impairment of the ability to form new memories through memorization. Persons may find themselves constantly forgetting information, people or events after a few seconds or minutes, because the data does not transfer successfully from their conscious short-term memory into permanent long-term memory. – Rudy Oct 12 '11 at 03:41
-
Answer: Fourty Two. – Job Oct 12 '11 at 03:45
-
http://www.youtube.com/watch?v=SlCRfTmBSGs – Konrad Morawski Oct 12 '11 at 10:46
-
@@MarkTrapp where is your comment on "this is not a real question because ..." ? – Raynos Oct 12 '11 at 13:03
-
do you know why some chinese monks practice martial arts in early morning almost everyday? to master what they learned. so practice is the key to master something. you forget what you learned, but you don't forget things easily if you mastered it. so everyday do something in programming, at least an hour. master at least few languages, frameworks, learn concept and master them. – Don Dilanga Jul 11 '18 at 10:11
14 Answers
If you are just rote typing what the teacher shows, the knowledge will go in one ear and out the other. Take the examples he gives, and change them a bit, play around. If they're just exercises, it won't matter. By making even a simple change, like "I want to display the numbers sorted in reverse instead", or something, it forces you to understand the example instead of just copying it. Then take that after class and try to do more with it, extend it, incorporate it into something else. You'll find that your understanding goes up, and when understanding goes up, you don't have to remember as much.

- 2,288
- 14
- 13
-
4+1 "when understanding goes up, you don't have to remember as much" – Mike Dunlavey Oct 12 '11 at 02:03
-
this is the literal opposite of the results of the Bloom Methodology of learning, which is troubling as it is also the typical understanding of learning in programming circles. – bharal Sep 14 '18 at 12:23
The best way to learn how to code is to write code. I have a saying "The more code I write, the more right I code." Come up with a small sample application that you think will be helpful for you and code it. Come back to http://www.stackoverflow.com if you have specific questions, and go to codereview.stackoverflow.com if you want others to look at your code and give you feedback.
Also read. A lot. Heres a list that'll get you started: https://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read

- 151
- 4
Don't stress. What you are talking about is "ephemeral". These things (syntax, language quirks, etc.) will become natural through practice, and are constantly changing.
What is most important is that you learn to program. The most important concepts will last throughout your career and will exercise your problem solving abilities, not your memory. An IDE, Google, StackOverflow and practice can help you through the rest.
-
1@BlackJack If you look closely at any of my writing you will find absolutely zero consistency. It's like my fingers can't decide. Although since HTML doesn't display double spaces I guess you *did* have to look closely... :) – Nicole Oct 12 '11 at 03:16
It's like clothes in a closet.
Without something to hang them on, they will fall to the floor.
What you need to hang programming concepts on is one or more problems you're trying to solve.
Just typing stuff in, without having a problem you're trying to solve, is like throwing your clothes in the closet and expecting them to hang by themselves.

- 12,815
- 2
- 35
- 58
You have to simply start developing things, after doing some things a few time you will get to know how to do it in future projects. Its important that you just do it many times :)!
Depending on your learning style, it may be important for you to understand the motivation behind using certain constructs in your programs. Many programming books are written so that they build these concepts upon each other chapter by chapter. Try skimming ahead by one chapter while you're doing the exercises for the prior one.
This way, you can say, "okay, it makes sense to use an if
statement in this case, but I know that in another scenario, it's more effective to use a switch
statement." That way, the concepts are linked in your mind, and you can always briefly check back for any syntax specifics that crop up (and those will definitely become second nature before long).
kylben's idea of extending yourself by modifying each assignment slightly is also a great way to keep on your toes with things. You can also come up with "capstone" projects for every couple of chapters and challenge yourself to build something with everything you know so far.

- 585
- 3
- 10
- 28
I couldn't agree more to what the other people have been saying here, programming is learned by doing. The more coding you do generally the more you learn. Having said that many other things are important to learn how to code right, for example never forget to read by looking at how other people learn, read on on new tools and technolgies and browse daily in Q&A such as programmers.com.
As for actually remembering what you learn, once you finished writing a bit of code then explain to yourself silently what you actually have done or explain to a fellow coder. By doing this I find that I remember much more clearly and it gives me the opportunity to reflect on what I have done. Also try to challenge yourself by coming up to alternate ways to write the code you've just written, better or worse. Play around with the problem you solved and think how you would need to change your code if the problem its intended to solve would change slightly.

- 354
- 1
- 6
Do not use any intellisense or autocomplete while learning (if you are using..). Try to type every syntax on your own and correct them on your own from the compiler results. Also dont do this while you are with your teacher. Practice when you are at home...

- 163
- 9
The way to learn is to practise; to write code; to get annoyed and frustrated by forgetting by mistyping a single variable :D
Pick up a problem and try to solve it; soon you'll be writing code without worrying about syntax.

- 111
- 3
Maybe writing software is not for you.
When I was 13, I was writing in AppleBasic and Pascal. Programming made perfect sense to me.
It's the opposite with electrical engineer topics. In one ear and out the other. I never learned much in my EE classes, and I quickly realised I was never good at it.
That's why I'm a software engineer now instead of an electrical engineer.

- 2,736
- 2
- 18
- 14
It's all about practice. The best way to learn programming is to build project alongside, and improve it every time you learn something new.

- 101
My advice is that you find yourself a small but concrete project. If you want to practice if statements, implementing some kind of classification quiz could be a good excercise: the program asks the user to choose an animal out of a given list, and then asks questions like "Is it a mammal?", "Is it a bird?", and tries to guess what the user has chosen. One way to implement this is using a lot of nested if-statements.
Then you have to struggle through the project from specifying the program behavior, to coding, testing, debugging. Any time you do not remember the syntax or semantics, you go back to your book, read your notes, try to understand compiler errors. When you are finished and your program is working as expected, I am quite sure that you have learnt if-statements (and some other stuff as well).
This is at least the only method that really works for me when I want to learn a new programming language. For example, I have been trying to learn Haskell for the last two years, but just reading the book and writing small pieces of code is not enough: I keep forgetting stuff. Then I had the possibility to write a small tool (in Haskell) at my company, and I really learnt a lot.

- 19,486
- 16
- 84
- 135
Try to explain what you just learned, it doesn't matter to whom (it can be the famous rubber duck), just be serious and patient, and don't leave out things that are "obvious", but pay attention to the details. You'll find out that you still have gaps, and that you need to go back to things you thought to have understood.

- 1,993
- 1
- 13
- 19