Notes
Outline
Learning
Learning is a pull not a push.
Learning takes effort
Learning complex subjects requires dedicated brainpower
Strategies for learning
Learn from an expert.
- take a class
- read the book they wrote.
Books are your friend.
Typical website on HTML – 10 pages.
Typical book on HTML – 200 pages.
Indexed
Ordered from basics to more complex stuff.
Reading for learning
Read a section to start setting up a mental  framework.
Try to use what you read.
Read it again!
Read a different book
Programming is a skill
Learn by watching others
Read the code they wrote
Start with the basics
- don’t jump in the deep end.
Practice makes perfect
More on if.
if (x > 3) ;
g.drawString("x is too big", 50, 50);
; is empty statement.
// if (x>3) don’t do anything
if (x > 3) ;   // we don’t want this semicolon!
// always write "x is too big"
g.drawString("x is too big", 50, 50);
; = end
// this is correct
if (x > 3)
    g.drawString("x is too big", 50, 50);
// using curly braces is safer
if (x > 3) {
g.drawString("x is too big", 50, 50);
}
infinite loop
// Loop forever because we never get
// to the statement that changes x.
while (x < 3) ;
x = x +1;
Reformat code to see problems
Remember the compiler ignores all white space, so indentation is a convenience for us.
while (x < 3) ;
x = x +1;
if (x > 3) ;
g.drawString("x is too big", 100, 100);
While loop
int counter = 0, x = 10;
while ( counter < 8 ) {
g.drawString("*", x, 20);
   x = x + 10;
   counter++;    // counter = counter + 1
}
While loop
int counter = 0, x = 10;
while ( counter < 8 ) {
g.drawString("*", x, 20);
   x = x + 10;
   counter++;    // counter = counter + 1
}