Tuesday, March 19, 2013

Cycle 4

Welcome to Cycle 4!

This week, I've been looking at some savvy new Java techniques. I studied different types of variable usage, such as operators, and decision making statements, like if/else statements. I also allowed myself to become familiar with my IDE so I could start using the things I had read about to start writing code.  The new things I have learned this cycle are more advanced than the fundamentals, which made it a bit difficult to understand, but once I put them into my programs, I should be able to understand the concepts.

This week, I started learning about operators. Operators are symbols that you can put between numbers, values, or variables in order to perform mathematical operations with them. The usual operators are +, -, *, and /, which mean, addition, subtraction, multiplication, and division, respectively. But there are other operators that can be used on top of these. These operators are symbol like > and <, which mean greater than or less than. These operators are useful when you are looking to ask the program to do a specific function when a certain value is greater or less than the other.

Now, I'll talk about if/else statements. These are lines of code that tell the computer what to do when it encounters a fork in the road. For example, let there be a program that played a guessing game with a player. The computer would pick a random number between 1 and 10, and the player would try to guess the number by typing it into the keyboard. This is a prime time to use the if/else statement:

if (inputNumber == randomNumber) {
System.out.println ("You win. Nice guess!") ;
} else {
System.out.println ("Sorry, but that isn't right.") ;
System.out.println ("Thanks for playing.") ;
}

This is only a part of the program described above. The if statement above tells the computer to check if the number the player put in was the actual number (inputNumber is the number that the player puts in, and randomNumber is the computer's number). If this is true, then the computer tells the player that they win. If the statement isn't true, the computer moves on to the else statement. Reading this, computer tells the player that they lost. If/else statements are great for use when the action needs two paths to fully address every aspect of the function. This is one of the most commonly used statements in most programs.

Another thing I learned this cycle was how to make an introduction to my programs. Think about introductions this way: If a lecturer started talking about a subject like Java programming without a proper introduction, the speaker would have to keep reminding the audience that he/she was talking about Java. With introductions, the audience would not have to be reminded of the topic. This is why Java introductions are so efficient. They allow a programmer to tell the computer that the program is mainly trying to do one specific function. This allows the programmer to omit certain lines of the code, since the computer already knows what it needs to do. Let me give an example of an introduction:

import static java.lang.System.out

This introduction lets the computer know that the program is about printing something on the computer screen. This means I don't have to put a certain phrase every time I mention a variable. It makes the code much more streamlined and easy to use.

This week has been really interesting for me. I started to learn about some new, advanced programs that reinforced the fundamental concepts and helped me move forward with my quest to lean about programming. As I mentioned, my IDE will be a great help to me now, since I actually know how to use some important features. By next week, I hope to start writing some of the simpler programs that I want to show during my TED Talk.

I hope my journey has been just as interesting for you as it has for me. See you back next cycle!

Take a look at my video blog to see how I started with my endeavor.



1 comment:

  1. Hey! I ABSOLUTELY LOVE YOUR BLOG THEME!!! The Matrix, right? Awesome choice! Anyway, you seem to be making great progress as far as I can tell. This was a very cool idea that I find interesting, however I never could have done it myself. This makes your blog very appealing to me, and I wish you the best of luck as you continue on. In addition, I would like to say thanks for checking out my blog! :)

    ReplyDelete