# Teaching logical/analytical thinking

I have been trial running a club in which I teach programming for the past year and while they have progressed what they really lack is the most fundamental concept to programming, analytical thinking.

As I now approach the second year of teaching to the children (aged 12 - 14) I am now realising that before I begin teaching them the syntax and how to actually program an app (or what they would rather, a game) I need to introduce them to analytical thinking first.

I have already found Scratch and similar things such as Light-Bot and will most certainly be using the, to teach them how to implement their logical thinking but what I really need are some tips or articles on how to teach analytical thinking itself to children aged 12 - 14.

What I'm looking for are some ideas on how to teach the kind of thinking that these kids will need in order to get them into programming, whether that be analytical, logical or critical. How and what should I teach them relating to the way their minds need to be wired when programming solutions to problems?

-
Please explain what exactly you mean by "logical thinking". Do you mean boolean logic? Something else? –  Oded Jun 24 '12 at 18:57
Do you mean analytical thinking? Divide a problem into several subproblems and solve them one-bye-one, or something else? –  mcwise Jun 24 '12 at 18:59
Take a look at criticalthinking.org. There are lots of articles here, and some of them are on the problems of teaching and new approaches. Hope this helps. –  superM Jun 24 '12 at 19:05
I edited your question, next time make sure to edit it yourself :) –  mcwise Jun 24 '12 at 19:08
Boolean logic games: stackoverflow.com/questions/771318/… –  Danny Varod Jun 24 '12 at 19:08

I had similar reactions when I first taught programming to undergraduates, using BASIC, 30 years ago. (Now GWBASIC is still excellent for bare beginners. You can switch to OO stuff much later.) The first thing that needed to happen is I had to learn a few things about teaching. It served me well then and since, with even younger students. Let me summarize:

• Start them programming, right away. Little programs to input their name, and then say HELLO SUZY or whatever. If you think this is too trivial, you need to understand that it's actually quite profound. It means there's a difference between edit-time (the time at which you give instructions to the computer), and run-time (the time at which it carries them out). It means there's such a thing as a variable, where the name of the variable, like NAME\$ is different from what it contains, like SUZY. It means that a program is executed one step at a time, finishing one step before starting the next, not all at once. It also means that it doesn't read your mind. (Note to pipelining and multi-core objectors: come back when the students can actually program.)

• If something seems simple to you, it is because you have learned a lot of things that you know so well that they seem obvious. They are not obvious to the student. You need to go at their speed. If you give them a problem that's too hard, it's not that they can't do logical thinking, it's that you need to break it down to a simpler problem.

• Don't expect them to understand something just because you said it. The only way to learn programming is by working through small problems, making the same mistakes that everyone makes, and coming to the oh-Now-I-get-it moments. You can help them with this, but you can't just give them the answer, because it has to come out of their brain, not yours.

• A useful classroom technique was to "play computer". I would write a program on the board, and then we would "execute" it as a group, one step at a time, writing the current value of each variable on the board.

There are other tricks too, such as a simplified interpreter for a totally decimal "machine language", that I would start them with. That makes it much simpler when we start talking about variables and (next course) pointers.

-
That sounds like some great advice but the only thing I am not sure about is point 1 about starting them programming straight away. Would it not be best to teach them logical thinking (e.g breaking a problem down) through working together to solve problems before moving on to the programming language itself? I had also considered using Scratch while teaching the logical/analytical thinking section rather than giving them a full high-level programming language straight away, do you think that would work? –  Joshua Jun 24 '12 at 19:39
I really liked your answer and I am quite surprised that you made the experience "code first". For me it has been the other way around I would solve problems first and only much later got in touch with real implementations, so it's quite interesting to see that there are not much with me :) –  mcwise Jun 24 '12 at 19:40
@Joshua: The problem with the idea "logical thinking" is it's way too vague. When they start making little programs they will be thinking logically, like it or not, so I never made that a separate goal. That said, you need to find your own way forward, so whatever works for you, go for it. –  Mike Dunlavey Jun 24 '12 at 19:42
@mcwise: Not every teacher teaches the same way, but for me, nothing gets students fired up like the first time they write a program that asks them their name and then replies with a random insult like HI THERE BILLY, YOU ARE A BIG SMELLY SLOB :) –  Mike Dunlavey Jun 24 '12 at 19:45
This may be useful: List of programming languages commonly used for pre-university education on Wikipedia. –  rwong Sep 15 '13 at 12:35

I'm no teacher, but my immediate response would be to look to games and puzzles. And in that regard I would actually be looking outside of programming for ideas. I say that because I'm thinking more about general life skills. I would guess that 12-14 year olds are at that point where the skills and interests they pick up will be with them for the rest of their lives.

When I was that age I was introduces to things such as DnD, strategy gaming, Go, Chess, and the sorts of puzzles where the solution could only be achieved through a series of logical steps. Back then there were no personal computers, but I'm sure that being exposed to those things gave me an advantage when getting into computing because I already understood logic and strategic thinking.

So I'd consider finding something that is actually not on computers because it will create a contrast, and also because it will challenge them to write computer programs for it. One example might be the trading card games (such as Magic the Gathering). Games like this require a large amount of mathematics, strategy and problem solving skills to play well. They also create opportunity for software development to get a competitive edge. Even better might be to challenge them to develop their own trading card game or similar.

-
Games came to mind for me as well. I don't know exactly how one implements them in a classroom setting, but I grew up playing chess and real time strategy games and that really got me setup on the analytic thinking front. Chess ends up becoming a list of rules based on previous games and expectations of what your opponent will do. "If I do this, he does this, I do this..." and the key is learning why that works, so you can adapt to new situations. Then you get general heuristics like "attack the center." Its the same idea with any decent RTS game as well (build orders, counters, etc). –  asjohnson Jun 25 '12 at 16:39

Logical thinking is like reasoning backwards. People who are good at this have a specific way of thinking and they are good at observing stuff.

The simplest and silliest example (show this to the children first): if you need to reach office at 8am, you need to catch the bus by 7:30am. For that you need to be reach the bus stop at 7:25am. For that you need to leave your house by 7:10am, and so on. For analytical thinking you need a few things:

1. You need to observe patterns. For example, given this sequence: 1 1 2 3 5 8 13 x, you should be able to see that this is a Fibonacci sequence, and the next number is 13+8=21 A lot of exercises can fall under this. They can practice this.

2. Solving the Sudoku/Minesweeper games are a good way of boosting logical thinking ability as well as concentration. But even they won't be able to teach you complex logical thinking.

3. You can tell them to do this (I think this is called Abstraction): Give them any function/nested for loops and stuff, let them read it, and figure out what it does. You can start with simple stuff, and then make the function a bit complex.

4. They can solve basic trigonometry problems, prove that LHS=RHS types.

5. They can solve puzzles.Various types of them.

-

If you’re looking for material, try The Power of Mindful Learning by Ellen J. Langer. It’s been a while since I read that book, but I remember the book emphasizing the importance of context, different ways of looking at problems, and questioning assumptions.

Here’s a quote from the book that I think summarizes it pretty well:

… the concept of mindfulness revolves around certain psychological states that are really different versions of the same thing: (1) openness to novelty; (2) alertness to distinctions; (3) sensitivity to different contexts; (4) implicit, if not explicit, awareness of multiple perspectives; and (5) orientation in the present.

The book also gives examples of how you might implement mindful learning in a classroom.

-

Have you tried Project Euler? A good way would be to let the class formulate pseudo-code before the actual implementation. You could also start with a very basic sort algorithm like Bubble Sort.

Edit: I have just thought about it a bit more and I think you could introduce your own pseudo-code, like introducing for-loop, if, basic data types like int, show them how everything you introduce works and then let them use it a bit, as I said for example with Project Euler or a basic algorithm.

-
Project Euler's pretty good for finding some nice problem to work with and indeed it is a good resource for problems which the class can come up with some pseudo-code for. The only problem I have found teaching using pseudo code before is that they later often confuse it with real code and try to program with it. Thus I think using psuedo-code would have to come in at the same time as teaching the programming language itself. So I get them to come up with the psuedo-code and then say, this is what that translates to using the language itself. –  Joshua Jun 24 '12 at 19:32
Bubble Sort is way too advanced for beginners. For that, you first have to learn variables, loops, conditionals, and the really big one - arrays. –  Mike Dunlavey Jun 24 '12 at 19:32
While I don't think Bubble Sort is too advanced for beginners (before I knew arrays I just saw the numbers as numbers in that order... not a huge abstraction IMO) but even if it is, you could start with more elementar "problems" such as "given a number n, return the number n*n with + as the only operation" (of course this would require loops as well, maybe it would be even an example to introduce loops) –  mcwise Jun 24 '12 at 19:36

This question reminds me of Jeff Atwood's article "Separating Programming Sheep from Non-Programming Goats" in which a test is described that very well predicts potential programming aptitude of students who have never programmed before.

It describes how some people have learned (or have an innate ability) to develop consistent mental models in their head. I believe the question you may be asking is "How do I teach people to form consistent mental models?"

Unfortunately, I don't know the answer to that, but maybe rephrasing the question is a crucial step. If that can be achieved it would be an ENORMOUS advance in education science and psychology. This is not a small thing.

-

Talking about games, you might also want to look at http://pleasingfungus.com/Manufactoria/

No tips for teaching though. But I can say that when I was taught programming in childhood, it was only games for the whole first few years. Robotlandia the suite was called. One had to write actual code, but as a solution for actual games, and I could say it helped a lot.

I would guess that it really helps to see the results of your work, graphically and step by step, and being able to deduce from that what went wrong. I'm not sure you have to actually teach anything as much as helping kids find the solution themselves, and provide the most interesting (but not hard) problems and shiny tools to solve them.

-

Congratulations on teaching programming to kids. I have been teaching adult learners programming for almost 8 years now and I think that it is important to combine both programming logic with hands on programming experience. This allows the student to match the abstract with the concrete. Although it can be slow going at first in the long run the student has a better foundation and understands the process more completely.

-