Week 1 - Day 2
It’s day 2. The morning lecture today was mostly review for me. We spent most of our time on the topic of “Pass by reference.” One thing learned today: if you make a copy of an Array with dup, then reassign one of the elements in either Array, both will reflect the change. That’s because the copy has variables that refer to the same locations in memory, even though the arrays themselves are stored at different addresses.
We also went through the solutions for Assessment 0. There was one particular problem on the assessment I had trouble with yesterday. The problem was to sort the letters of a string according to the order of an alternative alphabet supplied as an argument to the function. Today I learned that it has an elegant solution using the sort_by method of Array. I had forgotten you can pass a block to sort, and I forgot about sort_by completely. These solutions always stick better after struggling with a problem for a while.
Pair programming is a challenge for me, but I think it is really going to improve my thinking in the long term. I am used to working alone on coding problems, so it takes some work to put my thoughts in to words, and to work with with someone else’s ideas when I have a different solution in mind. I’m noticing after only two days that each person has their own unique style of thinking and communicating about these problems.
Today my partner and I worked on the Memory Puzzle game. That’s the old game where a grid of cards is face down in front of you, and you turn over cards in pairs to find matches. We were able to create a game that a human player can play without much trouble. Coding the Computer’s A.I., however, was a real challenge. By the end of the day, we still had not quite finished. I’m looking forward to reviewing the solutions and talking about them in lecture tomorrow.











