Sunday, October 14, 2012
Boolean 2
This week, we learned more about Boolean. We had a lab involving CodingBat, which was straightforward for the most part. The hardest part of using Boolean was using nested "if" statements because I didn't exactly know how to write them myself. I realized that I can really only write code myself if I see a correct example of it the first time. Otherwise, I'm mostly going blind writing the code. The trickiest part when writing nested "if" statements is your ability to read it. Java doesn't mind it if you don't indent anything or if you don't organize your statements. However, indenting different lines actually really helps you understand the problem as as whole. This is what I discovered when I did the MakeChocolate problem in the lab. I couldn't visualize everything at once, and it was difficult doing the trial-and-error method where I wrote something and compiled it just to see if it would work. Instead, I had to take it one step at a time and start from scratch. I wrote one if statement (with or without nested ifs) and looked to see if there was perhaps another possibility that I was missing. Then I would write the next statement. I realized that if I organize my statements in this fashion, it will be much easier logically to write the entire code correctly as opposed to trial-and-error. That was probably the hardest part about writing these codes. A lot of the problems in the lab involved math that was a little more complex than I would have liked, so I wasn't able to logically think of all the possibilities in the beginning. Besides that, the other problems in the CodingBat lab were fairly straightforward. I like Boolean a little more than the the other subjects we've been studying so far.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment