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????
closed as not a real question by user8 Oct 12 '11 at 7:36
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.
migrated from stackoverflow.com Oct 12 '11 at 0:47
This question came from our site for professional and enthusiast programmers.
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.
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
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.
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.
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 :)!
Practice, practice, read notes, practice, and practice.
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.
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.
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...
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.
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.
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.
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.
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.