Week One: Java Training

by sbh on Monday - 29 December 2008

in Uncategorized

As I noted in a previous post, I have decided to start working on my Java skills. To this end, I have started working through an MIT OpenCourse to try and pick up some skills.

The course (6.092: Introduction to Software Engineering in Java from January 2008) was designed as a four-week intro to the basics of Java. Unfortunately, this course came only with lecture notes and assignments — no lecture audio or video.

Why is this a problem?

Well, the instructors have written good powerpoint slides: terse. I hate it when you sit in a lecture and the professor is just reading powerpoint slides. A good powerpoint slide should only have bullet points. They shouldn’t have EVERYTHING.

So, part of my job is to decipher these powerpoint slides. That’s OK, it helps me to concentrate. The best thing about learning this way is that the course forces me to work through problems. Concurrently I am reading a book on Java. This book doesn’t present me with problems, only information. Working the assignments for the class means that I have to think about how to use the stuff I’ve learned.

The assignments have been simple so far.

Assignment 1, for example, asked me to create a program that converted a given temperature from Fahrenheit to Celsius and Kelvin. The given value was “90.” Here’s my silly little code:

class NewConverter {
  public static void main(String[] arguments) {
    int input = 90;
    System.out.println("The value is " + input + "F");
    double c = (5/9.0)*(input-32);
    System.out.println("The value is " + c + "C");
    double k = c + 273.15;
    System.out.println("The value is " + k + "K");

As silly as it is, there are a couple of important things going on. Allow me to point them out.

First of all, my recent programming experience has been with object-oriented scripting languages: Ruby and Python. Java, of course, is object-oriented, but it is not really a scripting language. This course is forcing me to really thing about Objects and Classes. The entire program is a class “NewConverter”. For me, that is a weird way to think.

A later assignment had us simulate a card game called Belote. It was difficult for me to think of the game as an object. Of course, once you start to train your brain in this way, it all comes together. By the time I was done with the Belote project, I understood this concept.

The other thing going on in the temperature converter program above is attentiveness to math. I’m afraid my math skills have waned since high school (I got out of taking any math in college!). It took me a while to figure out how the order of operations worked. It took even longer to figure out how Java’s types (in this case Integer and Double) were working together.

In the end, week one has taught me that I’m looking at a whole new paradigm. Object-Oriented Programming (OOP) is a powerful model for visualizing how a program should work. But, like anything else, it takes a little brain-training to orient your mind appropriately.

For Week Two I am headd to Colorado for a vacation. So, Week Two of Java won’t resume for a little while.

Previous post:

Next post: