Archive | Class Progress RSS feed for this section

(ar)Rays of Understanding

The past few classes have been focused on Arrays. As we worked through the two Ruby Koans files dealing with arrays, I noticed that some of the students were completing the Koans quickly, but when asked about what they had just done, were not able to explain.

Running the Koans gives you output like this:

The answers you seek...
<"FILL ME IN"> expected but was <[1, 2, 3, 4]>.

Much like the answer key at the back of a math book, it’s a simple matter to copy the answer and move on to the next problem, which is what was starting to happen. I encouraged the students to really understand what was happening in each problem and to ask their pair partner, and then me if they were having trouble.

We culminated with writing a program having the following specifications:

  1. Ask the user “What are your three favorite movies?”
  2. Store the movies in an Array
  3. Print the movies out in reversed order

I was surprised to see that this project turned out to be more difficult for the students than I had anticipated. The final program should have looked something like the following:

Upon reflection, I’m starting to question the use of the Ruby Koans as a starting point for those without any programming experience. While it’s a nice introduction to the language, I think we’ve ended up glossing over many basic concepts like “what is a variable?”, “how do you do assignment?”, “what are objects?”.

For the next class, I’m going to focus back on some of these basic concepts and then (maybe) move on to the next set of Koans which is about hashes.

Singing (Printing) Happy Birthday

Last night was one of our students’ 17th birthday. In his honor, I decided to have the class write a program that would:

  1. Ask the user for their name.
  2. Sing (print) the Happy Birthday song to them

For our non-western friends:

Happy birthday to you,
Happy birthday to you,
Happy birthday, dear <insert name here>
Happy birthday to you.

This was the first time we were writing a Ruby program from scratch and put together some of the skills they have been learning.

I give a quick explanation of how puts, gets, 10.times do ... , and string interpolation work, which gave the students the building blocks of the application.

One of the biggest hurdles that I saw them struggle with was understanding the difference between a variable and the contents of the variable. For example, most of the students initially assigned the results of the user input to a variable with the name of a person’s name, e.g.

bryan = gets

instead of

name = gets

After everyone had that working, I explained Ranges (1..10), and each, and asked them to print out the Happy Birthday addendum: “are you 1? are you 2? are you 3? … ” up to the age of the birthday boy.

At the end of the class I was excited to see a couple students who didn’t want to stop. I think they are on the verge of seeing the possibilities that programming can unleash.

Commence Yak Shaving

I thought it would be fun to get syntax highlighting working for the team, which as we discovered last time was going to require a Vim recompile.

The first thing we needed to do was to get the source for Vim, which we must download from its Mercurial repository… To use mercurial, we must sudo apt-get install hg. As it turns out some of the machines seem to be failing apt-get for some reason, so half of the group makes it this far.

To continue on, we reorganize around the three machines with successful downloads. A simple ./configure --enable-rubyinterp --enable-multibyte --with-tlib=ncurses --with-features=huge ; make ; sudo make install later, and we were ready for the next step.

A bit of editing the .bashrc file to update PATH to contain /usr/local/bin and we’re ready to… edit the .vimrc file to add in the syntax enable setting.

Yay! Three machines with syntax highlighting, but more importantly some up-close and personal experience with the world of Unix open source tools.

After this adventure (and a much needed break), we got back to the Koans. The team struggled quite a bit with the introduction of Exceptions during the “nil” lessons. We made it through, but this is a difficult concept to grasp for people who haven’t seen code before, so the authors might consider skipping it here. There is already an about_exceptions.rb later on.

We ended with everyone successfully finishing up the first 8 koans.

Till next time!

Second Class

During our second class, we took a quick detour into some vim configuration. The students felt that having line numbers in Vim would be useful when talking about where they were in the Koans, so I showed them how to create a .vimrc file and add numbering.

We also tried to enable syntax highlighting, but as it turns out, the default installation of vim on Ubuntu is “small”, so doesn’t have the syntax option compiled in. Recompiling would have been a bit too much Yak Shaving for Day 2, so we just moved on. Though this might be a great project for Day 3 :-)

Next, we got back into the Koans and managed to make it up to the sixth one. For those keeping score, there are 280 total Koans.

Along the way we learned a couple new Unix commands, rmdir and mv, and took a brief detour into using irb.

We also picked up a few new Vim commands including dd, o, and O.

First Class

This afternoon, we had our first class with a group comprised of seven High School students: 3 girls, 4 boys from various schools in the Ypsilanti, MI area. The class was held on the campus of Eastern Michigan University.

I had set up some Ubuntu laptops (kindly provided by Pillar & BillHighway) ahead of time  with Git+RVM+Ruby and a few other goodies.

We kicked off with some introductions, and then jumped right in to using the Terminal. These students had never seen Unix let alone programming of any kind, so I could sense some apprehension in the air. We started off by making, deleting and navigating some directories.

After that, we git cloned the Ruby Koans just in time for our internet connection to die. Next, I told them that although they would be extremely frustrated, they would be happy in the long run… so we started working on the Koans via Vim.

It was interesting to see the students taking up Vim, as I only introduced one command at a time. When I learned Vim, I learned to delete things with ‘xxxx’ or ‘XXXX’, and I’ve found it hard to break this habit. So far, we’ve only talked about changing text via ‘cw’ and ‘dw’. I also gave them a chance to use the arrow keys once, but then asked them to stick with ‘hjkl’.

So, while learning from scratch some Unix, Git, Ruby and Vim, we managed to get through the first two Koans. I’m pretty impressed with these students and excited to see where we go.