Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Head First Mixed Messages problems

 
Tom Never
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've been working through Head First, and on Chapter 4 now. My question is: Do other readers of this book figure out the answers in their head? or by scribbling on paper? I have to type in the program and run it for results. Am I just not understanding what is going on in the programs?
signed,
slow learner
 
Adam Price
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For me it is a mixed bag. Some I can do in my head - others I can do if I write something down and track the execution with a pencil. Others I write down, then make a table showing the value of various identifiers, again changing as I step through the program with my pencil. I try not to actually type anything in, because I worry that that will get me focused on gettting answers instead of understanding. I may have a leg up in working through them in my head because I have taught calculus, and it feels like the same part of my head is being exercised as when I have huge stacks of homework (of varying elegance and logical consistency) to review - that can really be difficult to wrap the gray cells around.
[ January 18, 2006: Message edited by: Adam Price ]
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Different people learn differently and at different rates, so don't be concerned if you think it's going too "slow." You're building a foundation, so make sure that you understand the concepts before moving on.

I didn't use Head First, but when I was first learning Java, I was frequently surprised by output. So I made an effort to write and run a lot of test code so that I could verify my understanding. The more you work with it, the more natural it will become.
 
Tom Sullivan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I first started learning, I could not figure it out in my head. Like any non-trivial learning experience, you get better with it the more that you practice. After having gone through several Head First books, many of the things I found difficult early on are now so simple that I wonder why I had problems learning them � probably just overcomplicated things. It took a while to get to that point though. This forum and the Head First books are excellent resources when it comes to learning. That is the beauty of all sciences� science invites everyone to learn despite their credentials or qualifications.

Head First does a good job of simplifying the message. In some areas, it does not give enough information to make the subject clear but it is not a reference manual. You may consider a reference manual along with the Head First books to supplement the learning there. I have several. I know it sounds strange but I got a lot out of Java All-In-One Desk Reference for Dummies. I have others like Java in a Nutshell but I refer to the dummies one often because, well, I am a dummy and it is easy to understand.

I also created a personal project to learn. That was arduous but well worth it. I built a workout tracking system where I got to use Swing, XML, JDBC, RMI, JavaMail, FileWriters, HTML Parsing with SourceForge�s HTML Parser and the like. Doing that taught me more than anything and made sure that what I learned in Head First was actually put to use. After the frustration of trying to get something to work and having it finally do what was expected was fun. Plus, chicks dig software developers! Well, at least certain chicks do.

You might also go through the Cattle Drive and Rules Roundup exercises here.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't own this book, so I assume you are asking about questions such as "What is the output of the following program?" For problems like this, I suggest you try to figure out what the program will do before you type it in and run it. Many of the techniques that Adam described above work well. I particularly advocate using pencil and paper to trace through the execution of a program. A table with variable names is helpful for tracking their values.

Once you figure out what you think the output will be, then compiling and running the program is a good way to check if you are correct. If you are surprised by the outcome, then you should figure out why it differs from what you expect. This is definitely a good situation to come here to the Java Ranch and ask a question such as "I have the following code ... I expected it to do XYZ, but instead it did ABC." You can also explain your reasoning for what you thought it should do. In fact, you may find that reviewing your reasoning will help you understand what actually happened in the program. If not, someone here should be able to help you understand what is going on.

Good luck with learning Java!

Layne
 
Tom Sullivan
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Layne,

The book uses exercises like code magnets (bits of code jumbled up on the frige) where you are supposed to spell out a working software program. I think the question was more along the lines of: is it just me or is it really hard to step through the code in your head? Just personally, it was for me when I read the book but it got much easier over time. If Tom is at chapter 4 and has no development experience, it is unlikely that he would be ready to ask questions about code running the way that he expects it to run. I imagine that he is more at the tell me how it works stage rather than the let me ask you about what I am trying to do stage.

Cheers,
T2
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic