Solving mysteries – the binary way
Abhijit Nandy
From the time I first read Sherlock Holmes, I was fascinated by Holmes’ capacity to draw conclusions about a person by observing some apparently trivial and minor aspects of his appearance. I used to enjoy reading his flow of thought using assumptions and logic based on facts to arrive at a deduction.
The basis of Sherlock Holmes’ reasoning and why we all enjoy it so much is analytical thinking which anybody and at any age can do.
In our schools, we teach many different subjects, but we don’t teach analytical thinking. Often I read and hear that the syllabus doesn’t prepare students for the real world. And to some extent that’s true. But that’s mostly not because of the subjects themselves but rather the way they are presented in books and taught.
Most textbooks start with definitions which are expected to be memorized, and then proceed to rules and processes, which are again expected to be memorized, and to apply these to arrive at an answer.
Negative numbers
As an example, take negative numbers.
We first start with a number line.
Except for the sequence of digits there’s nothing logical in this arrangement! And the first problem we face with this representation of negative numbers is when we come to subtraction. Because if I wanted to subtract one (-1) from four (4), they are now in two places on the number line! How does subtraction in this case even work?
Here we are talking about mathematics, which is the one place where logic rules. But making assumptions which don’t help us at a later stage doesn’t really make any sense.
Now, instead, if the concept of negative numbers was explained like this
So, whenever we put a plus (+) or don’t put a sign in front of a number, it represents one direction and when we use a minus (-) in front of a number, it indicates the opposite direction. And whenever the sign changes we switch directions.
Now, the assumption makes more sense and feels both logical and natural. (And one, which essentially, the original number line was trying to represent but missing the point entirely!)
The only other assumptions we need to make is that moving away from zero gives us the number of steps we take and we switch direction at the end for every time we’ve stepped over zero.
Explaining subtraction now becomes easy. Subtracting 1 from 4 becomes as easy as subtracting 6 from 4, because we know that any number of steps away from 0 gives us a particular number and the sign comes from the direction we are facing.
To calculate +4 – +1, we are at 4 looking right, see the minus, turn around, take one step and switch direction again for the plus before the 1 to get to 3 looking right to get an answer of +3.
To calculate +4 – +6, we again start at 4 looking right, see the minus, turn around, take 6 steps, cross over 0 to reach 2 looking left and switch direction again for the plus before the 6. But this time since we’ve stepped over zero we need to switch direction to face left again to get an answer of -2.
Similarly subtracting negative numbers is also easy. If we need to subtract -3 from -5 which means -5 – -3, we start at 5 looking left. This time we don’t switch direction on the minus because we are already facing left, take 3 steps to arrive at 2 looking left and again, since the sign doesn’t change we don’t switch direction, leaving us at 2 looking left to get the answer of -2.
No need of special rules and processes to memorize at all!
If we teach students analytically and logically, we rarely need to memorize arcane steps to arrive at an answer which can only be verified by looking them up at the end of the book.
The more important aspect of all this is that we inculcate logical and analytical thinking in the minds of students. And this should be done regardless of the subject being taught.
Programming fundamentals
Even the most mundane task we do in our daily lives involves many different steps. Most of the times, we do this subconsciously without even realizing it. Much like Sherlock Holmes!
Take, for example, making tea.
We need to put the water in a pan, put it on the gas stove, wait for the water to boil, turn off the gas, put in the tea leaves, wait for a few minutes, strain it into a cup, add sugar and milk to our taste and then stir.
We do all these steps without even thinking. Until, of course, we need to explain it to someone! And then not only do we need to tell the steps in detail but we also need to put in all the measures.
Such a simple act as making tea, broken down in detail, has all the elements required for anyone to be able to program a computer. From the programming standpoint, it has comparisons, it has loops, it has if-else conditions, everything required for anybody to know programming.
But that’s not the way we teach programming. We talk about variables, about statements, about programming languages themselves. But all these are dependent on the programming language being used. And typically, any programmer needs to learn many programming languages in his/her career.
We need to teach students to understand, not just the basics of programming, but the basics of how to break down tasks, even everyday tasks, into smaller pieces, into unambiguous pieces, and then put them all together. That is the skill which they can then take to any programming language. That is what forms the foundations of programming.
Taking the tea-making example again, it would end up being something like this.
- Get a cup
- Measure 1 cup of water
- Put it in a pan
- Put the pan on the stove
- Turn on the stove
- Wait for the water to boil
- Turn off the stove
- Put in 1 teaspoon of tea leaves
- Wait 2 minutes
- Strain the tea into a cup
- Add 1 teaspoon of sugar
- Add 1 tablespoon of milk
- Stir till the sugar is dissolved
- Taste. If sugar or milk is less,
- Serve
repeat steps 11 and 12
In these 14 steps, all the programming concepts are already there.
Step 1 has a beginning.
Till Step 5 there is a linear fl ow.
Step 6 has a condition.
Step 9 has a wait/sleep.
Step 13 has a loop.
Step 14 has a forever loop.
Step 15 has an end.
In the course of our daily lives we use programming constructs all the time without realizing them. We use if-else conditions while crossing the street. We use multiple conditions when we choose the colour pencil to colour the tree. We use loops when we try to finish all the cornflakes floating in the bowl. We use lists and arrays in our shopping lists, in our attendance roll call.
We need to teach students to observe, analyze, think about what exactly is happening. We need to satisfy children’s curiosity, we need the subjects that we teach to affect them on a day to day basis. Only then can we inculcate a passion to learn.
Screens
I find lit-up screens fascinating, especially if something is happening in them. And so does everyone else it seems. I always see people looking at lit screens at any opportunity. Even while waiting for the traffic lights to turn!
Unfortunately, shoving lit screens in front of students in the forms of tablets or computers seem to have become the de-facto way to teach them programming.
Knowing the fundamentals of programming requires analytical thinking, requires observation, and requires deduction. Only when all these are in place can we learn programming languages. And only when we need to learn a programming language, or rather, to program it in, do we need computers.
And by the time we reach programming languages, all that we should have left for students to learn is how that specific programming language behaves. Essentially, they would need to learn syntax, which, in the English language, is known as etiquette!
It’s like the way we speak when we are among friends, or when we are with our elders. That should be the only difference. These rules need to be learnt, because without them, the program would fail. Just as we would not be able to have a conversation with our friends if we were only speaking formally with them. They would just laugh us out of their group!
Most of the times, the educational programs I see, the ones which try to teach the children programming, end up teaching the students only how to use that particular program. They add animated characters, they add music. It feels to me that they seem more interested in trying to keep the student engaged in the program itself rather than helping them learn anything.
Generally, when we teach students programming, we overload them with theories. We teach different types of sorting techniques. We teach different programming paradigms. But as any experienced programmer will tell you, these are highly dependent on what the program is trying to solve, or rather the problem domain.
Students should certainly learn this, but not when they are starting to learn programming. At that time, they need to get their hands dirty and write something which gives them immediate results. Only when they have progressed to a point where they face a certain set of challenges can additional advanced topics be introduced.
Additionally, teaching students to learn languages, which need a lot of background fundamentals, is, in my view, more of a hindrance than an enabler. Also, these programs are usually installed only in schools and they either need another installation at home or not get to work on it at all outside of their school.
If we want students to learn programming, we should teach them on software that they would use on a day to day basis.
All spreadsheet programs have functions for cells. And all of them have a programming language embedded in them continue as do all browsers. My introduction to programming for anyone is this:
- On your computer, open your favourite browser
- Press F12 on the keyboard
- Among the numerous tabs, select the ‘Console’ tab
- Type the following line next to the > sign Alert (“Hello World!”);
- And press ‘Enter’ on the keyboard
That’s all it takes to write a small program in the real world. And all of us already have a ready-made programming environment in all our computers without installing anything else.
The subjects that we teach in our schools should have an impact on the day-to-day lives of the students. They should be able to observe, interact with and impact their environment from what they are learning from textbooks and computers.
Analytical thinking and logic are skills that can be applied not only to mathematics or programming but to any subject. Being observant, consistent, getting results, actually having students interact with all that they are being taught, are very important aspects for the students to learn.
Learning is a means to seeing the world differently. Learning is when we connect the disparate observations in the real world to a coherent pattern inside our heads.
Because only when we change the way we see the world, we can change the world we see.
The author is a proud BeMe (http://beme.org.in) parent. He is also a software consultant & instructor for mobile apps and web development. He can be reached at mail@abhij.it.