Monday, August 30, 2004

This Class has been the bane of my existence today, and I am still not sure if I am done with it. However, I think that it has come a long way today. It is one of the Class files that I was to program for this week's programming assignment in CS 2020. The professor really didn't skip a beat between where we left off last April, and where he picked up last Thursday. So far the assignment has been a review assignment built to jog the rusty memory. The last problem (that I haven't done yet) looks like it will involve something new, but we will see.

Anyway, the point of this lovely Class is to demonstrate that we understand the basics of the java memory model, and that we understand the idea of OOP programming. This brings me to the story of the day. Work was slow today, so I was tinkering with this assignment and everything seemed to be working great except for this little statement which now works:

public String toString () {
String output = new String();
for (int i=0; i<= club.length; i++){
output = output + "Member " + i + ":" + club[i] +", ";
return output;

I had to get some help to get it to look like that, because I was having a major mental block and I am rather embarrassed about the whole thing. I was trying to make this work:

public String toString () {
return for (int i=0; i<= club.length; i++) { "Member " + i ":" + club[i] +", ";

So, I had spent a while last night thinking about this one, and was still struggling with it while I was at work. So the genius in me decided that I should just go and ask one of the Java programmers to take a look at it, and tell me where I had gone wrong. Well, they have an open cubicle area, and are all best friends. I don't know what I was thinking when I went over there and asked them for help. They were all friendly, and helped me realize that I was just expecting way too much from my return statement, but I wonder how they have judged me now. Really, you would think that putting the string into a variable BEFORE returning it wouldn't be too hard. Oh well. Those guys are really great, maybe it was humiliating because I want to be like them.

One of the things I love about programming is the thinking one has to go through to solve the problem. It is like doing puzzles. I wonder if I had stared at my toString method long enough that I would have figured out that as long as I was returning a String that it didn't matter what other kind of processing I did in the method. It was a valuable lesson. I learned something, and was again reminded of how powerful the Java programming language is.

At least when I go to class tomorrow, I can honestly say that I have started the assignment. ODE's/Linear Algebra went well. I actually comprehend it so far. Hopefully the first real lecture on Discrete Mathematics will help it to make more sense.

Cheers to Monday!

No comments: