Teaching Computer Science Bottom-Up

11 Comments

When I started teaching the new batch of Computer Applications students this year (class 9), I had it in my mind to do it bottom up, to try and give them a good sense of how computers actually work, how the 0’s and 1’s get so many things done. I wanted them to not only be able to write java programs in the prescribed IDE, but also have a good command over the machine, visualize what happens when they run a java program and easily learn other programming languages, work with microcontrollers and so on.

I started with teaching them how to use the GNU/Linux command line interface, to carry out the various tasks they normally do by clicking, dragging and dropping. Typing commands and making things happen turned out to be an exciting thing for them to learn. I had soon taught them to navigate the file system, copy and move files and folders, find out and change file permissions, open files using appropriate applications etc. It helped that I have just 4 students, all of whom are quite excited learning about computers and working on them.

Making them open files of different types with different applications gave me a context to introduce binary numbers and the different ways in which binary digit sequences can be interpreted. Usually it’s just stated that computers can work with only 0’s and 1’s, and that the 0’s and 1’s refer to different voltage levels etc. Then the focus turns to learning the binary number system, and the procedures to convert decimal numbers to binary and back, and some binary arithmetic.

But I saw the whole world of binary numbers in a new way, for the first time. What struck me was that computers interpret binary digit sequences in a variety of ways, not just as numbers. We want the computer to interpret binary numbers in several ways, as different kinds of data- text, numbers, images, audio- and instructions. I felt it would be exciting to try and pass on this understanding to the students.

I gave them a simple introduction to the binary number system, and then went on to making them edit text files and bitmap images using a hex editor. This gave them an idea of how the same set of bytes can be interpreted differently. As a project they even drew a 10×10 pixel image and typed in the hex code referring to the bitmap file format and saw the picture in an image viewer!

I then spent a few classes discussing the different kinds of numerical interpretations of binary numbers- unsigned integers, signed integers, fixed point numbers and floating point numbers. They also learnt about the problem of overflow because of the limited range of numbers. To illustrate overflow I wrote a few programs in C and made them run the executable from the terminal. That also gave me a context to talk to them about source code, compilation and the executable. (I was able to even explain to them the difference between proprietary and free software.) This was very useful, because the next interpretation of binary numbers I wanted to show them was that of instructions. I could easily tell them that the executable file contained bytes which the processor interprets as instructions.

And to actually show them this, I used the Hack CPU emulator developed by the authors of the book/course “The Elements of Computing Systems”. It uses a-simple-to-understand-yet-fully-functional hypothetical processor. I explained the architecture and instruction set to them, and even made them write an assembly program to add two numbers, to compare two numbers and to multiply two numbers by repeated addition. This made them learn important concepts like sequential execution of instructions, memory access, usage of registers, rudimentary arithmetic and logical operations, conditional and unconditional jumps- together they cover most of the concepts in elementary programming. And for each assembly program, I kept showing them the equivalent C program, and they were exclaiming how easy and intuitive the C programs are!

I’ll write in more detail about each of these later. But it’s been exciting for me to discover how children of 14 can learn computers at a level of detail that one would normally think is too advanced. And I strongly believe that this what’s-under-the-hood understanding will stand them in good stead whatever they learn in computers.

Advertisements

Rewriting ‘About me’

1 Comment

I was rearranging my blog, and thought it was time to rewrite the ‘about me’ page- it turned out to be an interesting exercise. I thought I’d put it up as a post.

I or Me?

I wandered into teaching not with any clarity or passion for teaching, but confused and seeking a quiet place, and work where I could mess around with several interesting things. After two years and a little more of teaching science and computers, I find that I like teaching.

But larger questions in education remain. Having read radical thinkers in education like John Holt, I realize that the problems with schools and with education is a problem with the way our society has organised itself (right from the way families are organised, how parents have full time jobs that make it impossible for them to take care of their children, how the institution of childhood makes children inferior citizens with regards to things like how they spend their time and decisions that affect them- there is a cluster of issues) and it’s not something that can be solved in schools.

John Holt writes in Instead of Education, “During most of my teaching years, this is what I spent most of my time thinking about- immediate, concrete, practical matters. Not, how can I make schools better, or even help children learn better, but how can I help this child learn to spell this word or do this problem?” I try to keep myself grounded and live in my concrete reality, and not get lost and frustrated in the land of ideas and ideals. But I find that it’s difficult.

The radical questions can never go away, but I see that to pursue them would require stepping out of the designed environment of a school, and connecting with the world, which could happen one day if energies and momentum gather organically.

***

I’ve been writing this blog for over five years now. When I go through some of my old entries (some not so old), it strikes me how much I’ve changed over these years. I laugh at some of the things I’ve written. 🙂 Sometimes you think you’re writing something profound and later when you read the same thing it looks like nonsense.

Of course I’ll continue writing nonsense, but I also plan to start writing about more concrete things, like my explorations in science, or some ideas that I tried out in class, or some computer program that I wrote, stuff like that which gives you a reassurance that you’re living in a concrete, physical world, and everything’s alright!

P.S. The title “I or Me?” is based the terms used in The User Illusion by Tor Norretranders to refer to the small part of ourselves that we become conscious of (I) and the whole organism that is Me.