Monday, June 27, 2005

the new system


The goal of OOP is not to teach programming but i really feel that at least there should be something i can do to help my students. so i started the following strategies for class.

The Pilot-Copilot system -- pair programming where one person (the copilot) is not allowed to touch the keyboard. this promotes communication between the pair. if the copilot has a better skill level than the pilot, then the pilot will learn programming startegies and the co-pilot will learn how to explain his code. In the case that the pilot is better... well at least the next meeting their roles will shift. Which brings to the second point.

The 4 meeting system -- Aside from an exercise based from the lesson, there will be drill exercises, problem solving type machine problems to practice their programming skills. The first second meeting will have the pilot-copilot system, swapping roles for the second meeting. The third meeting will be a discussion of the problems solved previously. The final week will be an individual machine exercise session, with each ME scoring 3 times more, as a test of the student's improvement over the last four meetings.

The Free-for-all Machine exercise -- on the third meeting, students are required to submit an open ME, no objectives, just a program showing how much they know about Java and OOP. Bonus points for exemplary FFA ME's, which will be uploaded to a website so that other students could see how the program was done, and thus learn a little bit more.

My students had fun today. There's a psychological support to have someone to argue with over execises.

Today's problems:

ME6:
Enter word: Mississippi
Enter letter: i
There are 4 i's in Mississippi
M_ss_ss_p_ <-- +2 bonus

ME7:
Guess a number between 1-100: 20
Too low, guess again
Guess a number between 1-100: 70
Too high, guess again
Guess a number between 1-100: 60 (+3 if random)
You got it in 3 tries!

Friday, June 24, 2005

Day 3 Some Exercises



I am appalled.

Today's lesson is just a review of the constructs in C (no difference what so ever). After teaching them Integer.parseInt, Double.parseDouble, the String .equals() method and how to print numbers i had assumed that with just a little coaxing, they'd get to be able to solve simple problems.

Problems such as these (sample dialogs):
ME1 -- Password dialog
Enter password: wrong
You got it wrong!
Enter password: right
You got it right in 2 tries! (counter gets +2 bonus)

ME2 -- Interest problem
Enter money: 100
Enter interest: .1
Enter years 3:
Year 1 -- 110
Year 2 -- 121
Year 3 -- 133.1
(+2 if single dialog box)
(+2 on use of special JOptionPane icons, required online research)

ME3 -- Right Pyramid
Enter n: 4
*
**
***
****

The morning class did pretty well, but the afternoon class was positively appalling. I mean, close to half the class took 2 hours just to do number one.

And I didnt tell them exactly how to input numbers... I told them that JOptionPane.showInputDialog outputs strings, and then Integer.parseInt converts Strings to integers, etc... And a lot of them didn't get it!

I mean, they're supposed to have gone through the Introduction to Programming I course at least. These exercises were simple problems only designed to test them if they could use the java constructs and the new i/o scheme coming from their c background...

*sigh*

at least they know their constructs... im just a bit worried as the rest of the semester is going to get harder than this. im considering having review sessions for them...

I'll find out in the next meeting... After another round of machine exercises i guess...

Monday, June 20, 2005

Day 2 - Datatypes and the Hello Billy Program



They're C programmers anyway... So datatypes were quite quick:

int - still the same, but can store -2B to +2B
char - still the same, but uses unicode
float - dont use this, as float w = 3.14; produces an error (has to be float w = 3.14f)
double - use this if you want floating-point variables

boolean - true or false

Although not really a primitive datatype, i introduced them to Strings. For C programmers, the simplicity of Java Strings is pure heaven.

String s, t, u; (no more character arrays!)
s = "bobby"; (wow! easy assignment! no need for strcpy!)
t = "andrews";
u = s + t; (they really dig how easy it is to concatenate strings!)

Had the HelloBilly program today. I call it the hello billy program because the dialog is like this:

Enter name: Billy
Hello Billy!

I mean, if Hello World is the first program, then the first program with I/O should also have a special name right? (Tell all your friends. ;)

I'd rather not use the java.io classes for user input. Pretty complicated.

Behold!


import java.io.*;
public static class HelloBillyNastyVersion {
  public static void main(String args[]) throws IOException {
    BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
    System.out.print("Enter name");
    String name = stdin.readLine();
    System.out.println("Hello " + name);
  }
}


vs.


import javax.swing.*;
public static class HelloBillyBetterVersion {
  public static void main(String args[]) {
    String name = JOptionPane.showInputDialog(null, "Enter name");
    System.out.println("Hello " + name);
  }
}


