How to Study Computer Science

Learning a programming language is a much more difficult task than almost any other course in college, because it requires incredibly detailed rote knowledge as well as very difficult abstract problem solving.  The study habits that have worked for you in other courses may not be sufficient to succeed in this course.   What follows are some study techniques and learning strategies to help you master a new programming language.

How to Read the Textbook

Read each chapter of the textbook at least three times.

First Reading  ("reading for orientation")

This first reading is just to get oriented to the content of the chapter.  The first reading is superficial.  You can skip the examples. Don't try to comprehend every detail.   Just familiarize yourself with the general ideas that are being discussed.  Get acquainted with the overall purpose and goals, the main points being presented, and the way the chapter is layed out.  Then put it down and let it "incubate" in your brain overnight.

Second Reading ("reading for comprehension")

The second reading is where you read in order to comprehend and understand the concepts and ideas being presented. Attempt to understand every new idea you encounter. Don't just move your eyes over the page.  Stop after each paragraph and ask yourself "does that make sense?" "What did I just learn in that paragraph?"  If you don't feel confident in your understanding, read it again.  If you still don't understand, put a question mark in the margin and come back to it after finishing the section.  If it still doesn't make sense, ask a question in class, ask a tutor or peer, or ask the instructor.

Look at the examples to see how they relate to the concepts or principles.  Be sure you can see how the example is a specific instance of the general concept being presented.

Every time the author introduces a new vocabulary term or concept, say the word out loud.  Speaking the work aloud activates a different part of your brain and will help you retain the word and be able to recall it more readily.  Remember, half of being an expert is talking like an expert. If you use the proper word you are halfway to mastering the concept.

At the end of each section, take a minute to consciously recall the major points your learned.  Perhaps jot them down.  Then flip back through the pages and make sure you recalled all of them.

Third Reading ("reading for detailed understanding")

In the third reading you engage the text. The third reading is the most important and differs from the previous two because it is active participation with the content.  Read the textbook again but this time focus on detailed understanding.  Read every sentence with the goal of complete understanding. The goal is to master every detail.  This is important in programming because a successful program requires every detail to be correct.  Even one minor error will cause your program to fail and sometime fail in a catastrophic way.  You don't have to memorize every detail, but you have to understand what it means and how to use it properly.  On an lab quiz you will be allowed to use the textbook so you don't need to memorize syntax details.  For example, you need to know there is an arithmetic operator that will return the remainder after a division.  You need to know how that works and what situations it can be used in.  But you don't need to memorize that the symbol is a percent sign.  (It will be different in different languages.) You can look up the symbol when you need it.

Study the examples.  Trace through every single step of each example.  Make sure you comprehend the transformations at each step in the solution of a problem.  One technique is to inspect each line of an example and describe out loud to yourself or to a study partner what each step is accomplishing.  In an example program you should be able to explain the purpose of every single character or symbol.  Every detail is there for a reason and you need to be able to explain it.

Another technique for working with example program is to do a hand trace or desk check1 of the program and see if you compute the same results as are shown in the example. 

Explorations - interacting with programs

One of the most powerful learning strategies is to use the computer itself to interact with example programs.   This is such an important strategy that it deserves to be explained in detail.  Please read Exploration Strategies: How to Learn a Programming Language.

You should then perform several explorations using the example programs provided in the chapter.   The goal is to gain complete understanding of each new construct, concept, or technique presented in the chapter.

Self-test - Assess your knowledge

The simplest way to assess whether you've learned the material is to complete all the self-check exercises or chapter review exercises that are provided by the author.  Often the answers are provided in the appendix.  If you have difficulties with an exercise, review the appropriate section in the chapter.  If you still can't get it, place a question mark in the margin and ask for help later.  Usually the instructor can answer these kinds of question via email.

Next, work the "prediction problems" provided by the instructor. (CPE 101 only)   These are short programs for you to examine. 
  1. Study each program to try to comprehend what tasks it performs. 
  2. Then use a hand trace1 to trace the execution of the program using the input data provided.  Record the hand trace in your lab notebook. 
  3. As you are performing the hand trace you may encounter a statement that you are unsure about.  Take a minute to look it up in the chapter and see if you can determine how it operates.  
  4. When you have completed the hand trace you should have a "prediction" about what output will be produced by the program.  
  5. Now actually compile and execute the program on the computer and observe the actual results that are produced. 
  6. Carefully scrutinize the actual results and compare them character by character with your prediction. 
  7. If there is a discrepancy this indicates some misunderstanding on your part.  Review the program, referring to the text, until you can explain the discrepancy.  Make a note in your notebook to emphasize the correct understanding. 
  8. If you can't explain the discrepancy, make a note in the margin to ask for help later.  

In a manner similar to the explorations above, you can create mini-experiments to check your understanding.  Predict the effect of some change to an example program, then perform the change on the computer and verify your prediction.

Studying with a partner or two is an excellent strategy.  Partners are especially helpful at this "self-test" phase.  You can invent quiz questions to ask each other, based on the self-check questions.  You can create prediction problems for each other, based on the example programs in the text.

Finally, the most thorough test of your understanding is to write a complete program.  Start with the programming problems at the end of the chapter.  Read all of the problems and formulate a plan in your head of how to solve it.  You should be able to at least invent a plan of attack for most of the problems.  There may be one or two advanced or "challenge" problems that resist easy solution; you can skip them for now. 

Next select two or three problems that look interesting and actually write a solution and attempt to get it working on the computer.  Your goal is "fluency," that is, being able to work through the solution from start to finish without any major hangups in a reasonable length of time. Of course, what is "reasonable" varies from problem to problem; ask your instructor for guidelines.  If you get stuck, make a note to ask for help later.  If you manage to stumble along to a solution, but not smoothly, this indicates you need more practice.


Your peers in the class.
Friends in other classes.
Study groups.
The instructor (attend his/her office hours!)
Alternate textbooks.  There are many different textbooks.  The instructor will show you several that are even available on the web.  You can find more in the library or in a bookstore.  Reading an alternate textbook and comparing it to your primary textbook is an excellent exercise.

1 Desk check or "hand trace" is explained in the Hanly & Koffman textbook. (Look it up in the index).