Today our lesson took almost 45 minutes. We had no plan but we did cover a lot of topics. Not just computers, but Englis, Math and Geometry too.
We had been singing the (in)famous Head Toes And Knees And Toes song quite a bit today, so we chose to have the computer sing it for us. We started to write the lyrics into a file and had the computer speak it out load. We got as far as
head
.. and she was exhausted with typing.
So, I took her to Turtle Roy, my little Logo-ish learning environment using the Roy programmin language. There was some issue with Chrome this time and I joked that the turtle must be sick, which made her a bit upset: "Is the turtle really sick?". But we opened it in Safari and it was ok.
We discussed pixels and used the Mac magnification feature (ctrl-two-finger-drag) to have a close look at them. Then we used "fd 50" to make the turtle move 50 pixels. It was not trivial that the number 50 is typed 5-0.
Then we discussed angles, and especially the 90° Right Angle. She was able to deduce how 90 is typed based on earlier experience with the number 50. So we did "lt 90" and the turtle turned left.
Now she was really determined that she wants to draw a Rectangle. And there we went, repeating the previous command until a perfect Rectanble was formed. She wanted to save it and was a bit disappointed that Vim commands don't work in Turtle Roy. But she was o.k. with being able to save it using a Web UI. And yes, the Rectangle is now saved for you to marvel at.
Now she wanted to make triangles, circles, suns, smiling faces and whatnot. I convinced here that they all can be done and we'll make them later, but she'll have to learn some English, Maths, Geometry and Programming first. I even showed here some of the aforementioned shapes and she was like "WOW". Now I'm her programming superhero:)
Anyways, I think we've found a nice tool for learning to code.
Then we discussed Lists and Geometry a bit. The concepts of head, tail and empty list were surprisingly easy for her so I think she'll learn to write recursive algorithms very soon. Before that I think we need to refactor her Rectangle to adhere to the DRY principle.
Meanwhile I'll have to make Turtle Roy support some vim commands to integrate our editing and coding skills more nicely.
Thursday, August 29, 2013
Monday, August 26, 2013
Mad Skillzz
This is what we've done so far, just summarizing for myself mostly. Most of this stuff she can do now, but needs some help with.
Vim
- Start vim to edit a file: vim kissa
- Add new line with text, exit insert mode: p, <esc>
- Delete a line: dd
- Copy/yank a line, and paste it: yy, p
- Append to current position: a
- Save and exit: :wq
Files
- List all files: ls
- Print out file contents: cat kissa
- Count number of words: cat kissa|wc -w
- Speaking: cat kissa|say
Scripting
- Add any commands to a file using vim
- Make executable: chmod u+x nakki
- Run the script: ./nakki
Browser
- Search for stuff: click on location bar, type text, press enter
- Go to image search to see more pictures
- Scrolling with two fingers
- Saving a file: right-click, Save As, select home directory, enter file name
- Open saved file from command line: open perhonen.jpeg
What next? More practise on all of these areas of course, but should we set a goal or something?
Lesson 10 - Yank It!
The funniest thing today was the new reminder sound for adding a space between the program and the argument (filename). She forgot that a couple of times and I let out a huge O! She might remember next time.
We revisited the vkp file again, and pracised copying lines: yy to yank a line and then p to paste it on the next line. It seemed quite easy for her to understand that y stands for yanking (making the computer "memorize" something) and yy stands for yanking the whole line. I explained that many commands in vim can be applied to the whole line by repeating the same letter. Like dd that we used before.
She wanted to do it again and again, so I teached her to use the period (.) to repeat the last command. We ended up with eight lines with 7 weekdays on each. I teased her to count the words and we came to the conclusion that the computer is better at it. She used vim quite fluently today.
cat vkp|wc
That's how we made the computer count the words. She remembered both programs cat and wc and typed the pipe character like a boss. The output was something like
8 56 456
... showing the number of lines, words and characters (I call them letters to her). The number eight was easy to read, but she couldn't interpret the larger numbers, so we practised them. She can count to a hundred now so the number 56 was graspable once I told her that 56 goes like viisi-kymmentä-kuusi.
We were both very happy with the lesson and recapped it what was learnt this time. She remembered copying lines, and using yy.
Then we googled for pictures of scary ghosts.
We revisited the vkp file again, and pracised copying lines: yy to yank a line and then p to paste it on the next line. It seemed quite easy for her to understand that y stands for yanking (making the computer "memorize" something) and yy stands for yanking the whole line. I explained that many commands in vim can be applied to the whole line by repeating the same letter. Like dd that we used before.
She wanted to do it again and again, so I teached her to use the period (.) to repeat the last command. We ended up with eight lines with 7 weekdays on each. I teased her to count the words and we came to the conclusion that the computer is better at it. She used vim quite fluently today.
cat vkp|wc
That's how we made the computer count the words. She remembered both programs cat and wc and typed the pipe character like a boss. The output was something like
8 56 456
... showing the number of lines, words and characters (I call them letters to her). The number eight was easy to read, but she couldn't interpret the larger numbers, so we practised them. She can count to a hundred now so the number 56 was graspable once I told her that 56 goes like viisi-kymmentä-kuusi.
We were both very happy with the lesson and recapped it what was learnt this time. She remembered copying lines, and using yy.
Then we googled for pictures of scary ghosts.
Sunday, August 25, 2013
Lesson 9: Piping Like It's 1999
Today we had a nice little session. We used ls to list all the files again. This time she remembered that cat is the program we use for printing out a file. So we printed out the weekdays in the vkp file. Then she manually counted that there are 7 of them.
I persuaded her to see if the computer comes to the same conclusion as she did. So I introduced the new tool wc (word count) the name of which was found very funny. We found out that the "-w" flag should be used. Then we did our first "double pipe":
cat vkp|wc -w|say
This time she also remembered how to type the pipe character. The computer agreed with her and said "seven".
Then we googled for "monsters" as per her request, and saved a picture of a monster onto the hard disc, found it there using ls and opened it in vim to find out that it looked like garbage. She liked it a lot though. She remembered how to type vim and how to exit. Nice.
I persuaded her to see if the computer comes to the same conclusion as she did. So I introduced the new tool wc (word count) the name of which was found very funny. We found out that the "-w" flag should be used. Then we did our first "double pipe":
cat vkp|wc -w|say
This time she also remembered how to type the pipe character. The computer agreed with her and said "seven".
Then we googled for "monsters" as per her request, and saved a picture of a monster onto the hard disc, found it there using ls and opened it in vim to find out that it looked like garbage. She liked it a lot though. She remembered how to type vim and how to exit. Nice.
Saturday, August 24, 2013
Lesson 8 - Badgers
This one was a bit challenging, as we had the lesson just before bedtime and we were both very tired. Even though during her violin lesson a bit earlier she had said "I don't want to play violin, I want a computer lesson"...
So, we created a new file "vkp" (shorthand for viikonpäivät) and wrote all the weekdays there in Finnish. Vim was very easy this time, but typing all those words was challenging. Yet we triumphed. We used both the "o" (new line) and "a" (append) commands this time.
We used cat to print out the file contents, then piped the output to say to hear the computer speak out the weekdays. That was a bit disappointing, because the English voice is really really bad at speaking Finnish. I wish there was a way to get a Finnish voice on a Snow Leopard Mac. But I guess there isn't. Maybe we'll install Linux next time. I heard there's a Finnish voice there.
We googled for badger and watched the video. Then we practised the badger dance while brushing teeth.
Wednesday, August 21, 2013
Lesson 7 - Butterfiles
Today I was a bit unsure whether I can motivate her to do stuff on the command-line. So I reminded her that we'll play with colors and have a look at the Keijupeli source code to see that behind all graphical games there's a load of textual code.
When we started, she said "let's make a script", and I knew this is going to work. So we revisited the "nakki" script from the previous lesson. Script is a file and it's a program. You can run it and you can edit it. We chose to run it first, to hear the computer say "pitkätossu". She used tab-completion to get the name typed quicly and then the up-arrow to repeat the previous command many times. It was fun.
She remembered that the text-editor program is called vim. Typing vim was not hard either. For the first time she remembered to add a space between "vim" and "nakki".
We added a second line "cat kissa|say", revisiting the piping thing we've done a couple of times. So, our script now is like
say pitkätossu
cat kissa | say
She remembered how to exit insert mode and how to save and quit. Then we ran the script and she laughed most of the time the computer was speaking. The "kissa" file contains a huge load of random stuff.
We discussed the possibility to use alias to make the computer understand Finnish words instead of the English ones like "say". But she chose not to use alias this time. Maybe later then.
We discussed the possibility to use alias to make the computer understand Finnish words instead of the English ones like "say". But she chose not to use alias this time. Maybe later then.
So that was the "boring command-line part" which turned out pretty interesting and fun again. Then we had a look at the Keijupeli source code and even had the computer speak the source code file aloud.
The last planned exercise was playing with colors. We found a webpage where you can increase/decrease the amount of each color RGB and found yellow, black, white and cyan.
But that wasn't enough. She wanted to search for photos of butterflies and so we did. The browser GUI proved hard to use with tiny hands. A right-click with a Mac trackpad is a bit tricky for adults too, ain't it?
That wasn't enough either. She wanted do more things. So I told her that the pictures on the screen are files too. To prove that we saved one in her home directory and learned a new command ls that you can use to list all files. And there it was! The "perhonen.jpeg" file was among "nakki" and "kissa". Permanently stored on her own hard disc. I explicitly asked her which part of the computer stores the files and she remembered that.
Then we used yet another new program open to open the image file. The pretty butterfly appeared in Preview. I promised her we'll get her a program that she can use to edit pictures too, but not tonight. Then, as a last funny thing, we opened the same file in vim to see that it actually contains just non-readable junk that only computers understand. Or more precisely, only computers running a suitable program.
So, we ended up having a very exciting lesson and it lasted half an hour or so. She could hardly keep her eyes open but always wanted to do more things. Could you believe?
Tuesday, August 20, 2013
Hot Air Balloons
We were going to have a lesson today before bedtime but the girls were so tired that it would've been a disaster, so it's good we just discussed the subject while eating oatmeal.
She was very anxious about getting to write "proper" games instead of the boring text things. She said she's ready to do that already, and she doesn't want to write anymore. Just real games with pictures and all.
So I used some analogues. Like imagine you're a small baby who cannot even crawl yet and you want to learn to run. We went through the steps that have to been taken before learning to run. Still, she wanted to get to the business of writing real games. Then we discussed how cool that would be. She found it quite unbelievable that some people make games for living. What a cool job! But, alas, to make these games you have to write a lot of code. We agreed that I'll show her the amount of code required for our little Fairy Game. So, we'll have a code review on that shitty codebase probably tomorrow. I hope it convinces her that you cannot make graphic games without resorting to textual editing.
Once again, just before bedtime, she wanted to talk about Vim and computers. Once again, she remembered just one computer component, i.e. the hard disc.
She wanted to know how the keyboard works. We discussed electric circuits and how the key presses are converted into digital signals that the CPU then processes. And so on.
She also wanted to know how the LCD panel works but I had to divert her to the fact that there are three colors of pixels on it and using a combination of RGB, you can make up any color. We agreed to try mixing those colors as a bonus after the next lesson.
And hot-air balloons. She wants to see how many people die when one of those lands.
Subscribe to:
Posts (Atom)

