I don't known if you guys have super brains specifically for programming but I would like to know how you do manage to learn, understand and apply Java programming. I am in grade 11 and we have learnt statements, objects, classes and arrays. We get programming test each week and I'm failing them. Now we have a project to do BlackJack using a JPanel form. Also memorizing the while loop is not the problem; I think that the problem is applying it to the situation (my friend never programs the same way as the teacher but still gets the same results).
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
marked as duplicate by Mark Trapp Oct 16 '11 at 20:55
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
You learn to program by programming. There really is no substitute for experience. After you've solved enough problems, you start to make mental associations. Then you encounter something you have to do, and it's conceptually similar enough to something else you did earlier that you realize you can solve it in basically the same way you did the other thing.
There are really only two parts to programming: Having a repertoire of solutions to problems, and the analytical ability to break down a large problem into smaller sub-issues, and then break those down further, until you turn them into individual pieces that you have a solution for. Both of these skills are built up by experience.
EDIT: Let me add one more thing. If you really want to learn to be a good programmer, think of programming skills like muscles. They grow bigger when you exercise them and push them to their limits. Keep looking for new problems to solve, things you haven't done yet, and learn how to solve them.
There are two key areas:
Some of these naturally come easier to some people just like Math or English might come easier. If it is something you struggle with then the solution is more practice just like learning Math.
It's very good that you're asking for help. The key to learning to program is
Memorizing is not a good way to learn programming. If you have something you want to do, you will realize the purpose of each piece of the language.
ADDED: Ok, if you really don't know where to start, I used to teach this stuff so let's see if I can help. It was 30 years ago, so we used BASIC for introductory programming, later going to a structured language. Now people will jump all over me for this, and you can get bad habits from BASIC, but I still think it's good for when people are starting from nothing. Maybe you can do the same thing in Java, I don't know.
You write and play with a series of programs, such as:
At this point, you have used print statements, input statements, string and numeric variables, assignment statements with calculation, IF statements, and looping statements. Pretty good!
There are more speed bumps, such as file input/output, subroutines (sometimes called functions or methods), and all into more modern stuff. But hopefully that will get you started. As I said, you need to quickly get enough of a skill base that you can consider doing some simple but fun project, such as your black jack.
It sounds like you're not fully understanding some of the fundamentals. In computer science classes after they get past the basic concepts like assignment, half the students tend to catch on, where half the students fall behind, there are two separate curves. Thats because half the class learned just enough of the fundamentals to get by, they cut and paste code from the book, but they don't really understand it; then they have to write harder code and they hit a wall.
It sucks, but there's no other way. Since you're learning programming in a class, you should have a textbook. Go back to the earlier chapters of the textbook, and read through them. Then, try, yourself, writing some REALLY simple programs to test what you know, and slowly make them more complex and utilize all the different concepts.
You mentioned memorizing the loop isn't the problem, but how to apply it. Well, there's nothing TO memorize with a loop, unless you mean the syntax. What you need to learn, what you need to understand, is EXACTLY what the loop does, and what you can use it for.
If you're asking whats the best way to learn to program: You're already doing it. Get in a class, with a structured curriculum that you have to keep with, so you don't end up blowing it off or skimming a book.
I cannot stress enough. Knowing the difference between if(i = 10) and if(i == 10) is everything. Knowing your fundamentals is everything in writing code, understanding algorithms, and learning computer science.
Here's why your friend is able to write programs differently than your teacher. He either now or at some-point prior (I wasn't sure if he had prior programming experience) took the time to not just learn how to replicate the program but also understand what the commands are doing. I'm sure he (whether it was conscious or not) asked himself every time the teacher put up an example, "what is that doing?" Perhaps he even asked himself right then what another way of doing it would be.
The worst possible thing you can do as a programmer is memorize a solution for a problem and not also understand what is happening. If you understand what is happening then you can always recreate the solution even if you have forgotten it otherwise. You can also generally modify the solution to meet other needs for other problems. If you only memorize the solution but take no thought at how it works or why its the solution then when you forget it (which you likely will), you won't be able to reuse it later.
Aside from gaining full understanding of the code you see/write, the biggest thing you can do to improve is practice.
The journey of a thousand kilometers beings with a
How do you build a house? How do you make a clay pot? How do you write an essay?
What is the common most basic way to answer those questions?
You get the right materials, and tools to construct the object.
It always amazes me to see how all house are built with the same things, but some are better then others. The are works of art while others you would not feel safe in and should be torn down. It comes down to the skill of the workers in using the materials and tools together and solve problems of building a house. Some houses are works of art, and that comes down to how well they can express their creativity with those components.
I would break down you problem into two areas. One is understanding the tools and materials you need to build a solution to a problem. And two is how to solve a problems. In programing the material we use at the simplest form is down to these things SSI (sequence, selection, iteration):
Those are the building blocks, of a solution to any problem that can be expressed as code. Know you material, its strengths and weaknesses. How it works. This is the basics of all programing. It changes names from language to language but the essence remains the same.
The tools your
The place where a lot of new students struggle is with the problem solving. They have all these materials they just learnt about in sequence selection and iteration. They just don't see how to build the house or write the essay with them. The solution to that problem is to stop thinking about the material, ie do I use a
It is too easy for new students to get bogged down in details and they do not clearly see how to solve a more complex problem that is longer then a few lines. Problems that require you to think about the over all structure of you code. It becomes difficult to see how you solve the problem(creatively) and with what you solve it with(code SSI). You don't solve the problem with the materials (SSI). You solve it with the right tools together with the materials.
When your start writing an essay you don't think about how long a sentence should be, what words to use. You think about the topic how you want to cover it, what sections you will break up the content into. Only after that do you sit down and think about the first sentence, the introduction paragraph, the conclusion paragraph. What words you are going to use. You know how to do this because you have practiced, you have been taught the components of an essay. Programing is no different.
On a different note. One of the best things you can do is learn to type faster, get a typing tutor. There are a number of free ones on the internet. This will help with every aspect of your problem solving, and using materials and experimenting with them. http://steve-yegge.blogspot.com/2008/09/programmings-dirtiest-little-secret.html
It really helps if you love doing it. Before I started my degree in computer programming, I hated any reading that was for school, but now I willingly read all my programing books and then some. I also do work through extra problems to help understand new concepts and help other students in my free time. You can't just put half your heart in.
I would suggest spending a day catch up with the class, do all the reading and work through what you don't understand, then if you are still having trouble talk to your teacher, they are usually willing to give you more time if you are putting in the effort.
Practice is your friend here. The other thing you want to do is understand what each line in the program is doing. There is a lot to under stand so don't try to do it all at once. Learn to break the problem down into a bunch of small chunks and figure out how to do each one, then put them together. (Really that is the heart of programming).
What I would say if you are banging your head on Java try something else, Ruby, Python or Scheme might be good choices. Specifically I would look for the book "The Little Schemer" its a nice little introduction to some concepts.
Oh and if you get stuck ask the teacher for help, thats what he/she is there for!
I think the best way to learn programming is to immerse yourself in it and make it your passion. Think of a really cool program you'd like to write that would be really challenging. Now spend an entire summer banging your head against the wall trying to get the simplest thing to behave as expected, figuring out all the cryptic compiler errors that you run into ad infinitum, and find good resources - books, blogs, tutorials, forums, this site - and use them constantly. By the end of the summer you should understand some of the core concepts in programming. Truly understanding them will take being able to think about abstract concepts in ways you never have before. But once you learn some core concepts - OOP would be a good base - more advanced concepts will get progressively easier to understand.
Whatever you do, don't assume that going to class and doing assignments alone will be enough to learn how to program effectively. I seriously doubt many people get proficient at programming through classroom instruction alone; to truly learn to program, you have to write a lot of code, spend a lot of time extremely frustrated at why nothing ever works the first time you try it, and then breathing that sigh of relief and accomplishment when something finally comes together that you've worked very hard on.