I mean, really now... Exceptions on the 2nd day of classes? Long named Java classes? Scary...

Welcome to Java!



Gosh, i couldnt find this nifty video about this bald guy in bullet time explaining the benifits of using java (The java everywhere video). It would be really cool for the first day of class.

Anyway, aside from the syllabus distribution, class card submission and index card writing, and the traditional start of term speech, the first day of class featured the Hello World program.


public class HelloWorld {
    public static void main(String args[]) {
        System.out.println("Hello world!");
    }
}


Then i'd introduce them to JOptionPane.showMessageDialog

import javax.swing.*;
public class HelloWorld {
    public static void main(String args[]) {
        JOptionPane.showMessageDialog(null,"hello world!");
        System.exit(0);
    }
}

From C programmers (Turbo C actually, nothing beats a one-diskette IDE) the last example always blows their mind.

Index cards


Something i got from my high school teacher, the infamous Mr. L---- (the guy lectures on top of tables, goes to school in a vampire costume, and gives an incredible RPG-type exam)

Here's the information i require my students:


  • name (nickname)
  • student number
  • address
  • mobile email
  • birthday
  • PC comfort level - how used are you using computers? are you afraid that touching the wrong key can make it explode, install software, can you set up your own OS, assemble your own PC from components and not buy a "computer set" setup a webserver, etc...
  • PC Access questions - how easy it is for you to get to a computer?
  • The most difficult task you've had involving computers
  • Describe your last computer science class
  • what was your grade?
  • who was your teacher?
  • how do you study?
  • are you: confident/shy talkative/quiet active/passive
  • favorite tv shows,movies,music,books
  • if you could meet anyone in the world, past or present or future, fictional or real, who would it be and why?
  • which star would you like to portray your life in a movie?
  • describe the perfect computer science class?
  • what other computer science concepts would you like to learn?
  • what are other things about you that you'd think i need to know?
  • quote
  • schedule
  • Express yourself - this part of the indexcard (around 1/4 of it) is for you to do anything. draw, write, whatever you want (except stuff that can ruin the back part of the index card)-- this part is fun. =)

Its fun to bring this index cards to graduation parties where my students gasp in horror over the silly things they have written down. ;)

Wednesday, June 15, 2005

Introduction to OOP Syllabus (using JAVA)


The objectives of this class are:

1. know and apply object-oriented concepts in programming
2. be able to use the Java programming language as a tool in problem solving
3. know basic abstract data types and know how they are implemented such as stacks and queues
4. be able to use advanced computer constructs and techniques in programming

Primarily divided into 3 parts, the first 1/3 of the semester deals with learning basic java, mostly from their background as C programmers from the prerequisite class (Intro to Programming I).

The second third of the class (the 2nd 1/3) is OOP concepts: abstraction, inheritance, polymorphism. I've actually have scripted lectures for these classes, i can just go to school without any preparation. almost like a comic routine, but with a lesson at the end.

And then the last third is teaching them Java. Specifically java awt and swing, hopefully networking and multithreaded programming. Something really cool.

I give long exams for each of the three parts. Two Machine Problems (long term month long projects) too.

And then at the end of the semester, we play robocode where we program 2d tanks to fire at each other. completely java based, its a whole lot of fun where students compete for extra credit. =D

The first (third) day of classes....



Did something terrible...

My classes are on Monday and Friday (which is kind of silly if you think about it, i have a longer days off in the middle of the week than weekends). Classes started June 7, a Tuesday. Didn't meet my class June 10, friday so i could go visit my parents (255 km away). Then, June 13, Monday was declared to be a holiday...

So the first day of classes for my students is actually on the last day of the second week of classes.

You get to see that you're on the opposite side of the fence when you feel bad that there are no classes 'cuz it ruins the schedule.

WTF 4?!?


Because learning could (and should) be fun.

First Post!



gosh! I never thought I'd actually start blogging. Gotten into a lot of trouble a few years back when a few personal thoughts became public knowledge... but i degress...

Anyway, the real reason for my blogging is to record my teaching experiences. I'm a computer science teacher at an undisclosed mountain university somewhere in the eastern hemisphere, and i've always wanted to try new things whenever i teach.

writing things down on pen and paper takes too long. placing my thoughts online would be a great record for me and it would be great if i get some ideas from my readers (if any of you are out there. ^_^;;;)

So anyway, my name is Nikholas "Mayhem" F. Toledo, and this is my blog.