My Apprenticeship - Tueday, June 15, 2004

This summer I'm revisiting my short apprenticeship at Object Mentor. I'll be posting commentary on all my posts from the summer of 2004 exactly 5 years later to the day.

Tuesday 6-15-04

Rough day.

There's only so long I like to stare at a mountain of code which doesn't work and I don't understand. Paul was frustrated b/c we still couldn't figure out why the tests of the OMwiki were failing. We sent Micah an email and his reply was pretty much, 'Oh yeah, I've run into that problem before. I don't remember the solution but it's one tiny thing that causes the whole suite to fail.' Nice. Well, Micah's on vacation so that's fine, but it's maddening to know that one line of code may be preventing you from even getting started. Welcome to programming.

We spent the morning banging our heads against this wall, then, having accomplished just about nothing, we went to lunch. Paul thinks John Kerry is crafty for being spineless. I think he's just spineless. We both think he stands a good chance of being elected.

Later we stared at OMwiki some more. It's kinda depressing but I still don't have a real good grasp of 'this'(in Java) or 'self'(in Python). I asked Paul for an explanation but I only sorta understood the answer. Paul sez we're trying to use a 'Visitor' pattern on the OMwiki code, like is used in the Fitness wiki, but I only have a tentative grasp of the 'Visitor' pattern. It has something to do with avoiding a big conditional method by creating a lot of smaller methods ' each of which will translate some different bit of wikiLanguage into the appropriate Html. The cool thing about wiki pages is that you type in certain commands and the code (which we are working on) automatically sets up links, or makes things bold, or does other cool formatting things. At some point, Paul figured out that the vcs (version control system) check-in function was making the files read-only (if you recall, that was our big problem from the beginning). So he commented it out and the tests all passed. Whoo. We'll need to put it back in as soon as we know how to do so (and not bring it all down around our ears), but for now we can work on the wikiWidget (the module that translates user text into links and stuff) and actually be able to test it.
During a free moment, I download TextPad and the Python plug-in that lets it color code python script. Good program ' way better than Word Pad. Unfortunately, my Tic Tac Toe program will compile but it won't run. Actually, for a time it wouldn't do anything. I'd type in:

python TicTacToe.py

(from the command line) and ... nothing. No syntax errors, but no game either. I had to take the 'main' method out and put it on its own. Now, of course, there's all sorts of run-time errors. I keep trying to call methods with no parameters like:

print aBoard.toSting()

and Python keeps telling me I passed it 1 argument. Hmm. I'm working on that one. I'm also having trouble with my program seeing global variables such as the TicTacToe board (myBoard). I kinda wish I could spend some more time working on Tic Tac Toe with David before I look at all that OMwiki stuff in Pyhton. I'm not much use if I can't even execute a simple toString call.

One last thing: Just to complete my day, I missed the train home by zero seconds. Zero, you say? Yep. I just made it but the asshole Metra guy said 'no bikes' and let the door shut in my face. For the record: the bike folds up and goes in a bag (which is perfectly Metra-legal). So I sat around for another 62 minutes waiting for the next train.

Get 'um next time, tiger.

I can still remember missing that train. Some days there was wicked wind coming in from the lake and it would add about 10 minutes to my bike ride -- this was the first time I discovered that. I was peddling my ass off to make that departure and checking my watch every 5 minutes. And then to make it just in time only to be shut down by some jerk. Ah, memories. I'm pretty sure I shouted obscenities for a full minute.

As to my problems with Python -- It's funny to see me talking about how I don't understand Python's 'self' and then wondering what's this weird extra parameter that's getting passed along to all my methods. If you've never programmed in Python you have to declare 'self' as the first parameter of all methods. Which can be a little confusing to those new to the language.

I love, btw, that our big solution to the problem of the tests that wouldn't pass was to comment them out -- not very XP. We did spend a bunch of time trying though, so I guess that counts for something.

Comments

Popular posts from this blog

Point Inside a Polygon in Ruby

What's a Good Flog Score?

SICP Wasn’t Written for You